Api: Fix check of disabled attribute was misbehaving if the value was null or 0

This showed up when validating tracker config, some rows were disabled with disabled="@tracker".  When tracker=0, they did not return their value.
This commit is contained in:
nathan 2021-10-28 14:02:13 -06:00 committed by Ralf Becker
parent 9e6bb14725
commit 050bf162d9

View File

@ -643,8 +643,13 @@ class Widget
// use expand_name to be able to use @ or $
$val = self::expand_name($value, $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']);
$check_val = self::expand_name($check, $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']);
$result = count($vals) == 1 ? $val != '' : ($check_val[0] == '/' ? preg_match($check_val,$val) : $val == $check_val);
if ($not) $result = !$result;
$result = count($vals) == 1 ?
boolval($val) :
($check_val[0] == '/' ? preg_match($check_val, $val) : $val == $check_val);
if($not)
{
$result = !$result;
}
//error_log(__METHOD__."('".($not?'!':'')."$disabled' = '$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = ".($result?'True':'False'));
return $result;