From 33ecaaa52bc812707379cdf30e31b6ca474969a6 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Sun, 20 Oct 2013 15:55:08 +0200 Subject: [PATCH] Monitoring/Schedule Downtime: Fix form always creating type flexible --- .../application/forms/Command/ScheduleDowntimeForm.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php index d690091db..d878fa932 100644 --- a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php +++ b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php @@ -102,16 +102,14 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm $options = array( '0' => 'No Triggered Downtime' ); + $dateFormat = $this->getView()->dateFormat(); foreach ($downtimes as $downtime) { - $dt = DateTimeFactory::create($downtime->downtime_scheduled_start_time); - $date_format = $preferences->get('app.dateFormat', $cfg->get('app.dateFormat', 'd/m/Y')); - $time_format = $preferences->get('app.timeFormat', $cfg->get('app.timeFormat', 'g:i A')); $label = sprintf( 'ID %s: %s%s Starting @ %s', $downtime->downtime_internal_downtime_id, $downtime->host_name, !empty($downtime->service_description) ? ' (' . $downtime->service_description . ')' : '', - $dt->format($date_format . ' ' . $time_format) + $dateFormat->formatDateTime($downtime->downtime_scheduled_start_time) ); $options[$downtime->downtime_internal_downtime_id] = $label; } @@ -170,6 +168,7 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm ); $now = DateTimeFactory::create(); + $this->addElement( new DateTimePicker( array( @@ -338,10 +337,11 @@ class ScheduleDowntimeForm extends WithChildrenCommandForm $this->getRequest()->getUser()->getUsername(), $this->getValue('comment') ), - $this->getValue('type') === self::TYPE_FLEXIBLE, + $this->getValue('type') === self::TYPE_FIXED, $this->getValue('hours') * 3600 + $this->getValue('minutes') * 60, $this->getValue('triggered') ); + return $command->includeChildren( $this->getWithChildren(), $this->getValue('childobjects') === 1