DirectorObjectForm: hardcode ignored arguments

These would otherwise cause issues in redirections after deleting
object fields or arguments
This commit is contained in:
Thomas Gelf 2015-11-17 18:26:43 +01:00
parent 1fe59db0f2
commit 66f76ef8c5
1 changed files with 9 additions and 4 deletions

View File

@ -533,18 +533,19 @@ abstract class DirectorObjectForm extends QuickForm
$object->object_type = $this->objectType; $object->object_type = $this->objectType;
} }
$this->handleImports($object, $values); $this->handleImports($object, $values);
$this->handleProperties($object, $values);
$this->handleCustomVars($object, $post); $this->handleCustomVars($object, $post);
$this->handleGroups($object, $values); $this->handleGroups($object, $values);
$this->handleRanges($object, $values); $this->handleRanges($object, $values);
} else {
$this->handleProperties($object, $values);
} }
$this->handleProperties($object, $values);
} }
protected function deleteObject($object) protected function deleteObject($object)
{ {
$key = $object->getKeyName(); $key = $object->getKeyName();
if ($object instanceof IcingaObject) { if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
$msg = sprintf( $msg = sprintf(
'%s "%s" has been removed', '%s "%s" has been removed',
$this->translate($this->getObjectName()), $this->translate($this->getObjectName()),
@ -559,8 +560,12 @@ abstract class DirectorObjectForm extends QuickForm
if ($object->delete()) { if ($object->delete()) {
// fields? $this->setSuccessUrl($this->getSuccessUrl()->without($key)); // fields? $this->setSuccessUrl($this->getSuccessUrl()->without($key));
if ($object instanceof IcingaObject) { if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
$this->setSuccessUrl('director/' . $object->getShortTableName() . 's'); $this->setSuccessUrl('director/' . $object->getShortTableName() . 's');
} else {
$this->setSuccessUrl($this->getSuccessUrl()->without(
array('field_id', 'argument_id')
));
} }
} }
// TODO: show object name and so // TODO: show object name and so