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 »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Additional Phone and email to an organization
Pages: [1]

Author Topic: Additional Phone and email to an organization  (Read 2236 times)

chrisdaems

  • Guest
Additional Phone and email to an organization
August 21, 2007, 02:26:07 pm
Hi,

I try to add an additional phone and or email address to an organization by using the API.
Creating the organization and adding the organization to a group works, but I can't add an additional phone number to the same organization

this is a piece of the code
     
Code: [Select]
crm_update_location($contact,$loc->id,$params);
Do I use the correct API function?
Thanks,
Chris

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: Additional Phone and email to an organization
August 21, 2007, 03:34:31 pm

you'll have to give us a bit more of the code. specifically what is your $params array? and what is the current state of the contact

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

chrisdaems

  • Guest
Re: Additional Phone and email to an organization
August 22, 2007, 12:32:47 pm
Hi,

Here is a little bit more code.
I'm not sure if I'm using the correct API function.

Code: [Select]
$organization = array(
   'organization_name' => $form_values['organization_name'],
   'primary_contact_id' => $usr->id,
   'contact_id'        => $form_values['contact_id'],
   'phone'             => $form_values['phone'],
   'phone_type'        => 'Phone',
   'email'             => $form_values['email'],
   'street_address'    => $form_values['street_address'],
   'postal_code'       => $form_values['postal_code'],
   'city'              => $form_values['city'],
   'country'           => $form_values['country'],
   'home_URL'          => $form_values['website'],
   'location_type'     => 'Main'
);

        // add contact record 
$contact =& crm_create_contact($organization, 'Organization');
//print_r($contact);
$faxPhone = array('phone'      => '1234-234-34',
                          'phone_type' => 'Fax'
                         );
        $fax = array($faxphone);
        $loc = crm_get_locations($contact,'Main');
        $newLocation = crm_update_location($contact,$loc->id,$fax);

How can I check the state of the contact?
Thanks,
chris

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Additional Phone and email to an organization
August 22, 2007, 01:47:47 pm
Please check following test cases:

http://svn.civicrm.org/branches/v1.8/test/CRM/api/UpdateLocation.php

kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Additional Phone and email to an organization

This forum was archived on 2017-11-26.