Fixed a bug with Monthly Quota plugin.
authorNik Okuntseff <support@anuko.com>
Thu, 21 Jul 2016 14:40:39 +0000 (14:40 +0000)
committerNik Okuntseff <support@anuko.com>
Thu, 21 Jul 2016 14:40:39 +0000 (14:40 +0000)
Was reporting less that 1 hour over quota incorrectly.

WEB-INF/lib/ttTimeHelper.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/time.tpl
time.php

index f378d0c..f98d675 100644 (file)
@@ -148,7 +148,7 @@ class ttTimeHelper {
   
   // fromMinutes - converts a number of minutes to format 00:00
   static function fromMinutes($minutes){
-    $hours = (string)((int)($minutes / 60));
+    $hours = (string)((int)abs($minutes / 60));
     $mins = (string)(abs($minutes % 60));
     if (strlen($hours) == 1)
       $hours = '0'.$hours;
index 5edd99a..4b4982b 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.9.26.3507 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.27.3508 | 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 d526c46..e5a753f 100644 (file)
@@ -357,8 +357,8 @@ function get_time() {
   {if $month_total}
   <tr>
     <td align="left">{$i18n.label.month_total}: {$month_total}</td>
-    {if $month_left|strpos:'-' === 0}
-    <td align="right">{$i18n.label.month_over}: <span style="color: green;">{$month_left|substr:1}</span></td>
+    {if $over_quota}
+    <td align="right">{$i18n.label.month_over}: <span style="color: green;">{$month_left}</span></td>
     {else}
     <td align="right">{$i18n.label.month_left}: <span style="color: red;">{$month_left}</span></td>
     {/if}
index 4042d7c..33b5763 100644 (file)
--- a/time.php
+++ b/time.php
@@ -71,6 +71,7 @@ if ($user->isPluginEnabled('mq')){
   $minutesLeft = ttTimeHelper::toMinutes($monthlyQuota) - ttTimeHelper::toMinutes($month_total);
   
   $smarty->assign('month_total', $month_total);
+  $smarty->assign('over_quota', $minutesLeft < 0);
   $smarty->assign('month_left', ttTimeHelper::fromMinutes($minutesLeft));
 }