break;
case 'nll':
+ if ($type == 'String') {
+ $sqlOP = $this->getSQLOperator($op);
+ $clause = "( {$field['dbAlias']} $sqlOP OR {$field['dbAlias']} = '' )";
+ }
+ else {
+ $sqlOP = $this->getSQLOperator($op);
+ $clause = "( {$field['dbAlias']} $sqlOP )";
+ }
+ break;
+
case 'nnll':
- $sqlOP = $this->getSQLOperator($op);
- $clause = "( {$field['dbAlias']} $sqlOP )";
+ if ($type == 'String') {
+ $sqlOP = $this->getSQLOperator($op);
+ $clause = "( {$field['dbAlias']} $sqlOP AND {$field['dbAlias']} <> '' )";
+ }
+ else {
+ $sqlOP = $this->getSQLOperator($op);
+ $clause = "( {$field['dbAlias']} $sqlOP )";
+ }
break;
case 'eq':
}
}
$yesNoFields = [
- 'do_not_email', 'is_deceased', 'do_not_phone', 'do_not_sms', 'do_not_mail', 'is_opt_out',
+ 'do_not_email', 'is_deceased', 'do_not_phone', 'do_not_sms', 'do_not_mail', 'do_not_trade', 'is_opt_out',
];
foreach ($yesNoFields as $fieldName) {
if (array_key_exists('civicrm_contact_' . $fieldName, $row)) {
'do_not_phone' => [],
'do_not_mail' => [],
'do_not_sms' => [],
+ 'do_not_trade' => [],
'is_opt_out' => [],
'is_deceased' => [],
'preferred_language' => [],
'title' => ts('Do not SMS'),
'type' => CRM_Utils_Type::T_BOOLEAN,
],
+ 'do_not_trade' => [
+ 'title' => ts('Do not Trade'),
+ 'type' => CRM_Utils_Type::T_BOOLEAN,
+ ],
'is_opt_out' => [
'title' => ts('Do not bulk email'),
'type' => CRM_Utils_Type::T_BOOLEAN,
$select = preg_replace('/SELECT(\s+SQL_CALC_FOUND_ROWS)?\s+/i', $select, $this->_select);
$sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy}";
$sql = str_replace('WITH ROLLUP', '', $sql);
+ if (!$this->optimisedForOnlyFullGroupBy) {
+ CRM_Core_DAO::disableFullGroupByMode();
+ }
$dao = CRM_Core_DAO::executeQuery($sql);
+ CRM_Core_DAO::reenableFullGroupByMode();
$contact_ids = [];
// Add resulting contacts to group
'is_group_bys' => FALSE,
];
}
- foreach (['do_not_email', 'do_not_phone', 'do_not_mail', 'do_not_sms', 'is_opt_out'] as $field) {
+ foreach (['do_not_email', 'do_not_phone', 'do_not_mail', 'do_not_sms', 'do_not_trade', 'is_opt_out'] as $field) {
$spec[$options['prefix'] . $field] = [
'name' => $field,
'type' => CRM_Utils_Type::T_BOOLEAN,