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