diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php index 5377a464b6f9e6e0347b7a982cff7788e7210d46..31d1fca8cfbe784b96a51c09a7a63194d253e91b 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') @@ -167,8 +174,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') );