A fix for work units in totals only report.
authorNik Okuntseff <support@anuko.com>
Wed, 19 Dec 2018 18:53:27 +0000 (18:53 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 19 Dec 2018 18:53:27 +0000 (18:53 +0000)
WEB-INF/lib/ttReportHelper.class.php
WEB-INF/templates/footer.tpl

index d46319d..237e39e 100644 (file)
@@ -471,7 +471,10 @@ class ttReportHelper {
     // Prepare parts.
     $time_part = "sum(time_to_sec(l.duration)) as time";
     if ($options['show_work_units']) {
-      $units_part = $user->unit_totals_only ? ", null as units" : ", sum(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";
+      $unitTotalsOnly = $user->getConfigOption('unit_totals_only');
+      $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold', 0);
+      $minutesInUnit = $user->getConfigInt('minutes_in_unit', 15);
+      $units_part = $unitTotalsOnly ? ", null as units" : ", sum(if(l.billable = 0 or time_to_sec(l.duration)/60 < $firstUnitThreshold, 0, ceil(time_to_sec(l.duration)/60/$minutesInUnit))) as units";
     }
     if ($options['show_cost']) {
       if (MODE_TIME == $user->tracking_mode)
@@ -1468,7 +1471,7 @@ class ttReportHelper {
     $workUnits = $options['show_work_units'];
     if ($workUnits) {
       $unitTotalsOnly = $user->getConfigOption('unit_totals_only');
-      $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold');
+      $firstUnitThreshold = $user->getConfigInt('1st_unit_threshold', 0);
       $minutesInUnit = $user->getConfigInt('minutes_in_unit', 15);
       if ($unitTotalsOnly)
         $work_unit_part = ", if (sum(l.billable * time_to_sec(l.duration)/60) < $firstUnitThreshold, 0, ceil(sum(l.billable * time_to_sec(l.duration)/60/$minutesInUnit))) as units";
index ee01f47..295fc06 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.32.4665 | 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.33.4666 | 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>