/** * Build all the data structures needed to build the form. * * @return void */ public function preProcess() { // initialize the task and row fields parent::preProcess(); $session = CRM_Core_Session::singleton(); $this->_userContext = $session->readUserContext(); $validate = FALSE; //validations if (count($this->_contactIds) > $this->_maxContacts) { CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Batch Update is %1. You have selected %2. Please select fewer contacts from your search results and try again.", array(1 => $this->_maxContacts, 2 => count($this->_contactIds))), ts('Maximum Exceeded'), 'error'); $validate = TRUE; } if (CRM_Contact_BAO_Contact_Utils::checkContactType($this->_contactIds)) { 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; } // than redirect if ($validate) { CRM_Utils_System::redirect($this->_userContext); } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { /* * initialize the task and row fields */ parent::preProcess(); $session = CRM_Core_Session::singleton(); $this->_userContext = $session->readUserContext(); $validate = FALSE; //validations if (count($this->_contactIds) > $this->_maxContacts) { CRM_Core_Session::setStatus("The maximum number of contacts you can select for Batch Update is {$this->_maxContacts}. You have selected " . count($this->_contactIds) . ". Please select fewer contacts from your search results and try again."); $validate = TRUE; } if (CRM_Contact_BAO_Contact_Utils::checkContactType($this->_contactIds)) { CRM_Core_Session::setStatus("Batch update requires that all selected contacts be the same type (e.g. all Individuals OR all Organizations...). Please modify your selected contacts and try again."); $validate = TRUE; } // than redirect if ($validate) { CRM_Utils_System::redirect($this->_userContext); } }