fixed CRM-13256
authorkurund <kurund@civicrm.org>
Thu, 22 Aug 2013 11:12:37 +0000 (16:42 +0530)
committerkurund <kurund@civicrm.org>
Thu, 22 Aug 2013 11:12:37 +0000 (16:42 +0530)
----------------------------------------
* 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
templates/CRM/Contact/Form/Search/Custom/FullText.tpl

index 7e39a444a56a45a0a91dda80b16015f380c30caa..ac66a146466f11033d3ea425468656bf9a94146d 100644 (file)
@@ -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
      */
index 943fdf5e2989cfe1fb7b6b91204bf38482012128..01391ca6c577df24c42382e79baa2a44321919ef 100644 (file)
@@ -40,7 +40,7 @@
   </div>
 </div>
 <div class="crm-block crm-content-block">
-{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"}
     {* END Actions/Results section *}
   </div>
 {/if}
-{include file="CRM/common/pager.tpl" location="bottom"}
+{if !$table}{include file="CRM/common/pager.tpl" location="bottom"}{/if}
 </div>