summaryrefslogtreecommitdiff
path: root/includes/controller/shifts_controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller/shifts_controller.php')
-rw-r--r--includes/controller/shifts_controller.php36
1 files changed, 5 insertions, 31 deletions
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index 326449cf..7cac5b4a 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -277,6 +277,10 @@ function shift_controller()
$shift_signup_state = new ShiftSignupState(ShiftSignupState::OCCUPIED, 0);
foreach ($angeltypes as &$angeltype) {
$needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype);
+ if(empty($needed_angeltype)) {
+ continue;
+ }
+
$shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']);
$angeltype_signup_state = Shift_signup_allowed(
@@ -288,11 +292,7 @@ function shift_controller()
$needed_angeltype,
$shift_entries
);
- if (empty($shift_signup_state)) {
- $shift_signup_state = $angeltype_signup_state;
- } else {
- $shift_signup_state->combineWith($angeltype_signup_state);
- }
+ $shift_signup_state->combineWith($angeltype_signup_state);
$angeltype['shift_signup_state'] = $angeltype_signup_state;
}
@@ -346,32 +346,6 @@ function shift_next_controller()
}
/**
- * Export all shifts using api-key.
- */
-function shifts_json_export_all_controller()
-{
- $api_key = config('api_key');
- $request = request();
-
- if (empty($api_key)) {
- engelsystem_error('Config contains empty apikey.');
- }
-
- if (!$request->has('api_key')) {
- engelsystem_error('Missing parameter api_key.');
- }
-
- if ($request->input('api_key') != $api_key) {
- engelsystem_error('Invalid api_key.');
- }
-
- $shifts_source = Shifts();
-
- header('Content-Type: application/json; charset=utf-8');
- raw_output(json_encode($shifts_source));
-}
-
-/**
* Export filtered shifts via JSON.
* (Like iCal Export or shifts view)
*/