/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
}
static function where(&$query) {
- $testCondition = $grouping = NULL;
+ $grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (!CRM_Utils_Array::value(0, $query->_params[$id])) {
continue;
if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
$query->_useDistinct = TRUE;
}
- if ($query->_params[$id][0] == 'participant_test') {
- $testCondition = $id;
- continue;
- }
$grouping = $query->_params[$id][3];
self::whereClauseSingle($query->_params[$id], $query);
}
}
- // Only add test condition if other fields are selected
- if ($grouping !== NULL && $testCondition &&
- // we dont want to include all tests for sql OR CRM-7827
- $query->getOperator() != 'OR'
- ) {
- self::whereClauseSingle($query->_params[$testCondition], $query);
- }
}
static function whereClauseSingle(&$values, &$query) {
case 'pledge_test':
case 'pledge_is_test':
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_pledge.is_test',
- $op,
- $value,
- 'Boolean'
- );
- if ($value) {
- $query->_qill[$grouping][] = ts('Pledge is a Test');
+ // We dont want to include all tests for sql OR CRM-7827
+ if (!$value || $query->getOperator() != 'OR') {
+ $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_pledge.is_test',
+ $op,
+ $value,
+ 'Boolean'
+ );
+ if ($value) {
+ $query->_qill[$grouping][] = ts('Pledge is a Test');
+ }
+ $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
}
- $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
return;
case 'pledge_financial_type_id':