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