Ejemplo n.º 1
0
/**
 * Add or update a contact. If a dupe is found, check for
 * ignoreDupe flag to ignore or return error
 *
 * @deprecated deprecated since version 2.2.3; use civicrm_contact_create or civicrm_contact_update instead
 *
 * @param  array   $params           (reference ) input parameters
 *
 * @return array (reference )        contact_id of created or updated contact
 * @static void
 * @access public
 */
function &civicrm_contact_add(&$params)
{
    _civicrm_initialize();
    $contactID = CRM_Utils_Array::value('contact_id', $params);
    if (!empty($contactID)) {
        $result = civicrm_contact_update($params);
    } else {
        $result = civicrm_contact_create($params);
    }
    return $result;
}
Ejemplo n.º 2
0
 /**
  *  Test civicrm_contact_update() with create=true and a
  *  contact_id in the parameters (should return an error) 
  */
 public function testUpdateCreateWithID()
 {
     $params = array('contact_id' => 23, 'first_name' => 'abcd', 'last_name' => 'wxyz', 'contact_type' => 'Individual');
     $result =& civicrm_contact_update($params, true);
     $this->assertTrue(is_array($result));
     $this->assertEquals(1, $result['is_error']);
 }