diff options
author | Jan-Philipp Litza <janphilipp@litza.de> | 2012-12-30 12:51:29 +0100 |
---|---|---|
committer | Jan-Philipp Litza <janphilipp@litza.de> | 2012-12-30 12:51:29 +0100 |
commit | d509a101213673cc55bcf846ab757eac6899d373 (patch) | |
tree | 1cde8281a8902db48f7863d71193544fab2bfb78 /includes/pages | |
parent | 0dae68a9a3370fb517009f4d5aa31094851ff188 (diff) |
Prevent from signing up for colliding shifts servier-side
Diffstat (limited to 'includes/pages')
-rw-r--r-- | includes/pages/user_shifts.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 235208b9..7fb8ebe6 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -204,6 +204,12 @@ function user_shifts() { header("Location: " . page_link_to('user_shifts')); } + // Another shift the user is signed up for collides with this one + if(!in_array('user_shifts_admin', $privileges) && sql_num_query("SELECT `Shifts`.`SID` FROM `Shifts` INNER JOIN `ShiftEntry` ON (`Shifts`.`SID` = `ShiftEntry`.`SID` AND `ShiftEntry`.`UID` = " . sql_escape($user['UID']) . ") WHERE `start` < '" . sql_escape($shift['end']) . "' AND `end` > '" . sql_escape($shift['start']) . "'") > 0) { + error("Du bist bereits in einer parallelen Schicht eingetragen. Bitte kontaktiere den Schichtkoordinator, um dich eintragen zu lassen."); + header("Location: " . page_link_to('user_shifts')); + } + if (in_array('user_shifts_admin', $privileges)) $type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1"); else |