Skip to content
Snippets Groups Projects
Commit cecadc73 authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

prevent php-warning in timesrooms, fixes #4614

Closes #4614

Merge request studip/studip!3427
parent 8a254a5d
No related branches found
No related tags found
No related merge requests found
...@@ -910,9 +910,11 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -910,9 +910,11 @@ class Course_TimesroomsController extends AuthenticatedController
{ {
$appointment_ids = []; $appointment_ids = [];
foreach ($_SESSION['_checked_dates'] as $appointment_id) { if (!empty($_SESSION['_checked_dates'])) {
if (CourseDate::exists($appointment_id)) { foreach ($_SESSION['_checked_dates'] as $appointment_id) {
$appointment_ids[] = $appointment_id; if (CourseDate::exists($appointment_id)) {
$appointment_ids[] = $appointment_id;
}
} }
} }
...@@ -951,18 +953,20 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -951,18 +953,20 @@ class Course_TimesroomsController extends AuthenticatedController
*/ */
private function unDeleteStack($cycle_id = '') private function unDeleteStack($cycle_id = '')
{ {
foreach ($_SESSION['_checked_dates'] as $id) { if (!empty($_SESSION['_checked_dates'])) {
$ex_termin = CourseExDate::find($id); foreach ($_SESSION['_checked_dates'] as $id) {
if ($ex_termin === null) { $ex_termin = CourseExDate::find($id);
continue; if ($ex_termin === null) {
} continue;
$ex_termin->content = ''; }
$termin = $ex_termin->unCancelDate(); $ex_termin->content = '';
if ($termin !== null) { $termin = $ex_termin->unCancelDate();
PageLayout::postSuccess(sprintf( if ($termin !== null) {
_('Der Termin %s wurde wiederhergestellt!'), PageLayout::postSuccess(sprintf(
htmlReady($termin->getFullName()) _('Der Termin %s wurde wiederhergestellt!'),
)); htmlReady($termin->getFullName())
));
}
} }
} }
...@@ -1007,10 +1011,12 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1007,10 +1011,12 @@ class Course_TimesroomsController extends AuthenticatedController
$cancel_comment = trim(Request::get('cancel_comment')); $cancel_comment = trim(Request::get('cancel_comment'));
$cancel_send_message = Request::int('cancel_send_message'); $cancel_send_message = Request::int('cancel_send_message');
foreach ($_SESSION['_checked_dates'] as $id) { if (!empty($_SESSION['_checked_dates'])) {
$termin = CourseDate::find($id); foreach ($_SESSION['_checked_dates'] as $id) {
if ($termin) { $termin = CourseDate::find($id);
$deleted_dates[] = $this->deleteDate($termin, $cancel_comment); if ($termin) {
$deleted_dates[] = $this->deleteDate($termin, $cancel_comment);
}
} }
} }
...@@ -1037,7 +1043,7 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1037,7 +1043,7 @@ class Course_TimesroomsController extends AuthenticatedController
$groups_changed = false; $groups_changed = false;
$singledates = []; $singledates = [];
if (is_array($_SESSION['_checked_dates'])) { if (!empty($_SESSION['_checked_dates'])) {
foreach ($_SESSION['_checked_dates'] as $singledate_id) { foreach ($_SESSION['_checked_dates'] as $singledate_id) {
$singledate = CourseDate::find($singledate_id); $singledate = CourseDate::find($singledate_id);
if (!isset($singledate)) { if (!isset($singledate)) {
...@@ -1229,10 +1235,12 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1229,10 +1235,12 @@ class Course_TimesroomsController extends AuthenticatedController
} }
$appointments = []; $appointments = [];
foreach ($_SESSION['_checked_dates'] as $appointment_id) { if (!empty($_SESSION['_checked_dates'])) {
$appointment = CourseDate::find($appointment_id); foreach ($_SESSION['_checked_dates'] as $appointment_id) {
if ($appointment) { $appointment = CourseDate::find($appointment_id);
$appointments[] = $appointment; if ($appointment) {
$appointments[] = $appointment;
}
} }
} }
......
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