+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
/**
- * The params that are sent to the query
+ * The params that are sent to the query.
*
* @var array
*/
protected $_queryParams;
/**
- * Are we restricting ourselves to a single contact
+ * Are we restricting ourselves to a single contact.
*
* @var boolean
*/
protected $_single = FALSE;
/**
- * Are we restricting ourselves to a single contact
+ * Are we restricting ourselves to a single contact.
*
* @var boolean
*/
protected $_defaults;
/**
- * Prefix for the controller
+ * Prefix for the controller.
*/
protected $_prefix = "contribute_";
/**
- * Processing needed for buildForm and later
+ * Processing needed for buildForm and later.
*
* @return void
*/
- function preProcess() {
+ public function preProcess() {
$this->set('searchFormName', 'Search');
/**
}
/**
- * Build the form object
+ * Build the form object.
*
*
* @return void
foreach (array(
'contribution_amount_low',
- 'contribution_amount_high'
+ 'contribution_amount_high',
) as $f) {
if (isset($this->_formValues[$f])) {
$this->_formValues[$f] = CRM_Utils_Rule::cleanMoney($this->_formValues[$f]);
$config = CRM_Core_Config::singleton();
if (!empty($_POST)) {
- foreach (array('financial_type_id', 'contribution_soft_credit_type_id', 'contribution_status') as $element) {
- $value = CRM_Utils_Array::value($element, $this->_formValues);
- if ($value && is_array($value)) {
- $this->_formValues[$element] = array('IN' => $value);
- }
- }
-
- foreach (array('contribution_source', 'contribution_trxn_id') as $element) {
+ $specialParams = array(
+ 'financial_type_id',
+ 'contribution_soft_credit_type_id',
+ 'contribution_status_id',
+ 'contribution_source',
+ 'contribution_trxn_id',
+ 'contribution_page_id',
+ 'contribution_product_id',
+ );
+ foreach ($specialParams as $element) {
$value = CRM_Utils_Array::value($element, $this->_formValues);
if ($value) {
- $this->_formValues[$element] = array('LIKE' => "%$value%");
+ if (is_array($value)) {
+ $this->_formValues[$element] = array('IN' => $value);
+ }
+ else {
+ $this->_formValues[$element] = array('LIKE' => "%$value%");
+ }
}
}
public function getTitle() {
return ts('Find Contributions');
}
+
}