summaryrefslogtreecommitdiff
path: root/includes/model
diff options
context:
space:
mode:
Diffstat (limited to 'includes/model')
-rw-r--r--includes/model/NeededAngelTypes_model.php10
-rw-r--r--includes/model/ShiftEntry_model.php2
-rw-r--r--includes/model/Shifts_model.php4
3 files changed, 10 insertions, 6 deletions
diff --git a/includes/model/NeededAngelTypes_model.php b/includes/model/NeededAngelTypes_model.php
index 85890f2d..c4d12fdb 100644
--- a/includes/model/NeededAngelTypes_model.php
+++ b/includes/model/NeededAngelTypes_model.php
@@ -14,19 +14,21 @@ function NeededAngelTypes_by_shift($shift) {
OR `room_id`=" . sql_escape($shift['RID']) . "
ORDER BY `room_id` DESC
");
- if ($needed_angeltypes === false)
+ if ($needed_angeltypes_source === false)
return false;
- $needed_angeltypes = array();
+ $needed_angeltypes_merged = array();
foreach ($needed_angeltypes_source as $angeltype)
- $needed_angeltypes[$angeltype['id']] = $angeltype;
+ $needed_angeltypes_merged[$angeltype['id']] = $angeltype;
- foreach ($needed_angeltypes as &$angeltype) {
+ $needed_angeltypes = array();
+ foreach ($needed_angeltypes_merged as $angeltype) {
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
if ($shift_entries === false)
return false;
$angeltype['taken'] = count($shift_entries);
+ $needed_angeltypes[] = $angeltype;
}
return $needed_angeltypes;
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php
index 79652c9b..230f69b0 100644
--- a/includes/model/ShiftEntry_model.php
+++ b/includes/model/ShiftEntry_model.php
@@ -8,7 +8,7 @@
function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id) {
return sql_select("
SELECT *
- FROM `ShiftEntries`
+ FROM `ShiftEntry`
WHERE `SID`=" . sql_escape($shift_id) . "
AND `TID`=" . sql_escape($angeltype_id) . "
");
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 84d14c7a..5e8a2b54 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -16,9 +16,11 @@ function Shifts() {
$needed_angeltypes = NeededAngelTypes_by_shift($shift);
if ($needed_angeltypes === false)
return false;
-
+
$shift['angeltypes'] = $needed_angeltypes;
}
+
+ return $shifts_source;
}
?> \ No newline at end of file