X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/a8a4278a6a87c600835890a10c774dfdc58e930a..82113b6a111dc3f716c71fb8fb55b11845cbd697:/time_edit.php diff --git a/time_edit.php b/time_edit.php index c14928f5..507f28ab 100644 --- a/time_edit.php +++ b/time_edit.php @@ -34,11 +34,19 @@ import('ttClientHelper'); import('ttTimeHelper'); import('DateAndTime'); -// Access check. +// Access checks. if (!(ttAccessAllowed('track_own_time') || ttAccessAllowed('track_time'))) { header('Location: access_denied.php'); exit(); } +$cl_id = (int)$request->getParameter('id'); +$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser()); +if (!$time_rec || $time_rec['invoice_id']) { + // Prohibit editing not ours or invoiced records. + header('Location: access_denied.php'); + exit(); +} +// End of access checks. // Use custom fields plugin if it is enabled. if ($user->isPluginEnabled('cf')) { @@ -47,14 +55,6 @@ if ($user->isPluginEnabled('cf')) { $smarty->assign('custom_fields', $custom_fields); } -$cl_id = $request->getParameter('id'); - -// Get the time record we are editing. -$time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser()); - -// Prohibit editing invoiced records. -if ($time_rec['invoice_id']) die($i18n->get('error.sys')); - $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']); // Initialize variables.