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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Location API
Pages: [1]

Author Topic: Location API  (Read 801 times)

chirayu

  • Guest
Location API
September 02, 2010, 05:05:53 am
Hi all,

I am trying to add two addresses for a contact using civicrm_location_update. This is my code (note that I would NOT like to add the second address as a supplemental address):
Code: [Select]
$home_phone = array( 'phone'              => '02065748835',
                       'phone_type_id'      => '1',
                       'location_type_id'   => '1'
                     );
  $mobile = array( 'phone'             => '07936352690',
                   'phone_type_id'     => '2',
                   'location_type_id'  => '3'
                 );
  $phones = array( $home_phone, $mobile);
 
  $email_first = array( 'email'            => 'chirayu11@hotmail.co.uk',
                        'location_type_id' => '2',
                        'is_primary'       => true
                      );
  $email_second = array( 'email'            => 'chirayu@m.com',
                         'location_type_id' => '2'
                       );
  $emails = array($email_first, $email_second);

  $address = array( 1 => array( 'location_type_id' => '1',
                                'city'             => 'London',
                                'postal_code'      => 'TW5 0DF',
                                'street_address'   => '293 Caledonian Road',
                                'is_primary'       => true
                              ),
                    2 => array( 'location_type_id' => '1',
                                'city'             => 'Cardiff',
                                'postal_code'      => 'CF43 4DF',
                                'street_address'   => '24',
                                'country'          => 'United Kingdom'
                              )
                  );

  $params = array( 'version'    => '3.0',
                   'contact_id' => '100',
                   'address'    => $address,
                   'phone'      => $phones,
                   'email'      => $emails
                 );
$location =& civicrm_location_update($params);

Here is my error message:
Code: [Select]
Array
(
    [is_error] => 1
    [error_message] => Invalid Location Type(s) : Work, Home, Main
)

Any help available?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Location API

This forum was archived on 2017-11-26.