From: monishdeb Date: Tue, 24 Nov 2015 07:33:03 +0000 (+0530) Subject: CRM-16203 conflict fix in master X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f4fd60824eaffdef96b7ddea93ce8b48d340b9ef;p=civicrm-core.git CRM-16203 conflict fix in master ---------------------------------------- * CRM-16203: https://issues.civicrm.org/jira/browse/CRM-16203 --- diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 1bd2b024f6..d8adc66607 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -1792,33 +1792,13 @@ class CRM_Report_Form extends CRM_Core_Form { break; case 'mhas': - // mhas == multiple has - if ($value !== NULL && count($value) > 0) { - $sqlOP = $this->getSQLOperator($op); - foreach ($value as $key => $val) { - $val = str_replace('(', '[[.left-parenthesis.]]', $val); - $val = str_replace(')', '[[.right-parenthesis.]]', $val); - $value[$key] = $val; - } - $sp = CRM_Core_DAO::VALUE_SEPARATOR; - $clause - = "{$field['dbAlias']} REGEXP '$sp" . implode("$sp|$sp", $value) . "$sp'"; - } - break; - case 'mnot': // multiple has or multiple not if ($value !== NULL && count($value) > 0) { - $sqlOP = $this->getSQLOperator($op); - foreach ($value as $key => $val) { - $val = str_replace('(', '[[.left-parenthesis.]]', $val); - $val = str_replace(')', '[[.right-parenthesis.]]', $val); - $value[$key] = $val; - } - $sp = CRM_Core_DAO::VALUE_SEPARATOR; - $clause - = "( {$field['dbAlias']} NOT REGEXP '$sp" . implode("$sp|$sp", $value) . - "$sp' OR {$field['dbAlias']} IS NULL )"; + $value = CRM_Utils_Type::escapeAll($value, $type); + $operator = $op == 'mnot' ? 'NOT' : ''; + $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', (array) $value) . "[[:cntrl:]]*"; + $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'"; } break;