bring back filtering by occupancy
This commit is contained in:
parent
51eb22a1c6
commit
b8ebd23f6d
|
@ -347,13 +347,14 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter) {
|
||||||
foreach ($shifts as $shift) {
|
foreach ($shifts as $shift) {
|
||||||
$needed_angels_count = 0;
|
$needed_angels_count = 0;
|
||||||
foreach ($needed_angeltypes[$shift['SID']] as $needed_angeltype) {
|
foreach ($needed_angeltypes[$shift['SID']] as $needed_angeltype) {
|
||||||
$needed_angels_count += $needed_angeltype['count'];
|
$taken = 0;
|
||||||
}
|
foreach ($shift_entries[$shift['SID']] as $shift_entry) {
|
||||||
$taken = 0;
|
if ($needed_angeltype['angel_type_id'] == $shift_entry['TID'] && $shift_entry['freeloaded'] == 0) {
|
||||||
foreach ($shift_entries[$shift['SID']] as $shift_entry) {
|
$taken ++;
|
||||||
if ($shift_entry['freeloaded'] == 0) {
|
}
|
||||||
$taken ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$needed_angels_count += max(0, $needed_angeltype['count'] - $taken);
|
||||||
}
|
}
|
||||||
if (in_array(ShiftsFilter::FILLED_FREE, $shiftsFilter->getFilled()) && $taken < $needed_angels_count) {
|
if (in_array(ShiftsFilter::FILLED_FREE, $shiftsFilter->getFilled()) && $taken < $needed_angels_count) {
|
||||||
$filtered_shifts[] = $shift;
|
$filtered_shifts[] = $shift;
|
||||||
|
|
|
@ -251,10 +251,6 @@ function Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entrie
|
||||||
function Shift_signup_allowed($signup_user, $shift, $angeltype, $user_angeltype = null, $user_shifts = null, $needed_angeltype, $shift_entries) {
|
function Shift_signup_allowed($signup_user, $shift, $angeltype, $user_angeltype = null, $user_shifts = null, $needed_angeltype, $shift_entries) {
|
||||||
global $user, $privileges;
|
global $user, $privileges;
|
||||||
|
|
||||||
// if($shift['SID']==1907) {
|
|
||||||
// print_r(Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entries));
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (in_array('user_shifts_admin', $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
return Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entries);
|
return Shift_signup_allowed_admin($angeltype, $needed_angeltype, $shift_entries);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue