|
|
|
@ -24,15 +24,15 @@ function Shifts_by_room($room)
|
|
|
|
|
function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
{
|
|
|
|
|
//@TODO
|
|
|
|
|
$sql = "SELECT * FROM (
|
|
|
|
|
$sql = 'SELECT * FROM (
|
|
|
|
|
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
JOIN `Room` USING (`RID`)
|
|
|
|
|
JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
|
|
|
|
|
WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ")
|
|
|
|
|
AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime() . "
|
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (" . implode(',', $shiftsFilter->getTypes()) . ")
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
AND `start` BETWEEN ' . $shiftsFilter->getStartTime() . ' AND ' . $shiftsFilter->getEndTime() . '
|
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
|
|
|
|
|
AND `NeededAngelTypes`.`count` > 0
|
|
|
|
|
AND `Shifts`.`PSID` IS NULL
|
|
|
|
|
|
|
|
|
@ -43,13 +43,13 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
JOIN `Room` USING (`RID`)
|
|
|
|
|
JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
|
WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ")
|
|
|
|
|
AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime() . "
|
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (" . implode(',', $shiftsFilter->getTypes()) . ")
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
AND `start` BETWEEN ' . $shiftsFilter->getStartTime() . ' AND ' . $shiftsFilter->getEndTime() . '
|
|
|
|
|
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
|
|
|
|
|
AND `NeededAngelTypes`.`count` > 0
|
|
|
|
|
AND NOT `Shifts`.`PSID` IS NULL) AS tmp_shifts
|
|
|
|
|
|
|
|
|
|
ORDER BY `start`";
|
|
|
|
|
ORDER BY `start`';
|
|
|
|
|
$result = DB::select($sql);
|
|
|
|
|
if (DB::getStm()->errorCode() != '00000') {
|
|
|
|
|
engelsystem_error('Unable to load shifts by filter.');
|
|
|
|
@ -64,7 +64,7 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
{
|
|
|
|
|
//@TODO
|
|
|
|
|
$sql = "
|
|
|
|
|
$sql = '
|
|
|
|
|
SELECT
|
|
|
|
|
`NeededAngelTypes`.*,
|
|
|
|
|
`Shifts`.`SID`,
|
|
|
|
@ -75,8 +75,8 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
|
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
|
WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ")
|
|
|
|
|
AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime() . "
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
AND `start` BETWEEN ' . $shiftsFilter->getStartTime() . ' AND ' . $shiftsFilter->getEndTime() . '
|
|
|
|
|
AND `Shifts`.`PSID` IS NULL
|
|
|
|
|
|
|
|
|
|
UNION
|
|
|
|
@ -91,9 +91,9 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
|
|
|
|
|
JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
|
|
|
|
|
WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ")
|
|
|
|
|
AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime() . "
|
|
|
|
|
AND NOT `Shifts`.`PSID` IS NULL";
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
AND `start` BETWEEN ' . $shiftsFilter->getStartTime() . ' AND ' . $shiftsFilter->getEndTime() . '
|
|
|
|
|
AND NOT `Shifts`.`PSID` IS NULL';
|
|
|
|
|
$result = DB::select($sql);
|
|
|
|
|
if (DB::getStm()->errorCode() != '00000') {
|
|
|
|
|
engelsystem_error('Unable to load needed angeltypes by filter.');
|
|
|
|
@ -162,7 +162,7 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
|
|
|
|
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
{
|
|
|
|
|
// @TODO
|
|
|
|
|
$sql = "
|
|
|
|
|
$sql = '
|
|
|
|
|
SELECT
|
|
|
|
|
`User`.`Nick`,
|
|
|
|
|
`User`.`email`,
|
|
|
|
@ -177,9 +177,9 @@ function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|
|
|
|
FROM `Shifts`
|
|
|
|
|
JOIN `ShiftEntry` ON `ShiftEntry`.`SID`=`Shifts`.`SID`
|
|
|
|
|
JOIN `User` ON `ShiftEntry`.`UID`=`User`.`UID`
|
|
|
|
|
WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ")
|
|
|
|
|
AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime() . "
|
|
|
|
|
ORDER BY `Shifts`.`start`";
|
|
|
|
|
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
|
|
|
|
|
AND `start` BETWEEN ' . $shiftsFilter->getStartTime() . ' AND ' . $shiftsFilter->getEndTime() . '
|
|
|
|
|
ORDER BY `Shifts`.`start`';
|
|
|
|
|
$result = DB::select($sql);
|
|
|
|
|
if (DB::getStm()->errorCode() != '00000') {
|
|
|
|
|
engelsystem_error('Unable to load shift entries by filter.');
|
|
|
|
|