/** * This method is called for processing a submitted search form. */ public function postProcess() { $this->set('isAdvanced', '0'); $this->set('isSearchBuilder', '0'); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); } if (isset($this->_groupID) && empty($this->_formValues['group'])) { $this->_formValues['group'] = $this->_groupID; } elseif (isset($this->_ssID) && empty($_POST)) { // if we are editing / running a saved search and the form has not been posted $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); //fix for CRM-1505 if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID, 'mapping_id')) { $this->_params = CRM_Contact_BAO_SavedSearch::getSearchParams($this->_ssID); } } // we dont want to store the sortByCharacter in the formValue, it is more like // a filter on the result set // this filter is reset if we click on the search button if ($this->_sortByCharacter !== NULL && empty($_POST)) { if (strtolower($this->_sortByCharacter) == 'all') { $this->_formValues['sortByCharacter'] = NULL; } else { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } else { $this->_sortByCharacter = NULL; } $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $this->_returnProperties =& $this->returnProperties(); parent::postProcess(); }
/** * Process the uploaded file * * @return void * @access public */ public function postProcess() { $this->set('isAdvanced', '2'); $this->set('isSearchBuilder', '1'); $this->set('showSearchForm', FALSE); $params = $this->controller->exportValues($this->_name); if (!empty($params)) { // Add another block if (!empty($params['addBlock'])) { $this->set('newBlock', $this->_blockCount); $this->_blockCount += 3; $this->set('blockCount', $this->_blockCount); $this->set('showSearchForm', TRUE); return; } // Add another field $addMore = CRM_Utils_Array::value('addMore', $params); for ($x = 1; $x <= $this->_blockCount; $x++) { if (!empty($addMore[$x])) { $this->set('newBlock', $x); $this->_columnCount[$x] = $this->_columnCount[$x] + 5; $this->set('columnCount', $this->_columnCount); $this->set('showSearchForm', TRUE); return; } } $this->set('newBlock', NULL); $checkEmpty = NULL; foreach ($params['mapper'] as $key => $value) { foreach ($value as $k => $v) { if ($v[0]) { $checkEmpty++; } } } if (!$checkEmpty) { $this->set('newBlock', 1); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/search/builder', '_qf_Builder_display=true')); } } // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); // set the group if group is submitted if (CRM_Utils_Array::value('uf_group_id', $this->_formValues)) { $this->set('id', $this->_formValues['uf_group_id']); } else { $this->set('id', ''); } } // we dont want to store the sortByCharacter in the formValue, it is more like // a filter on the result set // this filter is reset if we click on the search button if ($this->_sortByCharacter !== NULL && empty($_POST)) { if (strtolower($this->_sortByCharacter) == 'all') { $this->_formValues['sortByCharacter'] = NULL; } else { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } else { $this->_sortByCharacter = NULL; } $this->_params =& $this->convertFormValues($this->_formValues); $this->_returnProperties =& $this->returnProperties(); // CRM-10338 check if value is empty array foreach ($this->_params as $k => $v) { $this->_params[$k][2] = self::checkArrayKeyEmpty($v[2]); } parent::postProcess(); }
/** * The post processing of the form gets done here. * * Key things done during post processing are * - check for reset or next request. if present, skip post procesing. * - now check if user requested running a saved search, if so, then * the form values associated with the saved search are used for searching. * - if user has done a submit with new values the regular post submissing is * done. * The processing consists of using a Selector / Controller framework for getting the * search results. * * @param * * @return void * @access public */ function postProcess() { $this->set('isAdvanced', '1'); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); $this->normalizeFormValues(); // FIXME: couldn't figure out a good place to do this, // FIXME: so leaving this as a dependency for now if (array_key_exists('contribution_amount_low', $this->_formValues)) { foreach (array('contribution_amount_low', 'contribution_amount_high') as $f) { $this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]); } } // set the group if group is submitted if (!empty($this->_formValues['uf_group_id'])) { $this->set('id', $this->_formValues['uf_group_id']); } else { $this->set('id', ''); } } // retrieve ssID values only if formValues is null, i.e. form has never been posted if (empty($this->_formValues) && isset($this->_ssID)) { $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); } if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) { $this->_formValues['group'] = array($this->_groupID => 1); } //search for civicase if (is_array($this->_formValues)) { $allCases = FALSE; if (array_key_exists('case_owner', $this->_formValues) && !$this->_formValues['case_owner'] && !$this->_force) { foreach (array('case_type_id', 'case_status_id', 'case_deleted', 'case_tags') as $caseCriteria) { if (CRM_Utils_Array::value($caseCriteria, $this->_formValues)) { $allCases = TRUE; $this->_formValues['case_owner'] = 1; continue; } } if ($allCases) { if (CRM_Core_Permission::check('access all cases and activities')) { $this->_formValues['case_owner'] = 1; } else { $this->_formValues['case_owner'] = 2; } } else { $this->_formValues['case_owner'] = 0; } } } // we dont want to store the sortByCharacter in the formValue, it is more like // a filter on the result set // this filter is reset if we click on the search button if ($this->_sortByCharacter !== NULL && empty($_POST)) { if (strtolower($this->_sortByCharacter) == 'all') { $this->_formValues['sortByCharacter'] = NULL; } else { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } else { $this->_sortByCharacter = NULL; } CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues); $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $this->_returnProperties =& $this->returnProperties(); parent::postProcess(); }
function postProcess() { $this->set('isAdvanced', '3'); $this->set('isCustom', '1'); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); $this->_formValues['customSearchID'] = $this->_customSearchID; $this->_formValues['customSearchClass'] = $this->_customSearchClass; } //use the custom selector self::$_selectorName = 'CRM_Contact_Selector_Custom'; parent::postProcess(); }
/** * this method is called for processing a submitted search form * * @return void * @access public */ function postProcess() { $session =& CRM_Core_Session::singleton(); $session->set('isAdvanced', '0'); $session->set('isSearchBuilder', '0'); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); $this->normalizeFormValues(); } if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) { $this->_formValues['group'][$this->_groupID] = 1; } else { if (isset($this->_ssID) && empty($_POST)) { // if we are editing / running a saved search and the form has not been posted $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); //fix for CRM-1505 if (CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $this->_ssID, 'mapping_id')) { $this->_params =& CRM_Contact_BAO_SavedSearch::getSearchParams($this->_ssID); } } } // we dont want to store the sortByCharacter in the formValue, it is more like // a filter on the result set // this filter is reset if we click on the search button if ($this->_sortByCharacter && empty($_POST)) { if ($this->_sortByCharacter == 1) { $this->_formValues['sortByCharacter'] = null; } else { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $this->_returnProperties =& $this->returnProperties(); // CRM_Core_Error::debug( 'f', $this->_formValues ); // CRM_Core_Error::debug( 'p', $this->_params ); parent::postProcess(); }
function postProcess() { $session =& CRM_Core_Session::singleton(); $session->set('isAdvanced', '3'); $session->set('isCustom', '1'); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); $this->_formValues['customSearchID'] = $this->_customSearchID; $this->_formValues['customSearchClass'] = $this->_customSearchClass; } parent::postProcess(); }
/** * Process the uploaded file * * @return void * @access public */ public function postProcess() { $session =& CRM_Core_Session::singleton(); $session->set('isAdvanced', '2'); $session->set('isSearchBuilder', '1'); $params = $this->controller->exportValues($this->_name); if (!empty($params)) { if (CRM_Utils_Array::value('addBlock', $params)) { $this->_blockCount = $this->_blockCount + 1; $this->set('blockCount', $this->_blockCount); return; } for ($x = 1; $x <= $this->_blockCount; $x++) { if (CRM_Utils_Array::value($x, $params['addMore'])) { $this->_columnCount[$x] = $this->_columnCount[$x] + 1; $this->set('columnCount', $this->_columnCount); return; } } $checkEmpty = null; foreach ($params['mapper'] as $key => $value) { foreach ($value as $k => $v) { if ($v[0]) { $checkEmpty++; } } } if (!$checkEmpty) { require_once 'CRM/Utils/System.php'; CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/search/builder', '_qf_Builder_display=true')); } } // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); // set the group if group is submitted if (CRM_Utils_Array::value('uf_group_id', $this->_formValues)) { $this->set('id', $this->_formValues['uf_group_id']); } else { $this->set('id', ''); } } // we dont want to store the sortByCharacter in the formValue, it is more like // a filter on the result set // this filter is reset if we click on the search button if ($this->_sortByCharacter && empty($_POST)) { if ($this->_sortByCharacter == 1) { $this->_formValues['sortByCharacter'] = null; } else { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } $this->_params =& $this->convertFormValues($this->_formValues); $this->_returnProperties =& $this->returnProperties(); parent::postProcess(); }
/** * The post processing of the form gets done here. * * Key things done during post processing are * - check for reset or next request. if present, skip post procesing. * - now check if user requested running a saved search, if so, then * the form values associated with the saved search are used for searching. * - if user has done a submit with new values the regular post submissing is * done. * The processing consists of using a Selector / Controller framework for getting the * search results. * * @param * * @return void * @access public */ function postProcess() { $session =& CRM_Core_Session::singleton(); $session->set('isAdvanced', '1'); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this if (!empty($_POST)) { $this->_formValues = $this->controller->exportValues($this->_name); // FIXME: couldn't figure out a good place to do this, // FIXME: so leaving this as a dependency for now if (array_key_exists('contribution_amount_low', $this->_formValues)) { foreach (array('contribution_amount_low', 'contribution_amount_high') as $f) { $this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]); } } //assigning event values for autocomplete event selection $eventSearchIds = array('event_id' => 'event_name_id', 'event_type' => 'event_type_id', 'participant_fee_level' => 'participant_fee_id'); foreach ($eventSearchIds as $key => $value) { $this->_formValues[$key] = empty($this->_formValues[$key]) ? '' : $this->_formValues[$value]; $this->_formValues[$value] = ''; } // set the group if group is submitted if ($this->_formValues['uf_group_id']) { $this->set('id', $this->_formValues['uf_group_id']); } else { $this->set('id', ''); } } // retrieve ssID values only if formValues is null, i.e. form has never been posted if (empty($this->_formValues) && isset($this->_ssID)) { $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); } if (isset($this->_groupID) && !CRM_Utils_Array::value('group', $this->_formValues)) { $this->_formValues['group'] = array($this->_groupID => 1); } //search for civicase if (is_array($this->_formValues)) { if (array_key_exists('case_owner', $this->_formValues) && !$this->_formValues['case_owner'] && !$this->_force) { $this->_formValues['case_owner'] = 0; } else { if (array_key_exists('case_owner', $this->_formValues)) { $this->_formValues['case_owner'] = 1; } } } // we dont want to store the sortByCharacter in the formValue, it is more like // a filter on the result set // this filter is reset if we click on the search button if ($this->_sortByCharacter && empty($_POST)) { if ($this->_sortByCharacter == 1) { $this->_formValues['sortByCharacter'] = null; } else { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } require_once 'CRM/Core/BAO/CustomValue.php'; CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues); require_once 'CRM/Contact/BAO/Query.php'; $this->_params =& CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $this->_returnProperties =& $this->returnProperties(); parent::postProcess(); }