* @access public
*/
static function where(&$query) {
- $grouping = $testCondition = NULL;
+ $grouping = NULL;
foreach (array_keys($query->_params) as $id) {
if (substr($query->_params[$id][0], 0, 9) == 'activity_') {
if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
$query->_useDistinct = TRUE;
}
- if ($query->_params[$id][0] == 'activity_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);
- }
}
/**
break;
case 'activity_test':
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.is_test", $op, $value, "Boolean");
- if ($value) {
- $query->_qill[$grouping][] = ts('Activity 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_activity.is_test", $op, $value, "Boolean");
+ if ($value) {
+ $query->_qill[$grouping][] = ts('Activity is a Test');
+ }
}
break;
$this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
}
- if (!CRM_Utils_Array::value('activity_test', $this->_formValues)) {
+ // we don't show test activities in Contact Summary / User Dashboard
+ if (empty($this->_formValues['activity_test']) && $this->_single) {
$this->_formValues["activity_test"] = 0;
}
+
if (!CRM_Utils_Array::value('activity_contact_name', $this->_formValues) && !CRM_Utils_Array::value('contact_id', $this->_formValues)) {
$this->_formValues['activity_role'] = NULL;
}
}
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) {
return;
case 'participant_test':
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_participant.is_test",
- $op,
- $value,
- "Boolean"
- );
- if ($value) {
- $query->_qill[$grouping][] = ts("Participant 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_participant.is_test",
+ $op,
+ $value,
+ "Boolean"
+ );
+ if ($value) {
+ $query->_qill[$grouping][] = ts("Participant is a Test");
+ }
+ $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
}
- $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
return;
case 'participant_fee_id':
}
// we don't show test registrations in Contact Summary / User Dashboard
- // in Search mode by default we hide test registrations
- if (!CRM_Utils_Array::value('participant_test',
- $this->_formValues
- )) {
+ if (empty($this->_formValues['participant_test']) && $this->_single) {
$this->_formValues["participant_test"] = 0;
}
}
static function where(&$query) {
- $grouping = $testCondition = 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] == 'member_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) {
return;
case 'member_test':
- $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_membership.is_test", $op, $value, "Boolean");
- if ($value) {
- $query->_qill[$grouping][] = ts('Membership 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_membership.is_test", $op, $value, "Boolean");
+ if ($value) {
+ $query->_qill[$grouping][] = ts('Membership is a Test');
+ }
}
return;
$this->fixFormValues();
// we don't show test memberships in Contact Summary / User Dashboard
- // in Search mode by default we hide test memberships
- if (!CRM_Utils_Array::value('member_test',
- $this->_formValues
- )) {
+ if (empty($this->_formValues['member_test']) && $this->_single) {
$this->_formValues["member_test"] = 0;
}
}
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':
$this->fixFormValues();
- // we don't show test contributions in Contact Summary / User Dashboard
- // in Search mode by default we hide test contributions
- if (!CRM_Utils_Array::value('pledge_test',
- $this->_formValues
- )) {
+ // we don't show test pledges in Contact Summary / User Dashboard
+ if (empty($this->_formValues['pledge_test']) && $this->_single) {
$this->_formValues["pledge_test"] = 0;
}