DataFilter: json_en/decode when passing to form

This commit is contained in:
Thomas Gelf 2016-10-23 03:14:52 +00:00
parent 9d8cc13dca
commit 24478ede12
2 changed files with 7 additions and 3 deletions

View File

@ -154,7 +154,9 @@ class Zend_View_Helper_FormDataFilter extends Zend_View_Helper_FormElement
if ($filter) {
// TODO: Make this configurable
$type = 'host';
$filter = clone($filter);
$filter->setExpression(json_decode($filter->getExpression()));
$dummy = IcingaObject::createByType($type);
$col = $filter->getColumn();
if ($dummy->hasProperty($col)) {

View File

@ -231,7 +231,7 @@ class DataFilter extends FormElement
return Filter::expression(
$entry['column'],
'=',
true
json_encode(true)
);
} elseif ($entry['sign'] === 'in') {
if (array_key_exists('value', $entry)) {
@ -248,13 +248,15 @@ class DataFilter extends FormElement
return Filter::expression(
$entry['column'],
'=',
$value
json_encode($value)
);
} else {
$value = array_key_exists('value', $entry) ? $entry['value'] : null;
return Filter::expression(
$entry['column'],
$entry['sign'],
array_key_exists('value', $entry) ? $entry['value'] : null
json_encode($value)
);
}
}