From 1289101f6e4b729018dba64e92b4c9397db67f2d Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 20 Dec 2017 00:42:58 +0100 Subject: rewrite controller for creating shift entries --- includes/model/ShiftEntry_model.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'includes/model/ShiftEntry_model.php') diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index 4ff5675d..38db5959 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -74,8 +74,10 @@ function ShiftEntries_by_shift($shift_id) */ function ShiftEntry_create($shift_entry) { - mail_shift_assign(User($shift_entry['UID']), Shift($shift_entry['SID'])); - return DB::insert(' + $user = User($shift_entry['UID']); + $shift = Shift($shift_entry['SID']); + mail_shift_assign($user, $shift); + $result = DB::insert(' INSERT INTO `ShiftEntry` ( `SID`, `TID`, @@ -95,6 +97,13 @@ function ShiftEntry_create($shift_entry) (int)$shift_entry['freeloaded'], ] ); + engelsystem_log( + 'User ' . User_Nick_render($user) + . ' signed up for shift ' . $shift['name'] + . ' from ' . date('Y-m-d H:i', $shift['start']) + . ' to ' . date('Y-m-d H:i', $shift['end']) + ); + return $result; } /** -- cgit v1.2.3-54-g00ecf