diff --git a/CRM/Grant/Form/Task/Batch.php b/CRM/Grant/Form/Task/Batch.php index 828cf7a98af256db59e40e93473f5c8548829ffd..15977c67c308738eb8e8ccb8ba3c2b486d32f0b8 100644 --- a/CRM/Grant/Form/Task/Batch.php +++ b/CRM/Grant/Form/Task/Batch.php @@ -80,7 +80,7 @@ class CRM_Grant_Form_Task_Batch extends CRM_Grant_Form_Task { * initialize the task and row fields */ parent::preProcess(); - $this->_contactDetails = CRM_Mrg_BAO_Mrg::contactDetails($this->_grantIds); + $this->_contactDetails = $this->get('contactDetails'); $this->assign('contactDetails', $this->_contactDetails); $this->assign('readOnlyFields', array('sort_name' => ts('Name'))); } diff --git a/CRM/Grant/Form/Task/PickProfile.php b/CRM/Grant/Form/Task/PickProfile.php index 51d7f5fe2ab9b9775ca90523660f376b8e712535..791c720e0f52e6ca44483ba5e965ecb0e56570f9 100644 --- a/CRM/Grant/Form/Task/PickProfile.php +++ b/CRM/Grant/Form/Task/PickProfile.php @@ -77,7 +77,14 @@ class CRM_Grant_Form_Task_PickProfile extends CRM_Grant_Form_Task { $session = CRM_Core_Session::singleton(); $this->_userContext = $session->readUserContext(); - + $this->_contactDetails = CRM_Mrg_BAO_Mrg::contactDetails($this->_grantIds); + $this->set('contactDetails', $this->_contactDetails); + $this->_contactIds = array(); + + foreach ($this->_contactDetails as $value) { + $this->_contactIds[] = $value['contact_id']; + } + $validate = FALSE; //validations if (count($this->_grantIds) > $this->_maxGrants) { @@ -85,6 +92,11 @@ class CRM_Grant_Form_Task_PickProfile extends CRM_Grant_Form_Task { $validate = TRUE; } + if (CRM_Contact_BAO_Contact_Utils::checkContactType($this->_contactIds) && 0) { + CRM_Core_Session::setStatus(ts("Batch update requires that all selected contacts be the same basic type (e.g. all Individuals OR all Organizations...). Please modify your selection and try again."), ts('Contact Type Mismatch'), 'error'); + $validate = TRUE; + } + // then redirect if error if ($validate) { CRM_Utils_System::redirect($this->_userContext);