manual merge of fixes for CRM-13981
[civicrm-core.git] / CRM / Contribute / Form / Search.php
index 78ba89211414f5c8c00276fdd38fe296c0ecde49..64a36d293bcaa429d4f22b90775f52698653ab1a 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -78,9 +78,9 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form {
    * form values that we will be using
    *
    * @var array
-   * @access protected
+   * @access public
    */
-  protected $_formValues;
+  public $_formValues;
 
   /**
    * the params that are sent to the query
@@ -223,9 +223,8 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form {
   }
 
   function setDefaultValues() {
-    if (!CRM_Utils_Array::value('contribution_status',
-        $this->_defaults
-      )) {
+    if (empty($this->_defaults
+['contribution_status'])) {
       $this->_defaults['contribution_status'][1] = 1;
     }
     return $this->_defaults;
@@ -371,6 +370,15 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form {
     }
 
     $config = CRM_Core_Config::singleton();
+    // CRM-13848
+    $financialType = CRM_Utils_Array::value('financial_type_id', $this->_formValues);
+    if ($financialType && is_array($financialType)) {
+      unset($this->_formValues['financial_type_id']);
+      foreach($financialType as $notImportant => $typeID) {
+        $this->_formValues['financial_type_id'][$typeID] = 1;
+      }
+    }
+
     $tags = CRM_Utils_Array::value('contact_tags', $this->_formValues);
     if ($tags && !is_array($tags)) {
       unset($this->_formValues['contact_tags']);
@@ -380,7 +388,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form {
     if ($tags && is_array($tags)) {
       unset($this->_formValues['contact_tags']);
       foreach($tags as $notImportant => $tagID) {
-          $this->_formValues['contact_tags'][$tagID] = 1;
+        $this->_formValues['contact_tags'][$tagID] = 1;
       }
     }
 
@@ -395,7 +403,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form {
       if ($group && is_array($group)) {
         unset($this->_formValues['group']);
         foreach($group as $notImportant => $groupID) {
-            $this->_formValues['group'][$groupID] = 1;
+          $this->_formValues['group'][$groupID] = 1;
         }
       }