api export for all shifts completed

main
Philip Häusler 11 years ago
parent ad5899f028
commit 4aa85a3ff2

@ -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;

@ -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) . "
");

@ -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;
}
?>

@ -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');

Loading…
Cancel
Save