From d65e1a68e90aaf5eb3296aabc623cff15bbe6f65 Mon Sep 17 00:00:00 2001 From: Thom Wilhelm Date: Fri, 5 Apr 2013 17:50:40 +0100 Subject: [PATCH] Only send SMS if it is a mobile number, do not delete parent activity as it might be shared between many users --- CRM/Activity/BAO/Activity.php | 7 ++++++- .../org_civicrm_sms_clickatell.php | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index f86e7a5935..e58e29f021 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -1515,7 +1515,12 @@ LEFT JOIN civicrm_case_activity ON ( civicrm_case_activity.activity_id = tbl.a $tokenHtml = CRM_Utils_Token::replaceContactTokens($html, $values, TRUE, $messageToken, FALSE, $escapeSmarty); $tokenHtml = CRM_Utils_Token::replaceHookTokens($tokenHtml, $values, $categories, TRUE, $escapeSmarty); - $smsParams['To'] = $values['phone']; + // Only send if the phone is of type mobile + if($values['phone_type_id'] == 2) { + $smsParams['To'] = $values['phone']; + }else{ + $smsParams['To'] = ''; + } if (self::sendSMSMessage($contactId, $tokenText, diff --git a/tools/extensions/org.civicrm.sms.clickatell/org_civicrm_sms_clickatell.php b/tools/extensions/org.civicrm.sms.clickatell/org_civicrm_sms_clickatell.php index 98be673190..1eeac0664d 100644 --- a/tools/extensions/org.civicrm.sms.clickatell/org_civicrm_sms_clickatell.php +++ b/tools/extensions/org.civicrm.sms.clickatell/org_civicrm_sms_clickatell.php @@ -284,12 +284,10 @@ class org_civicrm_sms_clickatell extends CRM_SMS_Provider { return $send[1]; } else { - // delete any parent activity & throw error - if (CRM_Utils_Array::value('parent_activity_id', $header)) { - $params = array('id' => $header['parent_activity_id']); - CRM_Activity_BAO_Activity::deleteActivity($params); - } - return PEAR::raiseError($response['data']); + // TODO: Should add a failed activity instead. + + CRM_Core_Error::debug_log_message($response['data']); + return; } } } -- 2.25.1