summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-12-29 14:51:43 +0100
committermsquare <msquare@notrademark.de>2016-12-29 14:51:43 +0100
commitfe5dec73ba4048e65f3edb0f0f637600936429bf (patch)
tree79dfb4d73074e5e035c449ae7354484386bc6a4c /includes/model/Shifts_model.php
parent68aeb14edbcefc66e49865df2665cbca0a135e3b (diff)
bring back filtering by occupancy
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php47
1 files changed, 1 insertions, 46 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 07467103..9d91b00c 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -36,52 +36,7 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter) {
AND `NeededAngelTypes`.`count` > 0
AND NOT `Shifts`.`PSID` IS NULL) as tmp_shifts
- ORDER BY `start`
- ";
- /**
- * $SQL = "SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` as `room_name`
- * FROM `Shifts`
- * INNER JOIN `Room` USING (`RID`)
- * INNER JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
- * LEFT JOIN (
- * SELECT COUNT(*) AS special_needs , nat3.`shift_id`
- * FROM `NeededAngelTypes` AS nat3
- * WHERE `shift_id` IS NOT NULL
- * GROUP BY nat3.`shift_id`
- * ) AS nat2 ON nat2.`shift_id` = `Shifts`.`SID`
- * INNER JOIN `NeededAngelTypes` AS nat
- * ON nat.`count` != 0
- * AND nat.`angel_type_id` IN (" . implode(',', $shiftsFilter->getTypes()) . ")
- * AND (
- * (nat2.`special_needs` > 0 AND nat.`shift_id` = `Shifts`.`SID`)
- * OR
- * (
- * (nat2.`special_needs` = 0 OR nat2.`special_needs` IS NULL)
- * AND nat.`room_id` = `RID`)
- * )
- * LEFT JOIN (
- * SELECT se.`SID`, se.`TID`, COUNT(*) as count
- * FROM `ShiftEntry` AS se GROUP BY se.`SID`, se.`TID`
- * ) AS entries ON entries.`SID` = `Shifts`.`SID` AND entries.`TID` = nat.`angel_type_id`
- * WHERE `Shifts`.`RID` IN (" . implode(',', $shiftsFilter->getRooms()) . ")
- * AND `start` BETWEEN " . $shiftsFilter->getStartTime() . " AND " . $shiftsFilter->getEndTime();
- *
- * if (count($shiftsFilter->getFilled()) == 1) {
- * if ($shiftsFilter->getFilled()[0] == ShiftsFilter::FILLED_FREE) {
- * $SQL .= "
- * AND (
- * nat.`count` > entries.`count` OR entries.`count` IS NULL
- * )";
- * } elseif ($_SESSION['user_shifts']['filled'][0] == ShiftsFilter::FILLED_FILLED) {
- * $SQL .= "
- * AND (
- * nat.`count` <= entries.`count`
- * )";
- * }
- * }
- * $SQL .= "
- * ORDER BY `start`";
- */
+ ORDER BY `start`";
$result = sql_select($SQL);
if ($result === false) {
engelsystem_error("Unable to load shifts by filter.");