From 16947fa653d14659c2aa736eb9bc8af4fef25e2a Mon Sep 17 00:00:00 2001 From: kurund Date: Fri, 29 Nov 2013 15:03:29 +0530 Subject: [PATCH] CRM-13809, notic fixes and batch mode fixes ---------------------------------------- * CRM-13809: send email activity: cc may go to wrong contact http://issues.civicrm.org/jira/browse/CRM-13809 --- CRM/Contact/Form/Task/Email.php | 30 +++++++++++++++++++++++++++ CRM/Contact/Form/Task/EmailCommon.php | 14 ++++--------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/CRM/Contact/Form/Task/Email.php b/CRM/Contact/Form/Task/Email.php index f6d41ef0fa..4dacf27b83 100644 --- a/CRM/Contact/Form/Task/Email.php +++ b/CRM/Contact/Form/Task/Email.php @@ -62,6 +62,36 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task { */ public $_templates = NULL; + /** + * store "to" contact details + * @var array + */ + public $_toContactDetails = array(); + + /** + * store all selected contact id's, that includes to, cc and bcc contacts + * @var array + */ + public $_allContactIds = array(); + + /** + * store only "to" contact ids + * @var array + */ + public $_toContactIds = array(); + + /** + * store only "cc" contact ids + * @var array + */ + public $_ccContactIds = array(); + + /** + * store only "bcc" contact ids + * @var array + */ + public $_bccContactIds = array(); + /** * build all the data structures needed to build the form * diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php index aaf247dc63..538ea48811 100644 --- a/CRM/Contact/Form/Task/EmailCommon.php +++ b/CRM/Contact/Form/Task/EmailCommon.php @@ -45,12 +45,6 @@ class CRM_Contact_Form_Task_EmailCommon { public $_allContactDetails = array(); public $_toContactEmails = array(); - public $_toContactDetails = array(); - public $_allContactIds = array(); - public $_toContactIds = array(); - public $_ccContactIds = array(); - public $_bccContactIds = array(); - static function preProcessFromAddress(&$form) { $form->_single = FALSE; $className = CRM_Utils_System::getClassName($form); @@ -147,11 +141,12 @@ class CRM_Contact_Form_Task_EmailCommon { } $elements = array('to', 'cc', 'bcc'); + $form->_allContactIds = $form->_toContactIds = $form->_contactIds; foreach ($elements as $element) { if ($$element->getValue()) { $allEmails = explode(',', $$element->getValue()); if ($element == 'to') { - $form->_contactIds = array(); + $form->_toContactIds = $form->_contactIds = array(); } foreach ($allEmails as $value) { @@ -181,12 +176,11 @@ class CRM_Contact_Form_Task_EmailCommon { //get the group of contacts as per selected by user in case of Find Activities if (!empty($form->_activityHolderIds)) { $contact = $form->get('contacts'); - $form->_contactIds = $contact; + $form->_allContactIds = $form->_contactIds = $contact; } - // check if we need to setdefaults and check for valid contact emails / communication preferences - if (is_array($form->_contactIds) && $setDefaults) { + if (is_array($form->_allContactIds) && $setDefaults) { $returnProperties = array( 'sort_name' => 1, 'email' => 1, -- 2.25.1