import('DateAndTime');
// Access check.
-if (!ttAccessCheck(right_data_entry) || !$user->isPluginEnabled('wv')) {
+if (!ttAccessAllowed('track_own_time') || !$user->isPluginEnabled('wv')) {
header('Location: access_denied.php');
exit();
}
// Elements of weekTimeForm.
$form = new Form('weekTimeForm');
-if ($user->canManageTeam()) {
+if ($user->can('track_time')) {
$user_list = ttTeamHelper::getActiveUsers(array('putSelfFirst'=>true));
if (count($user_list) > 1) {
$form->addInput(array('type'=>'combobox',
$existingDuration = $dataArray[$rowNumber][$dayHeader]['duration'];
// If posted value is not null, check and normalize it.
if ($postedDuration) {
- if (ttTimeHelper::isValidDuration($postedDuration)) {
- $postedDuration = ttTimeHelper::normalizeDuration($postedDuration, false); // No leading zero.
- } else {
+ if (false === ttTimeHelper::postedDurationToMinutes($postedDuration)) {
$err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
$result = false; break; // Break out. Stop any further processing.
+ } else {
+ $minutes = ttTimeHelper::postedDurationToMinutes($postedDuration);
+ $postedDuration = ttTimeHelper::minutesToDuration($minutes);
}
}
// Do not process if value has not changed.
}
}
elseif ($request->getParameter('onBehalfUser')) {
- if($user->canManageTeam()) {
+ if($user->can('track_time')) {
unset($_SESSION['behalf_id']);
unset($_SESSION['behalf_name']);