diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 7e682b50fe0c2d040ee6ea4f38acadf5a1d40225..1433318102fa22ffa696167b7ae5d49abf7de266 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -82,14 +82,7 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { $this->_done = FALSE; $this->defaults = array(); - // we allow the controller to set force/reset externally, useful when we are being - // driven by the wizard framework - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - - $this->assign("context", $this->_context); + $this->getUrlVariables(); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index 70fd4e6e2e916c36a78433ea875df59079e1328b..4aa68e1272100356d326602fa66a38665d06896d 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -77,12 +77,7 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { $this->_printButtonName = $this->getButtonName('next', 'print'); $this->_actionButtonName = $this->getButtonName('next', 'action'); - //we allow the controller to set force/reset externally, - //useful when we are being driven by the wizard framework - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); + $this->getUrlVariables(); //operation for state machine. $this->_operation = CRM_Utils_Request::retrieve('op', 'String', $this, FALSE, 'reserve'); diff --git a/CRM/Case/Form/Search.php b/CRM/Case/Form/Search.php index 86e3d4031d3e882cea188349504ed52cbcaf652f..810ea11f763d4212a0c850de7bc013dfe0e70b6c 100644 --- a/CRM/Case/Form/Search.php +++ b/CRM/Case/Form/Search.php @@ -89,32 +89,8 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search { $this->_done = FALSE; $this->defaults = array(); - /* - * we allow the controller to set force/reset externally, useful when we are being - * driven by the wizard framework - */ - - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - - $this->assign('context', $this->_context); - - // get user submitted values - // get it from controller only if form has been submitted, else preProcess has set this - if (!empty($_POST) && !$this->controller->isModal()) { - $this->_formValues = $this->controller->exportValues($this->_name); - } - else { - $this->_formValues = $this->get('formValues'); - } - - if (empty($this->_formValues)) { - if (isset($this->_ssID)) { - $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); - } - } + $this->getUrlVariables(); + $this->getFormValues(); if ($this->_force) { $this->postProcess(); diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index d8c2640b54101cf094355dbabd498c58f4e54913..07c9521bdd18f17bb797caa2fbdeed83f8cf814d 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -83,17 +83,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { // @todo - is this an error - $this->_defaults is used. $this->defaults = array(); - /* - * we allow the controller to set force/reset externally, useful when we are being - * driven by the wizard framework - */ - - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - - $this->assign("context", $this->_context); + $this->getUrlVariables(); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 9c1e316acb6ce456c2b9fe9324cb16478e1e45cd..7fbf516ac2e51ef17af68abe1f97b0e98d084d28 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -237,4 +237,37 @@ class CRM_Core_Form_Search extends CRM_Core_Form { } + /** + * we allow the controller to set force/reset externally, useful when we are being + * driven by the wizard framework + */ + protected function getUrlVariables() { + $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); + $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); + $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); + $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); + $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this); + $this->assign("context", $this->_context); + } + + /** + * Get user submitted values. + * + * Get it from controller only if form has been submitted, else preProcess has set this + */ + protected function getFormVariables() { + if (!empty($_POST) && !$this->controller->isModal()) { + $this->_formValues = $this->controller->exportValues($this->_name); + } + else { + $this->_formValues = $this->get('formValues'); + } + + if (empty($this->_formValues)) { + if (isset($this->_ssID)) { + $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); + } + } + } + } diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index c5b73d81403b91c0c16ce1f346299d3050eadf97..04291cf1467aece75adb124e98075703a84589e2 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -90,31 +90,8 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { $this->_done = FALSE; $this->defaults = array(); - /* - * we allow the controller to set force/reset externally, useful when we are being - * driven by the wizard framework - */ - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - $this->_ssID = CRM_Utils_Request::retrieve('ssID', 'Positive', $this); - $this->assign("context", $this->_context); - - // get user submitted values - // get it from controller only if form has been submitted, else preProcess has set this - if (!empty($_POST) && !$this->controller->isModal()) { - $this->_formValues = $this->controller->exportValues($this->_name); - } - else { - $this->_formValues = $this->get('formValues'); - } - - if (empty($this->_formValues)) { - if (isset($this->_ssID)) { - $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); - } - } + $this->getUrlVariables(); + $this->getFormValues(); if ($this->_force) { $this->postProcess(); diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 12e6ea09a1f86b6a2aac3b015f7bce291fd9c6c4..4d833d9708c15dcf07f47a7b7888100fba0257ec 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -29,16 +29,10 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2018 - * $Id$ - * */ /** - * Files required - */ - -/** - * This file is for civigrant search + * This file is for CiviGrant search */ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { @@ -57,9 +51,9 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { protected $_single = FALSE; /** - * Are we restricting ourselves to a single contact. + * Return limit. * - * @var boolean + * @var int */ protected $_limit = NULL; @@ -68,6 +62,8 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { */ protected $_prefix = "grant_"; + protected $entity = 'grant'; + /** * Processing needed for buildForm and later. * @@ -83,32 +79,8 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { $this->_done = FALSE; $this->defaults = array(); - /* - * we allow the controller to set force/reset externally, useful when we are being - * driven by the wizard framework - */ - - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - - $this->assign("context", $this->_context); - - // 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); - } - else { - $this->_formValues = $this->get('formValues'); - } - - if (empty($this->_formValues)) { - if (isset($this->_ssID)) { - $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID); - } - } + $this->getUrlVariables(); + $this->getFormVariables(); if ($this->_force) { $this->postProcess(); @@ -154,9 +126,6 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { /** * Build the form object. - * - * - * @return void */ public function buildQuickForm() { parent::buildQuickForm(); diff --git a/CRM/Member/Form/Search.php b/CRM/Member/Form/Search.php index 8d26304f3b9e6482d1b8d6635355f6e3d7ab6256..764c19de1b339b033195207498d87e2de88ef422 100644 --- a/CRM/Member/Form/Search.php +++ b/CRM/Member/Form/Search.php @@ -84,17 +84,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { $this->defaults = array(); - /* - * we allow the controller to set force/reset externally, useful when we are being - * driven by the wizard framework - */ - - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - - $this->assign("context", $this->_context); + $this->getUrlVariables(); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this diff --git a/CRM/Pledge/Form/Search.php b/CRM/Pledge/Form/Search.php index 50558aca71d1ea8da8bc44a3950626851f0a4624..81b536fc35b1f131922c8e24ab0a0c0d29147357 100644 --- a/CRM/Pledge/Form/Search.php +++ b/CRM/Pledge/Form/Search.php @@ -73,15 +73,7 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { $this->_done = FALSE; $this->defaults = array(); - // we allow the controller to set force/reset externally, useful when we are being - // driven by the wizard framework - - $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); - $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); - $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); - $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this, FALSE, 'search'); - - $this->assign("context", $this->_context); + $this->getUrlVariables(); // get user submitted values // get it from controller only if form has been submitted, else preProcess has set this