CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Setting Primary Organisation Address Programmatically
Pages: [1]

Author Topic: Setting Primary Organisation Address Programmatically  (Read 887 times)

freshwebservices

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2.6
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Setting Primary Organisation Address Programmatically
December 18, 2012, 07:23:44 am
Hi,

Hi, I'm attempting to set the "Primary Organisation Address",  "System-generated Mail Settings" & "Organisation Contact Information" via a script.
In Civi 4.2.6 how can you do this?

The "System-generated Mail Settings" are set via an OptionValue (id 445, option_group_id=30, domain_id=1) & the Address via the Address Object but I can't seem to find a common key beyond the civicrm_loc_block table.

Does anyone have an example of using the API or BAO to do this?

Thanks,
Civi 4.2.6 Drupal 7

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Setting Primary Organisation Address Programmatically
December 18, 2012, 09:01:26 am

If there is no API for the below in 4.2.x, your best bet would be to check the php files that save that information and check the postProcess function

if you get on IRC, we can help u get started. the developer book: http://book.civicrm.org/developer/ has lots of great info also :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Setting Primary Organisation Address Programmatically
December 18, 2012, 02:31:01 pm
The loc bloc table holds a reference to the various address tables - so you basically need to create an address & then update the loc block table with the id of that address.

I *think* someone submitted an API for this - but I have a suspicion it was Jon & it's not in 4.2 but 4.3 (although v easy to backport I expect)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Setting Primary Organisation Address Programmatically

This forum was archived on 2017-11-26.