From 66f76ef8c5ca88f7329b44a401ec900925b2167d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 17 Nov 2015 18:26:43 +0100 Subject: [PATCH] DirectorObjectForm: hardcode ignored arguments These would otherwise cause issues in redirections after deleting object fields or arguments --- library/Director/Web/Form/DirectorObjectForm.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php index 8e79993b..0b06f5ce 100644 --- a/library/Director/Web/Form/DirectorObjectForm.php +++ b/library/Director/Web/Form/DirectorObjectForm.php @@ -533,18 +533,19 @@ abstract class DirectorObjectForm extends QuickForm $object->object_type = $this->objectType; } $this->handleImports($object, $values); + $this->handleProperties($object, $values); $this->handleCustomVars($object, $post); $this->handleGroups($object, $values); $this->handleRanges($object, $values); + } else { + $this->handleProperties($object, $values); } - - $this->handleProperties($object, $values); } protected function deleteObject($object) { $key = $object->getKeyName(); - if ($object instanceof IcingaObject) { + if ($object instanceof IcingaObject && $object->hasProperty('object_name')) { $msg = sprintf( '%s "%s" has been removed', $this->translate($this->getObjectName()), @@ -559,8 +560,12 @@ abstract class DirectorObjectForm extends QuickForm if ($object->delete()) { // 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'); + } else { + $this->setSuccessUrl($this->getSuccessUrl()->without( + array('field_id', 'argument_id') + )); } } // TODO: show object name and so