|
|
@ -91,34 +91,37 @@ function Shifts_by_room($room)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$sql = 'SELECT * FROM (
|
|
|
|
$sql = '
|
|
|
|
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
|
|
|
|
SELECT * FROM (
|
|
|
|
FROM `Shifts`
|
|
|
|
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
|
|
|
|
JOIN `Room` USING (`RID`)
|
|
|
|
FROM `Shifts`
|
|
|
|
JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
|
|
|
|
JOIN `Room` USING (`RID`)
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id` = `Shifts`.`SID`
|
|
|
|
JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id` = `Shifts`.`SID`
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
AND `NeededAngelTypes`.`count` > 0
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
|
|
|
|
AND s.shift_id IS NULL
|
|
|
|
AND `NeededAngelTypes`.`count` > 0
|
|
|
|
|
|
|
|
AND s.shift_id IS NULL
|
|
|
|
UNION
|
|
|
|
|
|
|
|
|
|
|
|
UNION
|
|
|
|
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
|
|
|
|
|
|
|
|
FROM `Shifts`
|
|
|
|
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
|
|
|
|
JOIN `Room` USING (`RID`)
|
|
|
|
FROM `Shifts`
|
|
|
|
JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
|
|
|
|
JOIN `Room` USING (`RID`)
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
AND `NeededAngelTypes`.`count` > 0
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
|
|
|
|
AND NOT s.shift_id IS NULL) AS tmp_shifts
|
|
|
|
AND `NeededAngelTypes`.`count` > 0
|
|
|
|
|
|
|
|
AND NOT s.shift_id IS NULL
|
|
|
|
ORDER BY `room_name`, `start`';
|
|
|
|
) AS tmp_shifts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ORDER BY `room_name`, `start`
|
|
|
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
|
|
return DB::select(
|
|
|
|
return DB::select(
|
|
|
|
$sql,
|
|
|
|
$sql,
|
|
|
@ -138,37 +141,38 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$sql = '
|
|
|
|
$sql = '
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
|
|
|
|
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
|
|
|
|
AND s.shift_id IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
FROM `Shifts`
|
|
|
|
FROM `Shifts`
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
AND NOT s.shift_id IS NULL';
|
|
|
|
AND s.shift_id IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
|
|
|
|
AND NOT s.shift_id IS NULL
|
|
|
|
|
|
|
|
';
|
|
|
|
|
|
|
|
|
|
|
|
return DB::select(
|
|
|
|
return DB::select(
|
|
|
|
$sql,
|
|
|
|
$sql,
|
|
|
@ -189,38 +193,38 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
|
|
|
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return DB::selectOne('
|
|
|
|
return DB::selectOne('
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
|
|
|
|
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
|
|
|
|
WHERE `Shifts`.`SID`=?
|
|
|
|
|
|
|
|
AND `AngelTypes`.`id`=?
|
|
|
|
|
|
|
|
AND s.shift_id IS NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UNION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
FROM `Shifts`
|
|
|
|
FROM `Shifts`
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
WHERE `Shifts`.`SID`=?
|
|
|
|
WHERE `Shifts`.`SID`=?
|
|
|
|
AND `AngelTypes`.`id`=?
|
|
|
|
AND `AngelTypes`.`id`=?
|
|
|
|
AND NOT s.shift_id IS NULL
|
|
|
|
AND s.shift_id IS NULL
|
|
|
|
',
|
|
|
|
|
|
|
|
|
|
|
|
UNION
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
|
|
|
|
`AngelTypes`.`id`,
|
|
|
|
|
|
|
|
`AngelTypes`.`name`,
|
|
|
|
|
|
|
|
`AngelTypes`.`restricted`,
|
|
|
|
|
|
|
|
`AngelTypes`.`no_self_signup`
|
|
|
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
|
|
|
|
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
|
|
|
|
|
|
|
WHERE `Shifts`.`SID`=?
|
|
|
|
|
|
|
|
AND `AngelTypes`.`id`=?
|
|
|
|
|
|
|
|
AND NOT s.shift_id IS NULL
|
|
|
|
|
|
|
|
',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
$shift['SID'],
|
|
|
|
$shift['SID'],
|
|
|
|
$angeltype['id'],
|
|
|
|
$angeltype['id'],
|
|
|
@ -237,19 +241,19 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
|
|
|
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$sql = sprintf('
|
|
|
|
$sql = sprintf('
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
users.*,
|
|
|
|
users.*,
|
|
|
|
`ShiftEntry`.`UID`,
|
|
|
|
`ShiftEntry`.`UID`,
|
|
|
|
`ShiftEntry`.`TID`,
|
|
|
|
`ShiftEntry`.`TID`,
|
|
|
|
`ShiftEntry`.`SID`,
|
|
|
|
`ShiftEntry`.`SID`,
|
|
|
|
`ShiftEntry`.`Comment`,
|
|
|
|
`ShiftEntry`.`Comment`,
|
|
|
|
`ShiftEntry`.`freeloaded`
|
|
|
|
`ShiftEntry`.`freeloaded`
|
|
|
|
FROM `Shifts`
|
|
|
|
FROM `Shifts`
|
|
|
|
JOIN `ShiftEntry` ON `ShiftEntry`.`SID`=`Shifts`.`SID`
|
|
|
|
JOIN `ShiftEntry` ON `ShiftEntry`.`SID`=`Shifts`.`SID`
|
|
|
|
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
|
|
|
|
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
|
|
|
|
WHERE `Shifts`.`RID` IN (%s)
|
|
|
|
WHERE `Shifts`.`RID` IN (%s)
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
AND `start` BETWEEN ? AND ?
|
|
|
|
ORDER BY `Shifts`.`start`
|
|
|
|
ORDER BY `Shifts`.`start`
|
|
|
|
',
|
|
|
|
',
|
|
|
|
implode(',', $shiftsFilter->getRooms())
|
|
|
|
implode(',', $shiftsFilter->getRooms())
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -518,16 +522,16 @@ function Shift_update($shift)
|
|
|
|
mail_shift_change(Shift($shift['SID']), $shift);
|
|
|
|
mail_shift_change(Shift($shift['SID']), $shift);
|
|
|
|
|
|
|
|
|
|
|
|
return DB::update('
|
|
|
|
return DB::update('
|
|
|
|
UPDATE `Shifts` SET
|
|
|
|
UPDATE `Shifts` SET
|
|
|
|
`shifttype_id` = ?,
|
|
|
|
`shifttype_id` = ?,
|
|
|
|
`start` = ?,
|
|
|
|
`start` = ?,
|
|
|
|
`end` = ?,
|
|
|
|
`end` = ?,
|
|
|
|
`RID` = ?,
|
|
|
|
`RID` = ?,
|
|
|
|
`title` = ?,
|
|
|
|
`title` = ?,
|
|
|
|
`URL` = ?,
|
|
|
|
`URL` = ?,
|
|
|
|
`edited_by_user_id` = ?,
|
|
|
|
`edited_by_user_id` = ?,
|
|
|
|
`edited_at_timestamp` = ?
|
|
|
|
`edited_at_timestamp` = ?
|
|
|
|
WHERE `SID` = ?
|
|
|
|
WHERE `SID` = ?
|
|
|
|
',
|
|
|
|
',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
$shift['shifttype_id'],
|
|
|
|
$shift['shifttype_id'],
|
|
|
@ -552,18 +556,18 @@ function Shift_update($shift)
|
|
|
|
function Shift_create($shift)
|
|
|
|
function Shift_create($shift)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DB::insert('
|
|
|
|
DB::insert('
|
|
|
|
INSERT INTO `Shifts` (
|
|
|
|
INSERT INTO `Shifts` (
|
|
|
|
`shifttype_id`,
|
|
|
|
`shifttype_id`,
|
|
|
|
`start`,
|
|
|
|
`start`,
|
|
|
|
`end`,
|
|
|
|
`end`,
|
|
|
|
`RID`,
|
|
|
|
`RID`,
|
|
|
|
`title`,
|
|
|
|
`title`,
|
|
|
|
`URL`,
|
|
|
|
`URL`,
|
|
|
|
`created_by_user_id`,
|
|
|
|
`created_by_user_id`,
|
|
|
|
`edited_at_timestamp`,
|
|
|
|
`edited_at_timestamp`,
|
|
|
|
`created_at_timestamp`
|
|
|
|
`created_at_timestamp`
|
|
|
|
)
|
|
|
|
)
|
|
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
|
|
',
|
|
|
|
',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
$shift['shifttype_id'],
|
|
|
|
$shift['shifttype_id'],
|
|
|
@ -591,26 +595,26 @@ function Shift_create($shift)
|
|
|
|
function Shifts_by_user($userId, $include_freeload_comments = false)
|
|
|
|
function Shifts_by_user($userId, $include_freeload_comments = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return DB::select('
|
|
|
|
return DB::select('
|
|
|
|
SELECT
|
|
|
|
SELECT
|
|
|
|
`ShiftTypes`.`id` AS `shifttype_id`,
|
|
|
|
`ShiftTypes`.`id` AS `shifttype_id`,
|
|
|
|
`ShiftTypes`.`name`,
|
|
|
|
`ShiftTypes`.`name`,
|
|
|
|
`ShiftEntry`.`id`,
|
|
|
|
`ShiftEntry`.`id`,
|
|
|
|
`ShiftEntry`.`SID`,
|
|
|
|
`ShiftEntry`.`SID`,
|
|
|
|
`ShiftEntry`.`TID`,
|
|
|
|
`ShiftEntry`.`TID`,
|
|
|
|
`ShiftEntry`.`UID`,
|
|
|
|
`ShiftEntry`.`UID`,
|
|
|
|
`ShiftEntry`.`freeloaded`,
|
|
|
|
`ShiftEntry`.`freeloaded`,
|
|
|
|
`ShiftEntry`.`Comment`,
|
|
|
|
`ShiftEntry`.`Comment`,
|
|
|
|
' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
|
|
|
|
' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
|
|
|
|
`Shifts`.*,
|
|
|
|
`Shifts`.*,
|
|
|
|
@@session.time_zone AS timezone,
|
|
|
|
@@session.time_zone AS timezone,
|
|
|
|
`Room`.*
|
|
|
|
`Room`.*
|
|
|
|
FROM `ShiftEntry`
|
|
|
|
FROM `ShiftEntry`
|
|
|
|
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
|
|
|
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
|
|
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
|
|
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
|
|
|
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
|
|
|
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
|
|
|
WHERE `UID` = ?
|
|
|
|
WHERE `UID` = ?
|
|
|
|
ORDER BY `start`
|
|
|
|
ORDER BY `start`
|
|
|
|
',
|
|
|
|
',
|
|
|
|
[
|
|
|
|
[
|
|
|
|
$userId
|
|
|
|
$userId
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -626,10 +630,10 @@ function Shifts_by_user($userId, $include_freeload_comments = false)
|
|
|
|
function Shift($shift_id)
|
|
|
|
function Shift($shift_id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$result = DB::selectOne('
|
|
|
|
$result = DB::selectOne('
|
|
|
|
SELECT `Shifts`.*, `ShiftTypes`.`name`
|
|
|
|
SELECT `Shifts`.*, `ShiftTypes`.`name`
|
|
|
|
FROM `Shifts`
|
|
|
|
FROM `Shifts`
|
|
|
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
|
|
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
|
|
|
WHERE `SID`=?', [$shift_id]);
|
|
|
|
WHERE `SID`=?', [$shift_id]);
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($result)) {
|
|
|
|
if (empty($result)) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|