diff options
author | Philip Häusler <msquare@notrademark.de> | 2012-12-26 14:02:27 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2012-12-26 14:02:27 +0100 |
commit | 0dabaa505e4463498665a1eb6ab95979578beab3 (patch) | |
tree | cf2080c39ed5e03f1d27f6d405dc5d0131679c31 /includes/pages/admin_shifts.php | |
parent | 213b6261c8fe6de5e405243f7e2179bdd3a1a271 (diff) |
#28 begin log
Diffstat (limited to 'includes/pages/admin_shifts.php')
-rw-r--r-- | includes/pages/admin_shifts.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php index 303c580c..f35fa312 100644 --- a/includes/pages/admin_shifts.php +++ b/includes/pages/admin_shifts.php @@ -233,11 +233,18 @@ function admin_shifts() { foreach ($_SESSION['admin_shifts_shifts'] as $shift) { sql_query("INSERT INTO `Shifts` SET `start`=" . sql_escape($shift['start']) . ", `end`=" . sql_escape($shift['end']) . ", `RID`=" . sql_escape($shift['RID']) . ", `name`='" . sql_escape($shift['name']) . "'"); $shift_id = sql_id(); + engelsystem_log("Shift created: " . $shift['name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end'])); + $needed_angel_types_info = array(); foreach ($_SESSION['admin_shifts_types'] as $type_id => $count) { - sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`=" . sql_escape($shift_id) . ", `angel_type_id`=" . sql_escape($type_id) . ", `count`=" . sql_escape($count)); + $angel_type_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($type_id) . " LIMIT 1"); + if(count($angel_type_source) > 0) { + sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`=" . sql_escape($shift_id) . ", `angel_type_id`=" . sql_escape($type_id) . ", `count`=" . sql_escape($count)); + $needed_angel_types_info[] = $angel_type_source[0]['name'] . ": " . $count; + } } } + engelsystem_log("Shift needs following angel types: " . join(", ", $needed_angel_types_info)); $msg = success("Schichten angelegt.", true); } else { unset ($_SESSION['admin_shifts_shifts']); |