X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=quotas.php;h=b6d63fa3ec639939ede4bfff3d141bf6569da076;hb=HEAD;hp=8381c3b6a3185b76d6ccf4fe351f4c1c6b32b07c;hpb=de05f61301a897661c702f03c1b45dd3ab5c0e8a;p=timetracker.git diff --git a/quotas.php b/quotas.php index 8381c3b6..b6d63fa3 100644 --- a/quotas.php +++ b/quotas.php @@ -74,12 +74,14 @@ $quota = new MonthlyQuota(); if ($request->isPost()){ // Validate user input. - if (false === ttTimeHelper::postedDurationToMinutes($request->getParameter('workdayHours'))) + $workdayMinutes = ttTimeHelper::postedDurationToMinutes($request->getParameter('workdayHours')); + if (false === $workdayMinutes || $workdayMinutes <= 0 ) $err->add($i18n->get('error.field'), $i18n->get('form.quota.workday_hours')); for ($i = 0; $i < count($months); $i++){ $val = $request->getParameter($months[$i]); - if (false === ttTimeHelper::postedDurationToMinutes($val, 44640/*24*60*31*/)) + $monthMinutes = ttTimeHelper::postedDurationToMinutes($val, 44640/*24*60*31*/); + if (false === $monthMinutes || $monthMinutes < 0) $err->add($i18n->get('error.field'), $months[$i]); } // Finished validating user input. @@ -88,7 +90,7 @@ if ($request->isPost()){ // Handle workday hours. $workday_minutes = ttTimeHelper::postedDurationToMinutes($request->getParameter('workdayHours')); - if ($workday_minutes != $user->workday_minutes) { + if ($workday_minutes != $user->getWorkdayMinutes()) { if (!$user->updateGroup(array('workday_minutes'=>$workday_minutes))) $err->add($i18n->get('error.db')); } @@ -111,7 +113,7 @@ if ($request->isPost()){ // Get monthly quotas for the entire year. $monthsData = $quota->get($selectedYear); -$workdayHours = ttTimeHelper::toAbsDuration($user->workday_minutes, true); +$workdayHours = ttTimeHelper::toAbsDuration($user->getWorkdayMinutes(), true); $form = new Form('monthlyQuotasForm'); $form->addInput(array('type'=>'text', 'name'=>'workdayHours', 'value'=>$workdayHours, 'style'=>'width:60px'));