From fc110b689bb49fb73102139fd5663ee3892575ec Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 23 Jun 2015 12:04:49 +0530 Subject: [PATCH] CRM-16665: more cleanup ---------------------------------------- * CRM-16665: Add followup activity to "Send Email" form https://issues.civicrm.org/jira/browse/CRM-16665 --- CRM/Activity/BAO/Activity.php | 12 ++++++++---- CRM/Case/Form/Activity.php | 20 +++----------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php index 7d5bbc9280..473435d505 100644 --- a/CRM/Activity/BAO/Activity.php +++ b/CRM/Activity/BAO/Activity.php @@ -2732,18 +2732,22 @@ INNER JOIN civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n * * @param object $activity * @param array $mailToContacts + * @param array $params * * @return bool */ - public static function sendToAssignee($activity, $mailToContacts) { - if (!CRM_Utils_array::crmIsEmptyArray($mailToContacts)) { + public static function sendToAssignee($activity, $mailToContacts, $params = array()) { + if (!CRM_Utils_Array::crmIsEmptyArray($mailToContacts)) { + $clientID = CRM_Utils_Array::value('client_id', $params); + $caseID = CRM_Utils_Array::value('case_id', $params); + $ics = new CRM_Activity_BAO_ICalendar($activity); $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', $activity->id); $ics->addAttachment($attachments, $mailToContacts); - CRM_Case_BAO_Case::sendActivityCopy(NULL, $activity->id, $mailToContacts, $attachments, NULL); + $result = CRM_Case_BAO_Case::sendActivityCopy($clientID, $activity->id, $mailToContacts, $attachments, $caseID); $ics->cleanup(); - return TRUE; + return $result; } return FALSE; } diff --git a/CRM/Case/Form/Activity.php b/CRM/Case/Form/Activity.php index 5ad909a51b..00b849ad30 100644 --- a/CRM/Case/Form/Activity.php +++ b/CRM/Case/Form/Activity.php @@ -663,23 +663,9 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity { } } - if (!CRM_Utils_array::crmIsEmptyArray($mailToContacts)) { - //include attachments while sending a copy of activity. - $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', - $vval['actId'] - ); - - $ics = new CRM_Activity_BAO_ICalendar($activity); - $ics->addAttachment($attachments, $mailToContacts); - $result = CRM_Case_BAO_Case::sendActivityCopy($this->_currentlyViewedContactId, - $vval['actId'], $mailToContacts, $attachments, $vval['case_id'] - ); - $ics->cleanup(); - if (empty($result)) { - $mailStatus = ''; - } - } - else { + $params = array('case_id' => $vval['case_id'], 'client_id' => $this->_currentlyViewedContactId); + $result = CRM_Activity_BAO_Activity::sendToAssignee($activity, $mailToContacts, $params); + if (empty($result)) { $mailStatus = ''; } -- 2.25.1