From fe58e4f4220d6685b91bf516374e33936e1075e3 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 14 Jan 2018 17:47:26 +0100 Subject: database: updated checks for selectOne --- includes/controller/shifts_controller.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'includes/controller/shifts_controller.php') diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 5930595e..326449cf 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -217,7 +217,7 @@ function shift_delete_controller() $shift_id = $request->input('delete_shift'); $shift = Shift($shift_id); - if ($shift == null) { + if (empty($shift)) { redirect(page_link_to('user_shifts')); } @@ -264,7 +264,7 @@ function shift_controller() } $shift = Shift($request->input('shift_id')); - if ($shift == null) { + if (empty($shift)) { error(_('Shift could not be found.')); redirect(page_link_to('user_shifts')); } @@ -288,7 +288,7 @@ function shift_controller() $needed_angeltype, $shift_entries ); - if ($shift_signup_state == null) { + if (empty($shift_signup_state)) { $shift_signup_state = $angeltype_signup_state; } else { $shift_signup_state->combineWith($angeltype_signup_state); @@ -387,7 +387,7 @@ function shifts_json_export_controller() $key = $request->input('key'); $user = User_by_api_key($key); - if ($user == null) { + if (empty($user)) { engelsystem_error('Key invalid.'); } if (!in_array('shifts_json_export', privileges_for_user($user['UID']))) { -- cgit v1.2.3-54-g00ecf From 1090d5e889827056e445b5c1fe0fa7f8e395d8ec Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 28 Aug 2018 18:28:09 +0200 Subject: Update shifts_controller.php fix problem when missing needed angeltype entry --- includes/controller/shifts_controller.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'includes/controller/shifts_controller.php') diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index b8ed0180..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; } -- cgit v1.2.3-54-g00ecf