Skip to content

Commit

Permalink
Null for decimals patched
Browse files Browse the repository at this point in the history
  • Loading branch information
enricsinergia committed Dec 29, 2023
1 parent 05a6ec9 commit 293ad45
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions modules/AOW_WorkFlow/AOW_WorkFlow.php
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ public function check_valid_bean(SugarBean $bean)
break;
}

if (!($this->compare_condition($field, $value, $condition->operator))) {
if (!($this->compare_condition($field, $value, $condition->operator, $type))) {
return false;
}
}
Expand Down Expand Up @@ -950,8 +950,16 @@ public function check_valid_bean(SugarBean $bean)
return true;
}

public function compare_condition($var1, $var2, $operator = 'Equal_To')
// STIC Custom 20231228 EPS - numeric null condition does not work properly
// STIC#1363
// public function compare_condition($var1, $var2, $operator = 'Equal_To')
// {
public function compare_condition($var1, $var2, $operator = 'Equal_To', $type= '')
{

$numericTypes = array('double','decimal','currency','float','uint','ulong','long','short','tinyint','int');
// STIC Custom End

switch ($operator) {
case "Not_Equal_To": return $var1 != $var2;
case "Greater_Than": return $var1 > $var2;
Expand All @@ -961,7 +969,15 @@ public function compare_condition($var1, $var2, $operator = 'Equal_To')
case "Contains": return strpos(strtolower($var1), strtolower($var2)) !== false;
case "Starts_With": return substr(strtolower($var1), 0, strlen($var2) ) === strtolower($var2);
case "Ends_With": return substr(strtolower($var1), -strlen($var2) ) === strtolower($var2);
case "is_null": return $var1 == '';
// STIC Custom 20231228 EPS - numeric null condition does not work properly
// STIC#1363
// case "is_null": return $var1 == '';
case "is_null":
if (in_array($type, $numericTypes) && $var1 == 'NULL') {
$var1 = "";
}
return $var1 == '';
// STIC Custom End
case "One_of":
if (is_array($var1)) {
foreach ($var1 as $var) {
Expand Down

0 comments on commit 293ad45

Please sign in to comment.