Skip to content
Snippets Groups Projects
Commit 1467a6b5 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

ensure that start is always before end, fixes #651

Merge request studip/studip!737
parent dfc79dc1
No related branches found
No related tags found
No related merge requests found
...@@ -153,9 +153,16 @@ class Consultation_AdminController extends ConsultationController ...@@ -153,9 +153,16 @@ class Consultation_AdminController extends ConsultationController
CSRFProtection::verifyUnsafeRequest(); CSRFProtection::verifyUnsafeRequest();
try { 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( $slot_count = ConsultationBlock::countBlocks(
$this->getDateAndTime('start'), $start,
$this->getDateAndTime('end'), $end,
Request::int('day-of-week'), Request::int('day-of-week'),
Request::int('interval'), Request::int('interval'),
Request::int('duration'), Request::int('duration'),
...@@ -169,8 +176,8 @@ class Consultation_AdminController extends ConsultationController ...@@ -169,8 +176,8 @@ class Consultation_AdminController extends ConsultationController
$blocks = ConsultationBlock::generateBlocks( $blocks = ConsultationBlock::generateBlocks(
$this->range, $this->range,
$this->getDateAndTime('start'), $start,
$this->getDateAndTime('end'), $end,
Request::int('day-of-week'), Request::int('day-of-week'),
Request::int('interval') Request::int('interval')
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment