]> wagnertech.de Git - timetracker.git/blobdiff - time.php
A bit of refactoring.
[timetracker.git] / time.php
index 25cee96cc1844191761848f19f7a676842412748..11f95c49ea4106b8484b97b93261e4d04219b7b9 100644 (file)
--- a/time.php
+++ b/time.php
@@ -66,9 +66,9 @@ if ($user->isPluginEnabled('cf')) {
 if ($user->isPluginEnabled('mq')){
   require_once('plugins/MonthlyQuota.class.php');
   $quota = new MonthlyQuota();
-  $month_quota = $quota->get($selected_date->mYear, $selected_date->mMonth);
+  $month_quota_minutes = $quota->get($selected_date->mYear, $selected_date->mMonth);
   $month_total = ttTimeHelper::getTimeForMonth($user->getActiveUser(), $selected_date);
-  $minutes_left = round(60*$month_quota) - ttTimeHelper::toMinutes($month_total);
+  $minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
   
   $smarty->assign('month_total', $month_total);
   $smarty->assign('over_quota', $minutes_left < 0);
@@ -253,7 +253,7 @@ if ($request->isPost()) {
           $err->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
       }
     } else {
-      if (!ttTimeHelper::isValidDuration($cl_duration))
+      if (false === ttTimeHelper::postedDurationToMinutes($cl_duration))
         $err->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
     }
     if (!ttValidString($cl_note, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));