Handle non-existed downtime ids with exceptions

refs #8902
This commit is contained in:
Matthias Jentsch 2015-04-27 17:53:17 +02:00
parent 400f351ea5
commit b186ce2cac
4 changed files with 14 additions and 18 deletions

View File

@ -54,6 +54,10 @@ class Monitoring_DowntimeController extends Controller
'service_display_name'
))->where('downtime_internal_id', $downtimeId)->getQuery()->fetchRow();
if (false === $this->downtime) {
throw new Zend_Controller_Action_Exception($this->translate('Downtime not found'));
}
if (isset($this->downtime->service_description)) {
$this->isService = true;
} else {
@ -76,9 +80,6 @@ class Monitoring_DowntimeController extends Controller
public function showAction()
{
if (false === $this->downtime) {
return;
}
$this->view->downtime = $this->downtime;
$this->view->isService = $this->isService;
$this->view->stateName = isset($this->downtime->service_description) ?

View File

@ -58,6 +58,12 @@ class Monitoring_DowntimesController extends Controller
'host_display_name',
'service_display_name'
))->addFilter($this->filter)->getQuery()->fetchAll();
if (false === $this->downtimes) {
throw new Zend_Controller_Action_Exception(
$this->translate('Downtime not found')
);
}
$this->getTabs()
->add(
'downtimes',

View File

@ -1,10 +1,4 @@
<div class="controls">
<?php if (! isset($downtime)): ?>
<?= $this->translate('No scheduled downtime matching the filter.') ?>
</div>
<?php return; ?>
<?php endif; ?>
<?php if (! $this->compact): ?>
<?= $this->tabs; ?>
<?php endif ?>

View File

@ -1,9 +1,4 @@
<div class="controls">
<?php if (! isset($downtimes)): ?>
<?= $this->translate('No scheduled downtimes matching the filter.') ?>
</div>
<?php return; ?>
<?php endif; ?>
<?php if (! $this->compact): ?>
<?= $this->tabs; ?>