DirectorObjectForm: add better status codes
This commit is contained in:
parent
16c4bd4da8
commit
59028ebeb4
|
@ -497,7 +497,10 @@ abstract class DirectorObjectForm extends QuickForm
|
||||||
{
|
{
|
||||||
$object = $this->object();
|
$object = $this->object();
|
||||||
if ($object->hasBeenModified()) {
|
if ($object->hasBeenModified()) {
|
||||||
|
|
||||||
if (! $object->hasBeenLoadedFromDb()) {
|
if (! $object->hasBeenLoadedFromDb()) {
|
||||||
|
|
||||||
|
$this->setHttpResponseCode(201);
|
||||||
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
|
if ($object instanceof IcingaObject && $object->hasProperty('object_name')) {
|
||||||
$this->setSuccessUrl(
|
$this->setSuccessUrl(
|
||||||
'director/' . strtolower($this->getObjectName()),
|
'director/' . strtolower($this->getObjectName()),
|
||||||
|
@ -513,8 +516,12 @@ abstract class DirectorObjectForm extends QuickForm
|
||||||
);
|
);
|
||||||
$object->store($this->db);
|
$object->store($this->db);
|
||||||
} else {
|
} else {
|
||||||
|
if ($this->isApiRequest()) {
|
||||||
|
$this->setHttpResponseCode(304);
|
||||||
|
}
|
||||||
$msg = $this->translate('No action taken, object has not been modified');
|
$msg = $this->translate('No action taken, object has not been modified');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redirectOnSuccess($msg);
|
$this->redirectOnSuccess($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue