From 82de5f3597346c50a782964ce8f244bf3ad91cc7 Mon Sep 17 00:00:00 2001 From: kurund Date: Thu, 22 Aug 2013 16:42:37 +0530 Subject: [PATCH] fixed CRM-13256 ---------------------------------------- * CRM-13256: Full Text search Go to Page navigation is broken http://issues.civicrm.org/jira/browse/CRM-13256 --- CRM/Contact/Form/Search/Custom/FullText.php | 26 ++++++++++++++----- .../Contact/Form/Search/Custom/FullText.tpl | 4 +-- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/Form/Search/Custom/FullText.php b/CRM/Contact/Form/Search/Custom/FullText.php index 7e39a444a5..ac66a14646 100644 --- a/CRM/Contact/Form/Search/Custom/FullText.php +++ b/CRM/Contact/Form/Search/Custom/FullText.php @@ -64,8 +64,6 @@ class CRM_Contact_Form_Search_Custom_FullText implements CRM_Contact_Form_Search protected $_foundRows = array(); function __construct(&$formValues) { - $this->_formValues = $formValues; - $this->_text = CRM_Utils_Array::value('text', $formValues); $this->_table = CRM_Utils_Array::value('table', $formValues); @@ -119,6 +117,8 @@ class CRM_Contact_Form_Search_Custom_FullText implements CRM_Contact_Form_Search $this->_limitRowClause = " LIMIT $rowCount"; $this->_limitDetailClause = " LIMIT $offset, $rowCount"; } + + $this->_formValues = $formValues; } function __destruct() { @@ -732,17 +732,29 @@ WHERE (c.sort_name LIKE {$this->_text} OR c.display_name LIKE {$this->_text $tables['Membership'] = ts('Memberships'); } - $form->add('select', - 'table', - ts('Tables'), - $tables - ); + $form->add('select', 'table', ts('Tables'), $tables ); $form->assign('csID', $form->get('csid')); // also add the limit constant $form->assign('limit', self::LIMIT); + // set form defaults + if (!empty($form->_formValues)) { + $defaults = array(); + + if (isset($form->_formValues['text'])) { + $defaults['text'] = $form->_formValues['text']; + } + + if (isset($form->_formValues['table'])) { + $defaults['table'] = $form->_formValues['table']; + $form->assign('table', $form->_formValues['table']); + } + + $form->setDefaults($defaults); + } + /** * You can define a custom title for the search form */ diff --git a/templates/CRM/Contact/Form/Search/Custom/FullText.tpl b/templates/CRM/Contact/Form/Search/Custom/FullText.tpl index 943fdf5e29..01391ca6c5 100644 --- a/templates/CRM/Contact/Form/Search/Custom/FullText.tpl +++ b/templates/CRM/Contact/Form/Search/Custom/FullText.tpl @@ -40,7 +40,7 @@
-{include file="CRM/common/pager.tpl" location="top"} +{if !$table}{include file="CRM/common/pager.tpl" location="top"}{/if} {include file="CRM/common/jsortable.tpl"} {if $rowsEmpty} {include file="CRM/Contact/Form/Search/Custom/EmptyResults.tpl"} @@ -372,5 +372,5 @@ {* END Actions/Results section *}
{/if} -{include file="CRM/common/pager.tpl" location="bottom"} +{if !$table}{include file="CRM/common/pager.tpl" location="bottom"}{/if} -- 2.25.1