From 1c2cf98a7a062d53e6988f042da2530e1f5d172e Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Thu, 21 Jul 2016 14:40:39 +0000 Subject: [PATCH] Fixed a bug with Monthly Quota plugin. Was reporting less that 1 hour over quota incorrectly. --- WEB-INF/lib/ttTimeHelper.class.php | 2 +- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/time.tpl | 4 ++-- time.php | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index f378d0c0..f98d6757 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -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; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 5edd99ae..4b4982b5 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - {if $month_left|strpos:'-' === 0} - + {if $over_quota} + {else} {/if} diff --git a/time.php b/time.php index 4042d7c5..33b57639 100644 --- 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)); } -- 2.20.1
 Anuko Time Tracker 1.9.26.3507 | Copyright © Anuko | +  Anuko Time Tracker 1.9.27.3508 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/time.tpl b/WEB-INF/templates/time.tpl index d526c46f..e5a753fd 100644 --- a/WEB-INF/templates/time.tpl +++ b/WEB-INF/templates/time.tpl @@ -357,8 +357,8 @@ function get_time() { {if $month_total}
{$i18n.label.month_total}: {$month_total}{$i18n.label.month_over}: {$month_left|substr:1}{$i18n.label.month_over}: {$month_left}{$i18n.label.month_left}: {$month_left}