CRM-21128 Personal Campaign Page selection with force=1 in Find Contributions (#8997)
authorAlar <giovanni@gargani.it>
Fri, 1 Sep 2017 01:56:06 +0000 (03:56 +0200)
committerEileen McNaughton <eileen@mcnaughty.com>
Fri, 1 Sep 2017 01:56:06 +0000 (13:56 +1200)
* Personal Campaign can now be passed in force mode

Passing pcpid=n with force=1 alloow to search on corresponding Personal
Campaign id

* Improves parameter passing

Now cope with both single value form (pcpid=n) and multivalue form
(pcpid[]=n&pcpid[]=m)

* Removed useless ++$n

* Fixed checkstyle warnings

* Operator spacing and comment indentation

CRM/Contribute/Form/Search.php

index 8294586006b77f3396c851d4e0251c108d801fc8..b0174523f6bb2f150323d1b28f746136c236f6fe 100644 (file)
@@ -387,6 +387,16 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       $this->_defaults['contribution_status_id'] = array($status => 1);
     }
 
+    $pcpid = (array) CRM_Utils_Request::retrieve('pcpid', 'String', $this);
+    if ($pcpid) {
+      // Add new pcpid to the tail of the array...
+      foreach ($pcpid as $pcpIdList) {
+        $this->_formValues['contribution_pcp_made_through_id'][] = $pcpIdList;
+      }
+      // and avoid any duplicate
+      $this->_formValues['contribution_pcp_made_through_id'] = array_unique($this->_formValues['contribution_pcp_made_through_id']);
+    }
+
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
 
     if ($cid) {