Merge pull request #2777 from Icinga/bugfix/defaults-when-acknowledging-problems-2776
AcknowledgeProblemCommandForm: respect configuration when creating elements
This commit is contained in:
commit
c11601d458
|
@ -43,6 +43,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
|
|||
{
|
||||
$config = Config::module('monitoring');
|
||||
|
||||
$acknowledgeExpire = (bool) $config->get('settings', 'acknowledge_expire', false);
|
||||
|
||||
$this->addElements(array(
|
||||
array(
|
||||
'textarea',
|
||||
|
@ -74,7 +76,7 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
|
|||
'expire',
|
||||
array(
|
||||
'label' => $this->translate('Use Expire Time'),
|
||||
'value' => (bool) $config->get('settings', 'acknowledge_expire', false),
|
||||
'value' => $acknowledgeExpire,
|
||||
'description' => $this->translate(
|
||||
'If the acknowledgement should expire, check this option.'
|
||||
),
|
||||
|
@ -82,7 +84,8 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
|
|||
)
|
||||
)
|
||||
));
|
||||
if (isset($formData['expire']) && (bool) $formData['expire'] === true) {
|
||||
$expire = isset($formData['expire']) ? $formData['expire'] : $acknowledgeExpire;
|
||||
if ($expire) {
|
||||
$expireTime = new DateTime();
|
||||
$expireTime->add(new DateInterval('PT1H'));
|
||||
$this->addElement(
|
||||
|
|
Loading…
Reference in New Issue