From 4010127bd49473d412b709f1c0ef7606fee82d74 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 15 Mar 2016 16:38:03 +0100 Subject: [PATCH] SyncPropertyForm: clean up filter_expression --- application/forms/SyncPropertyForm.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/application/forms/SyncPropertyForm.php b/application/forms/SyncPropertyForm.php index 8e5f8d43..436f1c64 100644 --- a/application/forms/SyncPropertyForm.php +++ b/application/forms/SyncPropertyForm.php @@ -146,9 +146,12 @@ class SyncPropertyForm extends DirectorObjectForm $this->addElement('text', 'filter_expression', array( 'label' => $this->translate('Filter Expression'), 'description' => $this->translate( - 'This allows to filter for specific parts within the given source expression' + 'This allows to filter for specific parts within the given source expression.' + . ' You are allowed to refer all imported columns. Examples: host=www* would' + . ' set this property only for rows imported with a host property starting' + . ' with "www". Complex example: host=www*&!(address=127.*|address6=::1)' ), - 'required' => false, + 'required' => true, // TODO: validate filter )); } @@ -306,9 +309,14 @@ class SyncPropertyForm extends DirectorObjectForm $this->addHidden('source_expression', '${' . $sourceColumn . '}'); } } + $object = $this->getObject(); $object->rule_id = $this->rule->id; // ?! + if ($this->getValue('use_filter') === 'n') { + $object->filter_expression = null; + } + $destination = $this->getValue('destination_field'); if ($destination === 'vars.*') { $destination = $this->getValue('customvar');