From: Alar Date: Fri, 1 Sep 2017 01:56:06 +0000 (+0200) Subject: CRM-21128 Personal Campaign Page selection with force=1 in Find Contributions (#8997) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=29d72d92dcb5edbcaa4b8a4e5343577e67c79de7;p=civicrm-core.git CRM-21128 Personal Campaign Page selection with force=1 in Find Contributions (#8997) * 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 --- diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 8294586006..b0174523f6 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -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) {