diff options
author | Felix Favre <gnomus@gnomus.de> | 2014-12-07 18:04:03 +0100 |
---|---|---|
committer | Felix Favre <gnomus@gnomus.de> | 2014-12-07 18:04:03 +0100 |
commit | 5b3e5750ebd48993a58b38c657bb87e1e810d180 (patch) | |
tree | 848fd9c99eeb13027bf205c0850d0404ae0c58a1 /includes/pages/user_myshifts.php | |
parent | 09ef38ff351b6d3308022531ec3f79b5700f2731 (diff) | |
parent | b75700ee1bf4bc07f1da7899aac864cb561022f4 (diff) |
Merge branch 'master' of github.com:engelsystem/engelsystem
Conflicts:
includes/model/ShiftEntry_model.php
Diffstat (limited to 'includes/pages/user_myshifts.php')
-rw-r--r-- | includes/pages/user_myshifts.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index d1c60dd6..d74475d2 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -57,12 +57,15 @@ function user_myshifts() { $comment = strip_request_item_nl('comment'); $user_source = User($shift['UID']); - sql_query("UPDATE `ShiftEntry` SET - `Comment`='" . sql_escape($comment) . "', - `freeloaded`=" . sql_escape($freeloaded ? 1 : 0) . ", - `freeload_comment`='" . sql_escape($freeload_comment) . "' - WHERE `id`=" . sql_escape($id) . " - LIMIT 1"); + $result = ShiftEntry_update(array( + 'id' => $id, + 'Comment' => $comment, + 'freeloaded' => $freeloaded, + 'freeload_comment' => $freeload_comment + )); + if ($result === false) + engelsystem_error('Unable to update shift entr.'); + engelsystem_log("Updated " . User_Nick_render($user_source) . "'s shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']) . " with comment " . $comment); success(_("Shift saved.")); redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']); @@ -77,15 +80,16 @@ function user_myshifts() { if (count($shift) > 0) { $shift = $shift[0]; if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) { - sql_query("DELETE FROM `ShiftEntry` WHERE `id`=" . sql_escape($id) . " LIMIT 1"); - $msg .= success(_("You have been signed off from the shift."), true); + $result = ShiftEntry_delete($id); + if ($result === false) + engelsystem_error('Unable to delete shift entry.'); + success(_("You have been signed off from the shift.")); } else - $msg .= error(_("It's too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so."), true); + error(_("It's too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so.")); } else redirect(page_link_to('user_myshifts')); } - msg(); redirect(page_link_to('users') . '&action=view'); } ?> |