diff options
author | leaneb <lea-e@bluewin.ch> | 2016-11-26 11:39:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-26 11:39:47 +0100 |
commit | e1cc80ec411d63a4a309fa76a53776c80c10e6f7 (patch) | |
tree | 01753d802435861ebd7c0624bb7050cf24e8c24d /includes/model | |
parent | 67df8da061f74322863354490409666eb87935b0 (diff) | |
parent | 561e8ec36c50b2ace9fe7352dfb4e11f57d0e82e (diff) |
Merge pull request #2 from engelsystem/master
Merge Changes from esys Master to own Repo
Diffstat (limited to 'includes/model')
-rw-r--r-- | includes/model/ShiftEntry_model.php | 1 | ||||
-rw-r--r-- | includes/model/Shifts_model.php | 7 | ||||
-rw-r--r-- | includes/model/User_model.php | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index 99f67028..dca7e1c1 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -115,6 +115,7 @@ function ShiftEntries_finished_by_user($user) { JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id` WHERE `ShiftEntry`.`UID`=" . sql_escape($user['UID']) . " AND `Shifts`.`end` < " . sql_escape(time()) . " + AND `ShiftEntry`.`freeloaded` = 0 ORDER BY `Shifts`.`end` "); } diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index 2db0a3d3..b1d4ca5e 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -261,9 +261,12 @@ function Shift_create($shift) { /** * Return users shifts. */ -function Shifts_by_user($user) { +function Shifts_by_user($user, $include_freeload_comments = false) { $result = sql_select(" - SELECT `ShiftTypes`.`id` as `shifttype_id`, `ShiftTypes`.`name`, `ShiftEntry`.*, `Shifts`.*, `Room`.* + SELECT `ShiftTypes`.`id` as `shifttype_id`, `ShiftTypes`.`name`, + `ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`, + " . ($include_freeload_comments ? "`ShiftEntry`.`freeload_comment`, " : "") . " + `Shifts`.*, `Room`.* FROM `ShiftEntry` JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`) JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`) diff --git a/includes/model/User_model.php b/includes/model/User_model.php index 344a3886..3ebd3bf9 100644 --- a/includes/model/User_model.php +++ b/includes/model/User_model.php @@ -284,7 +284,7 @@ function User($user_id) { function User_by_api_key($api_key) { $user = sql_select("SELECT * FROM `User` WHERE `api_key`='" . sql_escape($api_key) . "' LIMIT 1"); if ($user === false) { - return false; + engelsystem_error("Unable to find user by api key."); } if (count($user) == 0) { return null; |