From 804beb78d22830ffdfb702bff0637f5b0cfb15f6 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 17 Jan 2020 13:34:44 +1300 Subject: [PATCH] [REF] Remove apparent copy & paste code. In code familiarisation to tackle dev#core/1217 I looked at this var & concluded that the var is set in 9 places but in 8 of those it is never used. In the last place (CRM_Contact_Form_Search) it is used to determine whether to build the pre-next cache. I swapped it over to just doing a getButton without any change - I stepped through in advanced search, search builder, custom search, basic search it still enters the cache lines of code. In Contribution, event search it doesn't (before & after). Part of just makingg code semi-readable --- CRM/Activity/Form/Search.php | 1 - CRM/Campaign/Form/Search.php | 1 - CRM/Case/Form/Search.php | 1 - CRM/Contact/Form/Search.php | 3 +-- CRM/Contribute/Form/Search.php | 1 - CRM/Core/Form/Search.php | 7 ------- CRM/Event/Form/Search.php | 1 - CRM/Grant/Form/Search.php | 1 - CRM/Member/Form/Search.php | 1 - CRM/Pledge/Form/Search.php | 1 - 10 files changed, 1 insertion(+), 17 deletions(-) diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 57a35aef82..06dab35143 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -71,7 +71,6 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { $this->set('searchFormName', 'Search'); // set the button names - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index 0ec2990d54..ca86ffd86b 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -58,7 +58,6 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { $this->_defaults = array(); //set the button name. - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_printButtonName = $this->getButtonName('next', 'print'); $this->_actionButtonName = $this->getButtonName('next', 'action'); diff --git a/CRM/Case/Form/Search.php b/CRM/Case/Form/Search.php index e682068121..8d971a851f 100644 --- a/CRM/Case/Form/Search.php +++ b/CRM/Case/Form/Search.php @@ -75,7 +75,6 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search { /** * set the button names */ - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; diff --git a/CRM/Contact/Form/Search.php b/CRM/Contact/Form/Search.php index eca29eb4d4..8277133483 100644 --- a/CRM/Contact/Form/Search.php +++ b/CRM/Contact/Form/Search.php @@ -530,7 +530,6 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search { /** * set the button names */ - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->assign('actionButtonName', $this->_actionButtonName); @@ -793,7 +792,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search { return; } else { - if (array_key_exists($this->_searchButtonName, $_POST) || + if (array_key_exists($this->getButtonName('refresh'), $_POST) || ($this->_force && !$crmPID) ) { //reset the cache table for new search diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 3f780e8323..6ad2e48cd7 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -63,7 +63,6 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { public function preProcess() { $this->set('searchFormName', 'Search'); - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 4dc1b95db3..66cebe8282 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -21,13 +21,6 @@ class CRM_Core_Form_Search extends CRM_Core_Form { */ protected $_force; - /** - * Name of search button - * - * @var string - */ - protected $_searchButtonName; - /** * Name of action button * diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index 704d40b3f4..77c5f938f4 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -84,7 +84,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { /** * set the button names */ - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 4c54877d07..1ea774db22 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -72,7 +72,6 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { /** * set the button names */ - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; diff --git a/CRM/Member/Form/Search.php b/CRM/Member/Form/Search.php index 0b8774e903..1d9234f543 100644 --- a/CRM/Member/Form/Search.php +++ b/CRM/Member/Form/Search.php @@ -65,7 +65,6 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { public function preProcess() { $this->set('searchFormName', 'Search'); - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; diff --git a/CRM/Pledge/Form/Search.php b/CRM/Pledge/Form/Search.php index 92158a070c..7f7e75c529 100644 --- a/CRM/Pledge/Form/Search.php +++ b/CRM/Pledge/Form/Search.php @@ -59,7 +59,6 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { */ public function preProcess() { - $this->_searchButtonName = $this->getButtonName('refresh'); $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; -- 2.25.1