parent
3e958227aa
commit
ed001633e6
|
@ -417,13 +417,14 @@ function view_user_shifts() {
|
||||||
LEFT JOIN (SELECT se.`SID`, se.`TID`, COUNT(*) as count FROM `ShiftEntry` AS se GROUP BY se.`SID`, se.`TID`) AS entries ON entries.`SID` = `Shifts`.`SID` AND entries.`TID` = nat.`angel_type_id`
|
LEFT JOIN (SELECT se.`SID`, se.`TID`, COUNT(*) as count FROM `ShiftEntry` AS se GROUP BY se.`SID`, se.`TID`) AS entries ON entries.`SID` = `Shifts`.`SID` AND entries.`TID` = nat.`angel_type_id`
|
||||||
WHERE `Shifts`.`RID` IN (" . implode(',', $_SESSION['user_shifts']['rooms']) . ")
|
WHERE `Shifts`.`RID` IN (" . implode(',', $_SESSION['user_shifts']['rooms']) . ")
|
||||||
AND `start` BETWEEN " . $starttime . " AND " . $endtime;
|
AND `start` BETWEEN " . $starttime . " AND " . $endtime;
|
||||||
|
|
||||||
if (count($_SESSION['user_shifts']['filled']) == 1) {
|
if (count($_SESSION['user_shifts']['filled']) == 1) {
|
||||||
if ($_SESSION['user_shifts']['filled'][0] == 0)
|
if ($_SESSION['user_shifts']['filled'][0] == 0)
|
||||||
$SQL .= "
|
$SQL .= "
|
||||||
AND (nat.`count` > entries.`count` OR entries.`count` IS NULL) ";
|
AND (nat.`count` > entries.`count` OR entries.`count` IS NULL OR EXISTS (SELECT `SID` FROM `ShiftEntry` WHERE `UID` = " .sql_escape($user['UID']) . " AND `ShiftEntry`.`SID` = `Shifts`.`SID`))";
|
||||||
elseif ($_SESSION['user_shifts']['filled'][0] == 1)
|
elseif ($_SESSION['user_shifts']['filled'][0] == 1)
|
||||||
$SQL .= "
|
$SQL .= "
|
||||||
AND (nat.`count` <= entries.`count`) ";
|
AND (nat.`count` <= entries.`count` OR EXISTS (SELECT `SID` FROM `ShiftEntry` WHERE `UID` = " .sql_escape($user['UID']) . " AND `ShiftEntry`.`SID` = `Shifts`.`SID`))";
|
||||||
}
|
}
|
||||||
$SQL .= "
|
$SQL .= "
|
||||||
ORDER BY `start`";
|
ORDER BY `start`";
|
||||||
|
@ -613,9 +614,7 @@ function view_user_shifts() {
|
||||||
else
|
else
|
||||||
$class = 'occupied';
|
$class = 'occupied';
|
||||||
$shifts_table .= '<td rowspan="' . $blocks . '" class="' . $class . '">';
|
$shifts_table .= '<td rowspan="' . $blocks . '" class="' . $class . '">';
|
||||||
if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (! $is_free && in_array(1, $_SESSION['user_shifts']['filled']))) {
|
$shifts_table .= $shifts_row;
|
||||||
$shifts_table .= $shifts_row;
|
|
||||||
}
|
|
||||||
$shifts_table .= "</td>";
|
$shifts_table .= "</td>";
|
||||||
for ($j = 0; $j < $blocks && $i + $j < $maxshow; $j ++) {
|
for ($j = 0; $j < $blocks && $i + $j < $maxshow; $j ++) {
|
||||||
$todo[$rid][$i + $j] --;
|
$todo[$rid][$i + $j] --;
|
||||||
|
@ -733,11 +732,9 @@ function view_user_shifts() {
|
||||||
if (in_array('user_shifts_admin', $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$shift_row['entries'] .= '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">Weitere Helfer eintragen »</a>';
|
$shift_row['entries'] .= '<a href="' . page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'] . '">Weitere Helfer eintragen »</a>';
|
||||||
}
|
}
|
||||||
if (($is_free && in_array(0, $_SESSION['user_shifts']['filled'])) || (! $is_free && in_array(1, $_SESSION['user_shifts']['filled']))) {
|
$shifts_table[] = $shift_row;
|
||||||
$shifts_table[] = $shift_row;
|
$shift['angeltypes'] = $angeltypes;
|
||||||
$shift['angeltypes'] = $angeltypes;
|
$ical_shifts[] = $shift;
|
||||||
$ical_shifts[] = $shift;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$shifts_table = table(array(
|
$shifts_table = table(array(
|
||||||
|
|
Loading…
Reference in New Issue