From 27c9650dc4064ec5b40c5041d8291a7ce0e5305e Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 4 Oct 2016 21:20:38 +0200 Subject: reduce complexity of shifts controller --- includes/controller/angeltypes_controller.php | 6 ----- includes/controller/shift_entries_controller.php | 3 --- includes/controller/shifts_controller.php | 28 ++---------------------- includes/controller/shifttypes_controller.php | 3 --- 4 files changed, 2 insertions(+), 38 deletions(-) (limited to 'includes/controller') diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index cd938893..ea451481 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -50,9 +50,6 @@ function angeltypes_about_controller() { } else { $angeltypes = AngelTypes(); } - if ($angeltypes === false) { - engelsystem_error("Unable to load angeltypes."); - } return [ _("Teams/Job description"), @@ -223,9 +220,6 @@ function angeltypes_list_controller() { } $angeltypes = AngelTypes_with_user($user); - if ($angeltypes === false) { - engelsystem_error("Unable to load angeltypes."); - } foreach ($angeltypes as &$angeltype) { $actions = [ diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php index d704c299..9e252a4f 100644 --- a/includes/controller/shift_entries_controller.php +++ b/includes/controller/shift_entries_controller.php @@ -21,9 +21,6 @@ function shift_entry_add_controller() { $shift = Shift($shift_id); $shift['Name'] = $room_array[$shift['RID']]; - if ($shift === false) { - engelsystem_error('Unable to load shift.'); - } if ($shift == null) { redirect(page_link_to('user_shifts')); } diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index ca6fd906..be0cf127 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -159,19 +159,13 @@ function shift_delete_controller() { $shift_id = $_REQUEST['delete_shift']; $shift = Shift($shift_id); - if ($shift === false) { - engelsystem_error('Unable to load shift.'); - } if ($shift == null) { redirect(page_link_to('user_shifts')); } // Schicht löschen bestätigt if (isset($_REQUEST['delete'])) { - $result = Shift_delete($shift_id); - if ($result === false) { - engelsystem_error('Unable to delete shift.'); - } + Shift_delete($shift_id); engelsystem_log("Deleted shift " . $shift['name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end'])); success(_("Shift deleted.")); @@ -196,33 +190,15 @@ function shift_controller() { } $shift = Shift($_REQUEST['shift_id']); - if ($shift === false) { - engelsystem_error('Unable to load shift.'); - } if ($shift == null) { - error(_('Shift could not be found.')); + error(_("Shift could not be found.")); redirect(page_link_to('user_shifts')); } $shifttype = ShiftType($shift['shifttype_id']); - if ($shifttype === false || $shifttype == null) { - engelsystem_error('Unable to load shift type.'); - } - $room = Room($shift['RID']); - if ($room === false || $room == null) { - engelsystem_error('Unable to load room.'); - } - $angeltypes = AngelTypes(); - if ($angeltypes === false) { - engelsystem_error('Unable to load angeltypes.'); - } - $user_shifts = Shifts_by_user($user); - if ($user_shifts === false) { - engelsystem_error('Unable to load users shifts.'); - } $signed_up = false; foreach ($user_shifts as $user_shift) { diff --git a/includes/controller/shifttypes_controller.php b/includes/controller/shifttypes_controller.php index 5e547895..456e39ae 100644 --- a/includes/controller/shifttypes_controller.php +++ b/includes/controller/shifttypes_controller.php @@ -48,9 +48,6 @@ function shifttype_edit_controller() { $description = ""; $angeltypes = AngelTypes(); - if ($angeltypes === false) { - engelsystem_error("Unable to load angel types."); - } if (isset($_REQUEST['shifttype_id'])) { $shifttype = ShiftType($_REQUEST['shifttype_id']); -- cgit v1.2.3-70-g09d2