summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-25 14:27:47 +0100
committermsquare <msquare@notrademark.de>2016-11-25 14:27:47 +0100
commit34248bb20cb3102fbcff76fcd7e059c12d87a6c3 (patch)
tree147a3402c1fc11802a67d4d12a1203b034089729
parent476d1daeb76306faf3ecd70f2afc8e29e98b9553 (diff)
show freeload comments to supporters (user shift admin)
-rw-r--r--includes/controller/users_controller.php2
-rw-r--r--includes/model/Shifts_model.php3
2 files changed, 3 insertions, 2 deletions
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index 33abe764..26ca8d00 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -151,7 +151,7 @@ function user_controller() {
}
}
- $shifts = Shifts_by_user($user_source);
+ $shifts = Shifts_by_user($user_source, in_array("user_shifts_admin", $privileges));
foreach ($shifts as &$shift) {
// TODO: Move queries to model
$shift['needed_angeltypes'] = sql_select("SELECT DISTINCT `AngelTypes`.* FROM `ShiftEntry` JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id` WHERE `ShiftEntry`.`SID`='" . sql_escape($shift['SID']) . "' ORDER BY `AngelTypes`.`name`");
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 67580eee..b1d4ca5e 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -261,10 +261,11 @@ 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`.`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`)