summaryrefslogtreecommitdiff
path: root/includes/controller/shift_entries_controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/controller/shift_entries_controller.php')
-rw-r--r--includes/controller/shift_entries_controller.php19
1 files changed, 5 insertions, 14 deletions
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 3890241d..148b19fb 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -43,7 +43,7 @@ function shift_entry_add_controller()
$type = AngelType($type_id);
} else {
// TODO: Move queries to model
- $type = DB::select('
+ $type = DB::selectOne('
SELECT *
FROM `UserAngelTypes`
JOIN `AngelTypes` ON (`UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`)
@@ -56,7 +56,6 @@ function shift_entry_add_controller()
)
)
', [$type_id, $user['UID']]);
- $type = array_shift($type);
}
if (empty($type)) {
@@ -130,7 +129,7 @@ function shift_entry_add_controller()
}
$comment = strip_request_item_nl('comment');
- $result = ShiftEntry_create([
+ ShiftEntry_create([
'SID' => $shift_id,
'TID' => $selected_type_id,
'UID' => $user_id,
@@ -138,9 +137,6 @@ function shift_entry_add_controller()
'freeloaded' => $freeloaded,
'freeload_comment' => $freeload_comment
]);
- if ($result === false) {
- engelsystem_error('Unable to create shift entry.');
- }
if (
$type['restricted'] == 0
@@ -244,7 +240,7 @@ function shift_entry_delete_controller()
}
$entry_id = $request->input('entry_id');
- $shift_entry_source = DB::select('
+ $shift_entry_source = DB::selectOne('
SELECT
`User`.`Nick`,
`ShiftEntry`.`Comment`,
@@ -263,19 +259,14 @@ function shift_entry_delete_controller()
WHERE `ShiftEntry`.`id`=?',
[$entry_id]
);
- if (count($shift_entry_source) > 0) {
- $shift_entry_source = array_shift($shift_entry_source);
-
+ if (!empty($shift_entry_source)) {
if (!in_array('user_shifts_admin', $privileges) && (!in_array('shiftentry_edit_angeltype_supporter',
$privileges) || !User_is_AngelType_supporter($user, AngelType($shift_entry_source['angeltype_id'])))
) {
redirect(page_link_to('user_shifts'));
}
- $result = ShiftEntry_delete($entry_id);
- if ($result === false) {
- engelsystem_error('Unable to delete shift entry.');
- }
+ ShiftEntry_delete($entry_id);
engelsystem_log(
'Deleted ' . User_Nick_render($shift_entry_source) . '\'s shift: ' . $shift_entry_source['name']