X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/d9b8a2fcd3d9886b2cf218d31eb6d37afdae368e..ff81442e61388a8f144691c020c1f097a4b26d49:/quotas.php diff --git a/quotas.php b/quotas.php index 10653893..d3e7912e 100644 --- a/quotas.php +++ b/quotas.php @@ -71,6 +71,9 @@ $quota = new MonthlyQuota(); if ($request->isPost()){ // Validate user input. + if (!ttTimeHelper::isValidDuration($request->getParameter('workdayHours'))) + $err->add($i18n->getKey('error.field'), $i18n->getKey('form.quota.workday_hours')); + for ($i = 0; $i < count($months); $i++){ $val = $request->getParameter($months[$i]); if (!$quota->isValidQuota($val)) @@ -81,7 +84,7 @@ if ($request->isPost()){ if ($err->no()) { // Handle workday hours. - $hours = (int)$request->getParameter('workdayHours'); + $hours = $quota->quotaToFloat($request->getParameter('workdayHours')); if ($hours != $user->workday_hours) { if (!ttTeamHelper::update($user->team_id, array('name'=>$user->team,'workday_hours'=>$hours))) $err->add($i18n->getKey('error.db')); @@ -104,9 +107,10 @@ if ($request->isPost()){ // Get monthly quotas for the entire year. $monthsData = $quota->get($selectedYear); +$workdayHours = ttTimeHelper::toAbsDuration($user->workday_hours * 60, true); $form = new Form('monthlyQuotasForm'); -$form->addInput(array('type'=>'text', 'name'=>'workdayHours', 'value'=>$user->workday_hours, 'style'=>'width:50px')); +$form->addInput(array('type'=>'text', 'name'=>'workdayHours', 'value'=>$workdayHours, 'style'=>'width:60px')); $form->addInput(array('type'=>'combobox','name'=>'year','data'=>$years,'datakeys'=>array('id','name'),'value'=>$selectedYear,'onchange'=>'yearChange(this.value);')); for ($i=0; $i < count($months); $i++) { $value = "";