summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-26 23:48:16 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-26 23:48:16 +0100
commit8d6175a273516b60c1c0e0b33367d33fc64109b3 (patch)
tree6f6223c61270164fda6dd803e14c28b5ccc4046e /includes/pages
parentaf25ca9103debdb392395e82473db318a5eeab2c (diff)
user cannot signup for full shifts
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/user_shifts.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index f4e2de67..81bc5f54 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -253,6 +253,18 @@ function user_shifts() {
redirect(shift_link($shift));
}
+ $needed_angeltypes = NeededAngelTypes_by_shift($shift['SID']);
+ if ($needed_angeltypes === false)
+ engelsystem_error('Unable to load needed angel types.');
+
+ // you canot join if shift is full
+ foreach ($needed_angeltypes as $needed_angeltype)
+ if ($needed_angeltype['angel_type_id'] == $type_id)
+ if ($needed_angeltype['taken'] >= $needed_angeltype['count']) {
+ error(_("The shift is already full."));
+ redirect(shift_link($shift));
+ }
+
if (in_array('user_shifts_admin', $privileges))
$type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1");
else