X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=time.php;h=3543cce023e70ed7f83be6787dfff433e227b13d;hb=33e6efffe820369eacd46596a8f799f941d42f93;hp=047556b4a24d529883a00b047e55503150c0087b;hpb=0dfc4dda20c54e173938eaf196f8e071ce790830;p=timetracker.git diff --git a/time.php b/time.php index 047556b4..3543cce0 100644 --- a/time.php +++ b/time.php @@ -63,6 +63,18 @@ if ($user->isPluginEnabled('cf')) { $smarty->assign('custom_fields', $custom_fields); } +if ($user->isPluginEnabled('mq')){ + require_once('plugins/MonthlyQuota.class.php'); + $quota = new MonthlyQuota(); + $month_quota = $quota->get($selected_date->mYear, $selected_date->mMonth); + $month_total = ttTimeHelper::getTimeForMonth($user->getActiveUser(), $selected_date); + $minutes_left = ttTimeHelper::toMinutes($month_quota) - ttTimeHelper::toMinutes($month_total); + + $smarty->assign('month_total', $month_total); + $smarty->assign('over_quota', $minutes_left < 0); + $smarty->assign('quota_remaining', ttTimeHelper::toAbsDuration($minutes_left)); +} + // Initialize variables. $cl_start = trim($request->getParameter('start')); $cl_finish = trim($request->getParameter('finish')); @@ -183,7 +195,7 @@ if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READON } if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type)) $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');")); -$form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 600px; height: 40px;','value'=>$cl_note)); +$form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 600px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_note)); $form->addInput(array('type'=>'calendar','name'=>'date','value'=>$cl_date)); // calendar if ($user->isPluginEnabled('iv')) $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable)); @@ -204,14 +216,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 +266,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()) {