Fixed work units config for subgroups.
authorNik Okuntseff <support@anuko.com>
Fri, 14 Dec 2018 17:36:55 +0000 (17:36 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 14 Dec 2018 17:36:55 +0000 (17:36 +0000)
WEB-INF/templates/footer.tpl
work_units.php

index 98ba14a..e94e90f 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.31.4652 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.31.4653 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index b2373ad..84ef37e 100644 (file)
@@ -39,17 +39,18 @@ if (!$user->isPluginEnabled('wu')) {
   header('Location: feature_disabled.php');
   exit();
 }
+// End of access checks.
 
-$config = new ttConfigHelper($user->config);
+$config = new ttConfigHelper($user->getConfig());
 
 if ($request->isPost()) {
   $cl_minutes_in_unit = $request->getParameter('minutes_in_unit');
   $cl_1st_unit_threshold = $request->getParameter('1st_unit_threshold');
   $cl_totals_only = $request->getParameter('totals_only');
 } else {
-  $cl_minutes_in_unit = $user->minutes_in_unit;
-  $cl_1st_unit_threshold = $user->first_unit_threshold;
-  $cl_totals_only = $user->unit_totals_only;
+  $cl_minutes_in_unit = $user->getConfigInt('minutes_in_unit');
+  $cl_1st_unit_threshold = $user->getConfigInt('1st_unit_threshold');
+  $cl_totals_only = $user->getConfigOption('unit_totals_only');
 }
 
 $form = new Form('workUnitsForm');
@@ -60,7 +61,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('b
 
 if ($request->isPost()){
   // Validate user input.
-  if (!ttValidInteger($cl_minutes_in_unit)) $err->add($i18n->get('error.field'), $i18n->get('form.work_units.minutes_in_unit'));
+  if (!ttValidInteger($cl_minutes_in_unit) || $cl_minutes_in_unit == 0) $err->add($i18n->get('error.field'), $i18n->get('form.work_units.minutes_in_unit'));
   if (!ttValidInteger($cl_1st_unit_threshold, true) ||($cl_minutes_in_unit && $cl_1st_unit_threshold > $cl_minutes_in_unit)) $err->add($i18n->get('error.field'), $i18n->get('form.work_units.1st_unit_threshold'));
   // Finished validating user input.