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,11 +910,13 @@ class Course_TimesroomsController extends AuthenticatedController
{
$appointment_ids = [];
if (!empty($_SESSION['_checked_dates'])) {
foreach ($_SESSION['_checked_dates'] as $appointment_id) {
if (CourseDate::exists($appointment_id)) {
$appointment_ids[] = $appointment_id;
}
}
}
if (!$appointment_ids) {
PageLayout::postError(_('Es wurden keine gültigen Termin-IDs übergeben!'));
......@@ -951,6 +953,7 @@ class Course_TimesroomsController extends AuthenticatedController
*/
private function unDeleteStack($cycle_id = '')
{
if (!empty($_SESSION['_checked_dates'])) {
foreach ($_SESSION['_checked_dates'] as $id) {
$ex_termin = CourseExDate::find($id);
if ($ex_termin === null) {
......@@ -965,6 +968,7 @@ class Course_TimesroomsController extends AuthenticatedController
));
}
}
}
$this->relocate('course/timesrooms/index', ['contentbox_open' => $cycle_id]);
}
......@@ -1007,12 +1011,14 @@ class Course_TimesroomsController extends AuthenticatedController
$cancel_comment = trim(Request::get('cancel_comment'));
$cancel_send_message = Request::int('cancel_send_message');
if (!empty($_SESSION['_checked_dates'])) {
foreach ($_SESSION['_checked_dates'] as $id) {
$termin = CourseDate::find($id);
if ($termin) {
$deleted_dates[] = $this->deleteDate($termin, $cancel_comment);
}
}
}
if ($cancel_send_message && $cancel_comment != '' && count($deleted_dates) > 0) {
$snd_messages = raumzeit_send_cancel_message($cancel_comment, $deleted_dates);
......@@ -1037,7 +1043,7 @@ class Course_TimesroomsController extends AuthenticatedController
$groups_changed = false;
$singledates = [];
if (is_array($_SESSION['_checked_dates'])) {
if (!empty($_SESSION['_checked_dates'])) {
foreach ($_SESSION['_checked_dates'] as $singledate_id) {
$singledate = CourseDate::find($singledate_id);
if (!isset($singledate)) {
......@@ -1229,12 +1235,14 @@ class Course_TimesroomsController extends AuthenticatedController
}
$appointments = [];
if (!empty($_SESSION['_checked_dates'])) {
foreach ($_SESSION['_checked_dates'] as $appointment_id) {
$appointment = CourseDate::find($appointment_id);
if ($appointment) {
$appointments[] = $appointment;
}
}
}
if (!$appointments) {
PageLayout::postError(_('Es wurden keine gültigen Termine übergeben!'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment