_userContext = $session->readUserContext(); CRM_Utils_System::setTitle(ts('Batch Update Contributions via Profile')); $validate = FALSE; //validations if (count($this->_contributionIds) > $this->_maxContributions) { CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch Update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(1 => $this->_maxContributions, 2 => count($this->_contributionIds))), ts('Batch Update Error'), 'error'); $validate = TRUE; } // than redirect if ($validate) { CRM_Utils_System::redirect($this->_userContext); } } /** * Build the form * * @access public * * @return void */ function buildQuickForm() { $types = array('Contribution'); $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE); if (empty($profiles)) { CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch Update via Profile. Navigate to Administer CiviCRM >> CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), 'Profile Required', 'error'); CRM_Utils_System::redirect($this->_userContext); } $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array( '' => ts('- select profile -')) + $profiles, TRUE ); $this->addDefaultButtons(ts('Continue >>')); } /** * Add local and global form rules * * @access protected * * @return void */ function addRules() { $this->addFormRule(array('CRM_Contribute_Form_Task_PickProfile', 'formRule')); } /** * global validation rules for the form * * @param array $fields posted values of the form * * @return array list of errors to be posted back to the form * @static * @access public */ static function formRule($fields) { return TRUE; } /** * process the form after the input has been submitted and validated * * @access public * * @return None */ public function postProcess() { $params = $this->exportValues(); $this->set('ufGroupId', $params['uf_group_id']); // also reset the batch page so it gets new values from the db $this->controller->resetPage('Batch'); } //end of function }