- // unknown mobile sender -- create new contact
- // use fake @mobile.sms email address for new contact since civi
- // requires email or name for all contacts
- $locationTypes =& CRM_Core_PseudoConstant::locationType();
- $phoneTypes =& CRM_Core_PseudoConstant::phoneType();
- $phoneloc = array_search( 'Home', $locationTypes );
- $phonetype = array_search( 'Mobile', $phoneTypes );
- $stripFrom = $this->stripPhone($from);
- $contactparams =
- Array ( 'contact_type' => 'Individual',
- 'email' => Array ( 1 => Array ( 'location_type_id' => $phoneloc,
- 'email' => $stripFrom . '@mobile.sms' )
- ),
- 'phone' => Array ( 1 => Array( 'phone_type_id' => $phonetype,
- 'location_type_id' => $phoneloc,
- 'phone' => $stripFrom )
- )
- );
- $fromContact = CRM_Contact_BAO_Contact::create($contactparams, FALSE, TRUE, FALSE);
+ // unknown mobile sender -- create new contact
+ // use fake @mobile.sms email address for new contact since civi
+ // requires email or name for all contacts
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
+ $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
+ $phoneloc = array_search('Home', $locationTypes);
+ $phonetype = array_search('Mobile', $phoneTypes);
+ $stripFrom = $this->stripPhone($from);
+ $contactparams = array(
+ 'contact_type' => 'Individual',
+ 'email' => array(1 => array(
+ 'location_type_id' => $phoneloc,
+ 'email' => $stripFrom . '@mobile.sms'
+ )),
+ 'phone' => array(1 => array(
+ 'phone_type_id' => $phonetype,
+ 'location_type_id' => $phoneloc,
+ 'phone' => $stripFrom
+ )),
+ );
+ $fromContact = CRM_Contact_BAO_Contact::create($contactparams, FALSE, TRUE, FALSE);