CRM-15438 - Fix search component_mode selections
authorColeman Watts <coleman@civicrm.org>
Wed, 15 Oct 2014 18:29:09 +0000 (14:29 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 15 Oct 2014 18:29:09 +0000 (14:29 -0400)
CRM/Contact/Form/Search.php

index 7a0083b2f1209c69cbcea8df672b2b5b475c3de5..2f422efb05e8ed96f840595d77570b7291387234 100644 (file)
@@ -337,7 +337,6 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
    */
   function buildQuickForm() {
     parent::buildQuickForm();
-    $this->addClass('crm-ajax-selection-form');
     CRM_Core_Resources::singleton()
       // jsTree is needed for tags popup
       ->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE)
@@ -459,7 +458,11 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
       $this->addTaskMenu($tasks);
     }
 
-    if ($qfKeyParam = CRM_Utils_Array::value('qfKey', $this->_formValues)) {
+    $selectedContactIds = array();
+    $qfKeyParam = CRM_Utils_Array::value('qfKey', $this->_formValues);
+    // We use ajax to handle selections only if the search results component_mode is set to "contacts"
+    if ($qfKeyParam && $this->get('component_mode') <= 1) {
+      $this->addClass('crm-ajax-selection-form');
       $qfKeyParam = "civicrm search {$qfKeyParam}";
       $selectedContactIdsArr = CRM_Core_BAO_PrevNextCache::getSelection($qfKeyParam);
       $selectedContactIds = array_keys($selectedContactIdsArr[$qfKeyParam]);