/** * Build all the data structures needed to build the form. */ public function preProcess() { CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this); parent::preProcess(); // we have all the contribution ids, so now we get the contact ids parent::setContactIDs(); $this->assign('single', $this->_single); }
/** * Process the form after the input has been submitted and validated. */ public function postProcess() { // Clear any formRule errors from Email form in case they came back here via Cancel button $this->controller->resetPage('Email'); $params = $this->exportValues(); $this->_contacts = array(); $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name'); $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); // Get assignee contacts. if (!empty($params['assigned_to'])) { foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityContact::getNames($id, $assigneeID)); $this->_contacts = array_merge($this->_contacts, $ids); } } // Get target contacts. if (!empty($params['with_contact'])) { foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityContact::getNames($id, $targetID)); $this->_contacts = array_merge($this->_contacts, $ids); } } // Get 'Added by' contacts. if (!empty($params['created_by'])) { parent::setContactIDs(); if (!empty($this->_contactIds)) { $this->_contacts = array_merge($this->_contacts, $this->_contactIds); } } $this->_contacts = array_unique($this->_contacts); // Bounce to pick option if no contacts to send to. if (empty($this->_contacts)) { $urlParams = "_qf_PickOption_display=true&qfKey={$params['qfKey']}"; $urlRedirect = CRM_Utils_System::url('civicrm/activity/search', $urlParams); CRM_Core_Error::statusBounce(ts('It appears you have no contacts with email addresses from the selected recipients.'), $urlRedirect); } $this->set('contacts', $this->_contacts); }
/** * process the form after the input has been submitted and validated * * @access public * @return None */ public function postProcess() { $params = $this->exportValues(); $this->_contacts = array(); //get assignee contacts if ($params['assigned_to']) { require_once 'CRM/Activity/BAO/ActivityAssignment.php'; foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($id)); $this->_contacts = array_merge($this->_contacts, $ids); } } //get target contacts if ($params['with_contact']) { require_once 'CRM/Activity/BAO/ActivityTarget.php'; foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityTarget::getTargetNames($id)); $this->_contacts = array_merge($this->_contacts, $ids); } } //get 'Added by' contacts if ($params['created_by']) { parent::setContactIDs(); if (!empty($this->_contactIds)) { $this->_contacts = array_merge($this->_contacts, $this->_contactIds); } } $this->_contacts = array_unique($this->_contacts); $this->set('contacts', $this->_contacts); }
/** * process the form after the input has been submitted and validated * * @access public * * @return None */ public function postProcess() { $params = $this->exportValues(); $this->_contacts = array(); //get assignee contacts if ($params['assigned_to']) { foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityAssignment::getAssigneeNames($id)); $this->_contacts = array_merge($this->_contacts, $ids); } } //get target contacts if ($params['with_contact']) { foreach ($this->_activityHolderIds as $key => $id) { $ids = array_keys(CRM_Activity_BAO_ActivityTarget::getTargetNames($id)); $this->_contacts = array_merge($this->_contacts, $ids); } } //get 'Added by' contacts if ($params['created_by']) { parent::setContactIDs(); if (!empty($this->_contactIds)) { $this->_contacts = array_merge($this->_contacts, $this->_contactIds); } } $this->_contacts = array_unique($this->_contacts); //bounce to pick option if no contacts to send to if (empty($this->_contacts)) { $urlParams = "_qf_PickOption_display=true&qfKey={$params['qfKey']}"; $urlRedirect = CRM_Utils_System::url('civicrm/activity/search', $urlParams); CRM_Core_Error::statusBounce(ts('It appears you have no contacts with emails from the selected recipients.'), $urlRedirect); } $this->set('contacts', $this->_contacts); }