Wrote ttUser::getConfigInt and started to use it.
authorNik Okuntseff <support@anuko.com>
Fri, 14 Dec 2018 16:09:51 +0000 (16:09 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 14 Dec 2018 16:09:51 +0000 (16:09 +0000)
WEB-INF/lib/ttReportHelper.class.php
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl

index d3c7b7c..90a4a98 100644 (file)
@@ -190,8 +190,11 @@ class ttReportHelper {
     if ($options['show_work_units']) {
       if ($user->getConfigOption('unit_totals_only'))
         array_push($fields, "null as units");
-      else
-        array_push($fields, "if(l.billable = 0 or time_to_sec(l.duration)/60 < $user->first_unit_threshold, 0, ceil(time_to_sec(l.duration)/60/$user->minutes_in_unit)) as units");
+      else {
+        $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold');
+        $minutesInUnit = $user->getConfigInt('minutes_in_unit');
+        array_push($fields, "if(l.billable = 0 or time_to_sec(l.duration)/60 < $firstUnitThreshold, 0, ceil(time_to_sec(l.duration)/60/$minutesInUnit)) as units");
+      }
     }
     // Add note.
     if ($options['show_note'])
index 2d7f1c9..a95fa72 100644 (file)
@@ -235,6 +235,12 @@ class ttUser {
     return $config->getDefinedValue($name);
   }
 
+  // getConfigInt retruns an integer value defined in a group, or false.
+  function getConfigInt($name) {
+    $config = new ttConfigHelper($this->getConfig());
+    return $config->getIntValue($name);
+  }
+
   // can - determines whether user has a right to do something.
   function can($do_something) {
     return in_array($do_something, $this->rights);
index 627a233..98ba14a 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.4651 | 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.4652 | 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>