mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 09:14:09 +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,
|
'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;
|
$error = false;
|
||||||
try {
|
try {
|
||||||
$mods = $this->enumModifiers();
|
$mods = $this->enumModifiers();
|
||||||
|
@ -9,6 +9,8 @@ abstract class PropertyModifierHook
|
|||||||
{
|
{
|
||||||
protected $settings = array();
|
protected $settings = array();
|
||||||
|
|
||||||
|
private $targetProperty;
|
||||||
|
|
||||||
private $db;
|
private $db;
|
||||||
|
|
||||||
public function getName()
|
public function getName()
|
||||||
@ -26,9 +28,20 @@ abstract class PropertyModifierHook
|
|||||||
return $class;
|
return $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTargetProperty($property)
|
||||||
|
{
|
||||||
|
$this->targetProperty = $property;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasTargetProperty()
|
||||||
|
{
|
||||||
|
return $this->targetProperty !== null;
|
||||||
|
}
|
||||||
|
|
||||||
public function getTargetProperty()
|
public function getTargetProperty()
|
||||||
{
|
{
|
||||||
return null;
|
return $this->targetProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDb(Db $db)
|
public function setDb(Db $db)
|
||||||
|
@ -13,11 +13,12 @@ class ImportRowModifier extends DbObjectWithSettings
|
|||||||
protected $autoincKeyName = 'id';
|
protected $autoincKeyName = 'id';
|
||||||
|
|
||||||
protected $defaultProperties = array(
|
protected $defaultProperties = array(
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'source_id' => null,
|
'source_id' => null,
|
||||||
'property_name' => null,
|
'property_name' => null,
|
||||||
'provider_class' => null,
|
'provider_class' => null,
|
||||||
'priority' => null,
|
'target_property' => null,
|
||||||
|
'priority' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $settingsTable = 'import_row_modifier_setting';
|
protected $settingsTable = 'import_row_modifier_setting';
|
||||||
@ -31,6 +32,7 @@ class ImportRowModifier extends DbObjectWithSettings
|
|||||||
if ($this->hookInstance === null) {
|
if ($this->hookInstance === null) {
|
||||||
$obj = new $this->provider_class;
|
$obj = new $this->provider_class;
|
||||||
$obj->setSettings($this->getSettings());
|
$obj->setSettings($this->getSettings());
|
||||||
|
$obj->setTargetProperty($this->target_property);
|
||||||
$obj->setDb($this->connection);
|
$obj->setDb($this->connection);
|
||||||
$this->hookInstance = $obj;
|
$this->hookInstance = $obj;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user