summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/model/NeededAngelTypes_model.php10
-rw-r--r--includes/model/ShiftEntry_model.php2
-rw-r--r--includes/model/Shifts_model.php4
-rw-r--r--public/index.php3
4 files changed, 12 insertions, 7 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
diff --git a/public/index.php b/public/index.php
index 56cf6620..fccbc69b 100644
--- a/public/index.php
+++ b/public/index.php
@@ -12,6 +12,7 @@ require_once ('includes/sys_template.php');
require_once ('includes/model/LogEntries_model.php');
require_once ('includes/model/NeededAngelTypes_model.php');
+require_once ('includes/model/ShiftEntry_model.php');
require_once ('includes/model/Shifts_model.php');
require_once ('includes/model/User_model.php');
@@ -25,7 +26,7 @@ require_once ('includes/helper/message_helper.php');
require_once ('includes/helper/error_helper.php');
require_once ('config/config.default.php');
-if (file_exists('config/config.php'))
+if (file_exists('../config/config.php'))
require_once ('config/config.php');
require_once ('includes/pages/admin_active.php');