diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php index 2c48d1894029210878ef2c53ee85c46ac1379456..eca774c4d203a15bdcf82a5311c451fad692c199 100644 --- a/app/controllers/consultation/admin.php +++ b/app/controllers/consultation/admin.php @@ -153,9 +153,16 @@ class Consultation_AdminController extends ConsultationController CSRFProtection::verifyUnsafeRequest(); try { + $start = $this->getDateAndTime('start'); + $end = $this->getDateAndTime('end'); + + if (date('Hi', $end) <= date('Hi', $start)) { + throw new InvalidArgumentException(_('Die Endzeit liegt vor der Startzeit!')); + } + $slot_count = ConsultationBlock::countBlocks( - $this->getDateAndTime('start'), - $this->getDateAndTime('end'), + $start, + $end, Request::int('day-of-week'), Request::int('interval'), Request::int('duration'), @@ -169,8 +176,8 @@ class Consultation_AdminController extends ConsultationController $blocks = ConsultationBlock::generateBlocks( $this->range, - $this->getDateAndTime('start'), - $this->getDateAndTime('end'), + $start, + $end, Request::int('day-of-week'), Request::int('interval') );