DirectorObjectForm: handle ordering before setup

This commit is contained in:
Thomas Gelf 2016-03-22 01:34:21 +01:00
parent 970d2aa435
commit 712dc6c9b7

View File

@ -711,24 +711,13 @@ abstract class DirectorObjectForm extends QuickForm
list($set[$key + 1], $set[$key]) = array($set[$key], $set[$key + 1]); list($set[$key + 1], $set[$key]) = array($set[$key], $set[$key + 1]);
} }
protected function onRequest() protected function beforeSetup()
{ {
$values = array(); if (!$this->hasBeenSent()) {
return;
$object = $this->object();
if ($this->hasBeenSent()) {
if ($this->shouldBeDeleted()) {
$this->deleteObject($object);
} }
$post = $this->getRequest()->getPost(); $post = $values = $this->getRequest()->getPost();
foreach ($post as $key => $value) {
$el = $this->getElement($key);
if ($el && ! $el->getIgnore()) {
$values[$key] = $value;
}
}
foreach ($post as $key => $value) { foreach ($post as $key => $value) {
@ -750,6 +739,26 @@ abstract class DirectorObjectForm extends QuickForm
} }
} }
} }
protected function onRequest()
{
$values = array();
$object = $this->object();
if ($this->hasBeenSent()) {
if ($this->shouldBeDeleted()) {
$this->deleteObject($object);
}
$post = $this->getRequest()->getPost();
foreach ($post as $key => $value) {
$el = $this->getElement($key);
if ($el && ! $el->getIgnore()) {
$values[$key] = $value;
}
}
}
if ($object instanceof IcingaObject) { if ($object instanceof IcingaObject) {
$this->handleProperties($object, $values); $this->handleProperties($object, $values);
$this->handleCustomVars($object, $post); $this->handleCustomVars($object, $post);