SyncPropertyForm: allow to define a filter

This commit is contained in:
Thomas Gelf 2016-02-28 16:23:51 +01:00
parent e6723d3ee8
commit 7f949e1b5a

View File

@ -122,25 +122,36 @@ class SyncPropertyForm extends DirectorObjectForm
} }
*/ */
/*
TODO: Filter should be a modifier // TODO: we need modifier
$this->addElement('select', 'use_filter', array( $this->addElement('select', 'use_filter', array(
'label' => $this->translate('Filter values'), 'label' => $this->translate('Set based on filter'),
'description' => $this->translate('Whether you want to merge or replace the destination field. Makes no difference for strings'), 'ignore' => true,
'class' => 'autosubmit',
'required' => true, 'required' => true,
'multiOptions' => $this->optionalEnum(array( 'multiOptions' => $this->enumBoolean()
'y' => 'merge',
'n' => 'replace'
))
)); ));
$this->addElement('text', 'filter_expression', array( if ($this->hasBeenSent()) {
'label' => $this->translate('Filter Expression'), $useFilter = $this->getSentValue('use_filter');
'description' => $this->translate('This allows to filter for specific parts within the given source expression'), if ($useFilter === null) {
'required' => false, $this->setElementValue('use_filter', $useFilter = 'n');
// TODO: validate filter }
)); } else {
*/ $useFilter = empty($this->getObject()->filter_expression) ? 'n' : 'y';
$this->setElementValue('use_filter', $useFilter);
}
if ($useFilter === 'y') {
$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'
),
'required' => false,
// TODO: validate filter
));
}
if ($isCustomvar || $destination === 'vars') { if ($isCustomvar || $destination === 'vars') {
$this->addElement('select', 'merge_policy', array( $this->addElement('select', 'merge_policy', array(