X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=time.php;h=9a34d30df05f51b43eb8b16fd6f48381a400afd9;hb=b76e427286701104c84a869461ceb7339b1b943a;hp=047556b4a24d529883a00b047e55503150c0087b;hpb=0dfc4dda20c54e173938eaf196f8e071ce790830;p=timetracker.git diff --git a/time.php b/time.php index 047556b4..9a34d30d 100644 --- a/time.php +++ b/time.php @@ -63,6 +63,17 @@ if ($user->isPluginEnabled('cf')) { $smarty->assign('custom_fields', $custom_fields); } +if ($user->isPluginEnabled('mq')){ + require_once('plugins/MonthlyQuota.class.php'); + $quota = new MonthlyQuota(); + $monthlyQuota = $quota->get($selected_date->mYear, $selected_date->mMonth); + $month_total = ttTimeHelper::getTimeForMonth($user->getActiveUser(), $selected_date); + $minutesLeft = ttTimeHelper::toMinutes($monthlyQuota) - ttTimeHelper::toMinutes($month_total); + + $smarty->assign('month_total', $month_total); + $smarty->assign('month_left', ttTimeHelper::fromMinutes($minutesLeft)); +} + // Initialize variables. $cl_start = trim($request->getParameter('start')); $cl_finish = trim($request->getParameter('finish')); @@ -204,14 +215,6 @@ if ($custom_fields && $custom_fields->fields[0]) { } } -// Determine lock date. Time entries earlier than lock date cannot be created or modified. -$lock_interval = $user->lock_interval; -$lockdate = 0; -if ($lock_interval > 0) { - $lockdate = new DateAndTime(); - $lockdate->decDay($lock_interval); -} - // Submit. if ($request->isPost()) { if ($request->getParameter('btn_submit')) { @@ -262,9 +265,9 @@ if ($request->isPost()) { $err->add($i18n->getKey('error.future_date')); } - // Prohibit creating time entries in locked interval. - if($lockdate && $selected_date->before($lockdate)) - $err->add($i18n->getKey('error.period_locked')); + // Prohibit creating entries in locked range. + if ($user->isDateLocked($selected_date)) + $err->add($i18n->getKey('error.range_locked')); // Prohibit creating another uncompleted record. if ($err->no()) {