mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 07:44:05 +02:00
parent
13e217c725
commit
50315d8714
@ -125,6 +125,9 @@ class ImportsourceController extends ActionController
|
|||||||
$this->addTitle('Clone: %s', $source->get('source_name'));
|
$this->addTitle('Clone: %s', $source->get('source_name'));
|
||||||
$form = new CloneImportSourceForm($source);
|
$form = new CloneImportSourceForm($source);
|
||||||
$this->content()->add($form);
|
$this->content()->add($form);
|
||||||
|
$form->on(CloneImportSourceForm::ON_SUCCESS, function (CloneImportSourceForm $form) {
|
||||||
|
$this->getResponse()->redirectAndExit($form->getSuccessUrl());
|
||||||
|
});
|
||||||
$form->handleRequest($this->getServerRequest());
|
$form->handleRequest($this->getServerRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,11 +115,11 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
|
|||||||
|
|
||||||
public function setModifiers(array $modifiers)
|
public function setModifiers(array $modifiers)
|
||||||
{
|
{
|
||||||
if ($this->loadedRowModifiers === null) {
|
if ($this->loadedRowModifiers === null && $this->hasBeenLoadedFromDb()) {
|
||||||
$this->loadedRowModifiers = $this->fetchRowModifiers();
|
$this->loadedRowModifiers = $this->fetchRowModifiers();
|
||||||
}
|
}
|
||||||
$current = $this->loadedRowModifiers;
|
$current = $this->loadedRowModifiers;
|
||||||
if (count($current) !== count($modifiers)) {
|
if ($current !== null && count($current) !== count($modifiers)) {
|
||||||
$this->newRowModifiers = $modifiers;
|
$this->newRowModifiers = $modifiers;
|
||||||
} else {
|
} else {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -394,7 +394,6 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
|
|||||||
public function fetchRowModifiers()
|
public function fetchRowModifiers()
|
||||||
{
|
{
|
||||||
$db = $this->getDb();
|
$db = $this->getDb();
|
||||||
|
|
||||||
$modifiers = ImportRowModifier::loadAll(
|
$modifiers = ImportRowModifier::loadAll(
|
||||||
$this->getConnection(),
|
$this->getConnection(),
|
||||||
$db->select()
|
$db->select()
|
||||||
@ -403,7 +402,11 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
|
|||||||
->order('priority ASC')
|
->order('priority ASC')
|
||||||
);
|
);
|
||||||
|
|
||||||
return $modifiers;
|
if ($modifiers) {
|
||||||
|
return $modifiers;
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function fetchFlatRowModifiers()
|
protected function fetchFlatRowModifiers()
|
||||||
|
@ -52,13 +52,11 @@ class CloneImportSourceForm extends Form
|
|||||||
$newName = $this->getElement('source_name')->getValue();
|
$newName = $this->getElement('source_name')->getValue();
|
||||||
$export->source_name = $newName;
|
$export->source_name = $newName;
|
||||||
unset($export->originalId);
|
unset($export->originalId);
|
||||||
|
|
||||||
if (ImportSource::existsWithName($newName, $this->source->getConnection())) {
|
if (ImportSource::existsWithName($newName, $this->source->getConnection())) {
|
||||||
$this->getElement('source_name')->addMessage('Name already exists');
|
$this->getElement('source_name')->addMessage('Name already exists');
|
||||||
}
|
}
|
||||||
$this->newSource = ImportSource::import($export, $this->getTargetDb());
|
$this->newSource = ImportSource::import($export, $this->getTargetDb());
|
||||||
$this->newSource->store();
|
$this->newSource->store();
|
||||||
$this->redirectOnSuccess();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSuccessUrl()
|
public function getSuccessUrl()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user