mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-01 04:13:28 +01:00
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:
parent
9e6bb14725
commit
050bf162d9
@ -634,17 +634,22 @@ class Widget
|
|||||||
*/
|
*/
|
||||||
protected static function check_disabled($disabled, array $expand)
|
protected static function check_disabled($disabled, array $expand)
|
||||||
{
|
{
|
||||||
if (($not = $disabled[0] == '!'))
|
if(($not = $disabled[0] == '!'))
|
||||||
{
|
{
|
||||||
$disabled = substr($disabled,1);
|
$disabled = substr($disabled, 1);
|
||||||
}
|
}
|
||||||
list($value,$check) = $vals = explode('=',$disabled);
|
list($value, $check) = $vals = explode('=', $disabled);
|
||||||
|
|
||||||
// use expand_name to be able to use @ or $
|
// use expand_name to be able to use @ or $
|
||||||
$val = self::expand_name($value, $expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']);
|
$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']);
|
$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);
|
$result = count($vals) == 1 ?
|
||||||
if ($not) $result = !$result;
|
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'));
|
//error_log(__METHOD__."('".($not?'!':'')."$disabled' = '$val' ".(count($vals) == 1 ? '' : ($not?'!':'=')."= '$check_val'")." = ".($result?'True':'False'));
|
||||||
return $result;
|
return $result;
|
||||||
|
Loading…
Reference in New Issue
Block a user