From: Coleman Watts Date: Thu, 27 Jun 2013 17:42:53 +0000 (-0700) Subject: CRM-12638 only rebuild alpha pager when needed X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e166ff79ba67538eca2ef6d32bafb7e078850299;hp=9fd71915bb225615622c100e3238e9de4965a558;p=civicrm-core.git CRM-12638 only rebuild alpha pager when needed ---------------------------------------- * CRM-12638: Optimize Prev/Next Cache and search interaction http://issues.civicrm.org/jira/browse/CRM-12638 --- diff --git a/CRM/Contact/Form/Search.php b/CRM/Contact/Form/Search.php index 01b48d2aa5..0245ec42d9 100644 --- a/CRM/Contact/Form/Search.php +++ b/CRM/Contact/Form/Search.php @@ -924,15 +924,11 @@ class CRM_Contact_Form_Search extends CRM_Core_Form { $selector->setKey($this->controller->_key); // added the sorting character to the form array - // lets recompute the aToZ bar without the sortByCharacter - // we need this in most cases except when just pager or sort values change, which - // we'll ignore for now $config = CRM_Core_Config::singleton(); // do this only for contact search if ($setDynamic && $config->includeAlphabeticalPager) { - if ($this->_reset || - ($this->_sortByCharacter === NULL || $this->_sortByCharacter == '') - ) { + // Don't recompute if we are just paging/sorting + if ($this->_reset || (empty($_GET['crmPID']) && empty($_GET['crmSID']) && !$this->_sortByCharacter)) { $aToZBar = CRM_Utils_PagerAToZ::getAToZBar($selector, $this->_sortByCharacter); $this->set('AToZBar', $aToZBar); } diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index ea792c36c4..0bfea752bc 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -301,9 +301,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { // 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 ($this->_sortByCharacter !== NULL && empty($_POST)) { if (strtolower($this->_sortByCharacter) == 'all') { $this->_formValues['sortByCharacter'] = NULL; } @@ -311,6 +309,9 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } + else { + $this->_sortByCharacter = NULL; + } CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues); diff --git a/CRM/Contact/Form/Search/Basic.php b/CRM/Contact/Form/Search/Basic.php index 88d3bae453..e18eea976e 100644 --- a/CRM/Contact/Form/Search/Basic.php +++ b/CRM/Contact/Form/Search/Basic.php @@ -193,9 +193,7 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { // 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 ($this->_sortByCharacter !== NULL && empty($_POST)) { if (strtolower($this->_sortByCharacter) == 'all') { $this->_formValues['sortByCharacter'] = NULL; } @@ -203,6 +201,9 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } + else { + $this->_sortByCharacter = NULL; + } $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues); $this->_returnProperties = &$this->returnProperties(); diff --git a/CRM/Contact/Form/Search/Builder.php b/CRM/Contact/Form/Search/Builder.php index b6e6bdd353..8ff693a1f0 100644 --- a/CRM/Contact/Form/Search/Builder.php +++ b/CRM/Contact/Form/Search/Builder.php @@ -377,6 +377,9 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search { $this->_formValues['sortByCharacter'] = $this->_sortByCharacter; } } + else { + $this->_sortByCharacter = NULL; + } $this->_params = &$this->convertFormValues($this->_formValues); $this->_returnProperties = &$this->returnProperties();