From: Jon goldberg - Linux laptop Date: Sat, 16 Aug 2014 20:24:01 +0000 (-0400) Subject: CRM-14584 - Core Advanced Search - fix incorrect boolean logic on privacy preferences... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e10c798305202698e784295e6b6f2535f5514bc6;p=civicrm-core.git CRM-14584 - Core Advanced Search - fix incorrect boolean logic on privacy preferences when privacy toggle = 'exclude' --- diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 0c7df5514f..a636a96041 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -3943,24 +3943,24 @@ WHERE id IN ( $groupIDs ) } $toggleValues = $this->getWhereValues('privacy_toggle', $grouping); - $compareOP = '!='; + $compareOP = '!'; if ($toggleValues && $toggleValues[2] == 2 ) { - $compareOP = '='; + $compareOP = ''; } $clauses = array(); $qill = array(); foreach ($value as $dontCare => $pOption) { - $clauses[] = " ( contact_a.{$pOption} $compareOP 1 ) "; + $clauses[] = " ( contact_a.{$pOption} = 1 ) "; $field = CRM_Utils_Array::value($pOption, $this->_fields); $title = $field ? $field['title'] : $pOption; - $qill[] = " $title $compareOP 1 "; + $qill[] = " $title = 1 "; } - $this->_where[$grouping][] = '( ' . implode($operator, $clauses) . ' )'; - $this->_qill[$grouping][] = implode($operator, $qill); + $this->_where[$grouping][] = $compareOP . '( ' . implode($operator, $clauses) . ' )'; + $this->_qill[$grouping][] = $compareOP . '( ' . implode($operator, $qill) . ' )'; } /**