mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 16:54:06 +02:00
ImportRowModifier: provide target_property...
...also adjust the related form refs #11949
This commit is contained in:
parent
38bf19eb92
commit
d90bb05ca2
@ -25,6 +25,16 @@ class ImportRowModifierForm extends DirectorObjectForm
|
||||
'required' => true,
|
||||
));
|
||||
|
||||
$this->addElement('text', 'target_property', array(
|
||||
'label' => $this->translate('Target property'),
|
||||
'description' => $this->translate(
|
||||
'You might want to write the modified value to another (new) property.'
|
||||
. ' This property name can be defined here, the original property would'
|
||||
. ' remain unmodified. Please leave this blank in case you just want to'
|
||||
. ' modify the value of a specific property'
|
||||
),
|
||||
));
|
||||
|
||||
$error = false;
|
||||
try {
|
||||
$mods = $this->enumModifiers();
|
||||
|
@ -9,6 +9,8 @@ abstract class PropertyModifierHook
|
||||
{
|
||||
protected $settings = array();
|
||||
|
||||
private $targetProperty;
|
||||
|
||||
private $db;
|
||||
|
||||
public function getName()
|
||||
@ -26,9 +28,20 @@ abstract class PropertyModifierHook
|
||||
return $class;
|
||||
}
|
||||
|
||||
public function setTargetProperty($property)
|
||||
{
|
||||
$this->targetProperty = $property;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function hasTargetProperty()
|
||||
{
|
||||
return $this->targetProperty !== null;
|
||||
}
|
||||
|
||||
public function getTargetProperty()
|
||||
{
|
||||
return null;
|
||||
return $this->targetProperty;
|
||||
}
|
||||
|
||||
public function setDb(Db $db)
|
||||
|
@ -17,6 +17,7 @@ class ImportRowModifier extends DbObjectWithSettings
|
||||
'source_id' => null,
|
||||
'property_name' => null,
|
||||
'provider_class' => null,
|
||||
'target_property' => null,
|
||||
'priority' => null,
|
||||
);
|
||||
|
||||
@ -31,6 +32,7 @@ class ImportRowModifier extends DbObjectWithSettings
|
||||
if ($this->hookInstance === null) {
|
||||
$obj = new $this->provider_class;
|
||||
$obj->setSettings($this->getSettings());
|
||||
$obj->setTargetProperty($this->target_property);
|
||||
$obj->setDb($this->connection);
|
||||
$this->hookInstance = $obj;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user