Skip to content

Commit

Permalink
notqual corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
enricsinergia committed Dec 27, 2024
1 parent 9dc930a commit d4d7759
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 4 deletions.
42 changes: 38 additions & 4 deletions modules/KReports/KReportQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ function getWhereOperatorClause($operator, $fieldname, $fieldid, $path, $value,
// https://github.com/SinergiaTIC/SinergiaCRM/pull/524
// // STIC-Custom EPS 20241205
// // https://github.com/SinergiaTIC/SinergiaCRM/pull/505
// $db = DBManagerFactory::getInstance();
$db = DBManagerFactory::getInstance();
// // ENS STIC-Custom
// ENS STIC-Custom

Expand Down Expand Up @@ -1708,11 +1708,34 @@ function getWhereOperatorClause($operator, $fieldname, $fieldid, $path, $value,
$thisWhereString .= ' SOUNDS LIKE \'' . $value . '\'';
break;
case 'notequal':
// STIC-Custom EPS 20241220 - only quote on some operators
// STIC-Custom EPS 20241220 - not equal not working on multi-enum
// https://github.com/SinergiaTIC/SinergiaCRM/pull/523
// $thisWhereString .= ' <> \'' . $value . '\'';
$value = $db->quote($value);
if ($this->fieldNameMap[$fieldid]['customFunction'] == '' && $this->fieldNameMap[$fieldid]['sqlFunction'] == '') {
switch ($this->fieldNameMap[$fieldid]['type']) {
case 'multienum':
$thisWhereString .= ' NOT LIKE \'%^' . $value . '^%\'';
$thisWhereString .= ' AND ' . $this->get_field_name($path, $fieldname, $fieldid);
$thisWhereString .= ' NOT LIKE \'' . $value . '^%\'';
$thisWhereString .= ' AND ' . $this->get_field_name($path, $fieldname, $fieldid);
$thisWhereString .= ' NOT LIKE \'%^' . $value . '\'';
$thisWhereString .= ' AND ' . $this->get_field_name($path, $fieldname, $fieldid);
$thisWhereString .= ' <> \'' . $value . '\'';
break;
// case 'date':
// case 'datetime':
// $thisWhereString .= ' = \'' . $GLOBALS['timedate']->to_db_date($value, false) . '\'';
// break;
default:
$thisWhereString .= ' <> \'' . $value . '\'';
break;
}
}
else
$thisWhereString .= ' <> \'' . $value . '\'';

// END STIC-Custom
$thisWhereString .= ' <> \'' . $value . '\'';
break;
case 'greater':
// STIC-Custom EPS 20241220 - only quote on some operators
Expand Down Expand Up @@ -1837,8 +1860,19 @@ function getWhereOperatorClause($operator, $fieldname, $fieldid, $path, $value,
foreach ($valueArray as $thisMultiEnumValue) {
if ($multienumWhereString != '')
$multienumWhereString .= ' OR ' . $this->get_field_name($path, $fieldname, $fieldid);
// STIC-Custom EPS 20241220 - oneof on multienum was potentially returning incorrect results
// https://github.com/SinergiaTIC/SinergiaCRM/pull/523
// $multienumWhereString .= ' LIKE \'%' . $thisMultiEnumValue . '%\'';
$multienumWhereString .= ' LIKE \'%^' . $thisMultiEnumValue . '^%\'';
$multienumWhereString .= ' OR ' . $this->get_field_name($path, $fieldname, $fieldid);
$multienumWhereString .= ' LIKE \'' . $thisMultiEnumValue . '^%\'';
$multienumWhereString .= ' OR ' . $this->get_field_name($path, $fieldname, $fieldid);
$multienumWhereString .= ' LIKE \'%^' . $thisMultiEnumValue . '\'';
$multienumWhereString .= ' OR ' . $this->get_field_name($path, $fieldname, $fieldid);
$multienumWhereString .= ' = \'' . $thisMultiEnumValue . '\'';
// END STIC-Custom


$multienumWhereString .= ' LIKE \'%' . $thisMultiEnumValue . '%\'';
}
$thisWhereString .= $multienumWhereString;
}
Expand Down
11 changes: 11 additions & 0 deletions modules/KReports/js/kreportsbase2.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ var bM = function (e, bH) {
case "radioenum":
case "dynamicenum":
case "multienum":
alert('patata');
if (
e.record.data.operator == "starts" ||
e.record.data.operator == "notstarts" ||
Expand All @@ -479,6 +480,11 @@ var bM = function (e, bH) {
case "oneof":
case "oneofnot":
case "oneofnotornull":
// STIC-Custom EPS 20241220 - equals & notequal must show multi-select also
// https://github.com/SinergiaTIC/SinergiaCRM/pull/523
case "equals":
case "notequal":
// END STIC-Custom
e.column.setEditor(
new Ext.form.ComboBox({
typeAhead: false,
Expand Down Expand Up @@ -639,6 +645,11 @@ var aL = function (e) {
case "oneof":
case "oneofnot":
case "oneofnotornull":
// STIC-Custom EPS 20241220 - equals & notequal must show multi-select also
// https://github.com/SinergiaTIC/SinergiaCRM/pull/523
case "equals":
case "notequal":
// END STIC-Custom
var cR = e.column.getEditor().getStore();
var dc = "";
for (var i = 0; i < e.value.length; i++) {
Expand Down

0 comments on commit d4d7759

Please sign in to comment.