$fromContactID=CRM_Core_DAO::singleValueQuery('SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE "%'.$escapedFrom.'"');
$message->fromContactID=CRM_Core_DAO::singleValueQuery('SELECT contact_id FROM civicrm_phone JOIN civicrm_contact ON civicrm_contact.id = civicrm_phone.contact_id WHERE !civicrm_contact.is_deleted AND phone LIKE "%'.$escapedFrom.'"');
if($fromContactID){
if($message->fromContactID){
CRM_Contact_BAO_GroupContact::AddContactsToGroup(
CRM_Contact_BAO_GroupContact::AddContactsToGroup(
array($fromContactID),5,'SMS','Added'
array($message->fromContactID),5,'SMS','Added'
);
);
}
}
}
}
...
@@ -72,7 +72,7 @@ function myextension_civicrm_inboundSMS(&$message) {
...
@@ -72,7 +72,7 @@ function myextension_civicrm_inboundSMS(&$message) {
// Implement custom matching logic
// Implement custom matching logic
// If there are multiple contacts with the phone number, preference the one that has been sent an SMS most recently
// If there are multiple contacts with the phone number, preference the one that has been sent an SMS most recently