From: Nik Okuntseff Date: Fri, 14 Dec 2018 16:09:51 +0000 (+0000) Subject: Wrote ttUser::getConfigInt and started to use it. X-Git-Tag: timetracker_1.19-1~412 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7dc611a9564d114fd401c19f72c2525bc0e7494a;p=timetracker.git Wrote ttUser::getConfigInt and started to use it. --- diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index d3c7b7ce..90a4a98c 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -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']) diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 2d7f1c98..a95fa72e 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -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); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 627a2331..98ba14a6 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.31.4651 | Copyright © Anuko | +  Anuko Time Tracker 1.18.31.4652 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}