diff options
| author | Moritz Strohm <strohm@data-quest.de> | 2022-11-15 13:30:54 +0000 |
|---|---|---|
| committer | David Siegfried <david.siegfried@uni-vechta.de> | 2022-11-15 13:30:54 +0000 |
| commit | 0f1aa02c94f477c4a565d18a788b7a892a385dc6 (patch) | |
| tree | 97a345ffbd7edd61ba2ffe8bfbe9d82fb99ed4d6 /app/controllers/resources/export.php | |
| parent | 05cf41b84ab6f664db4f1ee7f27c675ea6235776 (diff) | |
TIC 1311, closes #1311
Closes #1311
Merge request studip/studip!807
Diffstat (limited to 'app/controllers/resources/export.php')
| -rw-r--r-- | app/controllers/resources/export.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/resources/export.php b/app/controllers/resources/export.php index 6c43009..f0d5905 100644 --- a/app/controllers/resources/export.php +++ b/app/controllers/resources/export.php @@ -67,6 +67,7 @@ class Resources_ExportController extends AuthenticatedController PageLayout::setTitle(_('Quellen für den Export von Buchungen auswählen')); + $this->weekdays = ['1', '2', '3', '4', '5']; $this->select_rooms = Request::get('select_rooms'); if ($this->select_rooms) { @@ -265,12 +266,21 @@ class Resources_ExportController extends AuthenticatedController 'H:i' ); + //Get the selected weekdays: + $this->weekdays = Request::getArray('weekdays'); + if ($this->begin >= $this->end) { PageLayout::postError( _('Der Startzeitpunkt darf nicht hinter dem Endzeitpunkt liegen!') ); return; } + if (!$this->weekdays) { + PageLayout::postError( + _('Bitte mindestens einen Wochentag auswählen.') + ); + return; + } //Resolve the IDs to clipboards (or rooms) and build a list of rooms. @@ -342,6 +352,13 @@ class Resources_ExportController extends AuthenticatedController //Prepare data for export: foreach ($intervals as $interval) { + //Check the weekday of the interval first to avoid any other computation + //if the weekday is not one of the selected weekdays. + $interval_weekday = date('N', $interval->begin); + if (!in_array($interval_weekday, $this->weekdays)) { + //The interval is not on one of the selected weekdays. + continue; + } $booking = $interval->booking; if (!$booking instanceof ResourceBooking || !in_array($booking->booking_type, $types)) { continue; |
