Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 1.2
-
Fix Version/s: None
-
Component/s: Technical infrastructure
-
Labels:None
Description
When crm_update_contact() is invoked, it returns the CRM object's OLD values.
The workaround is to do a crm_get_contact immediately after the update to fetch the correct values from the database.
Example:
$values = array('prefix' => 'Mr',
'first_name' => 'George',
'last_name' => 'Bush',
'postal_code' => '4001',
'email' => uniqid('george').'@cruickshank.biz');
$CRM = crm_create_contact($values);
$contactId = $CRM->id; // $CRM->contact_id is NOT set
$values2 = array('prefix' => 'Mrs',
'first_name' => 'Hilary',
'last_name' => 'Clinton',
'postal_code'=> '4003',
'email' => 'hilary@cruickshank.biz');
$CRM2 = crm_update_contact($CRM,$values2);
Both $CRM2 and $CRM still contain 'Mr George Bush' etc
NB
- the 'prefix' field is never set. (prefix_id is), and
- contact_id is not set (id is).
Tested on 1.2 Beta dated 24 October 2005.