From: Nik Okuntseff Date: Tue, 4 Dec 2018 17:33:36 +0000 (+0000) Subject: A bit more refactoring for subgroups. X-Git-Tag: timetracker_1.19-1~481 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b10bedad0cf854c9cb49bf0582b20869cb0c458d;p=timetracker.git A bit more refactoring for subgroups. --- diff --git a/WEB-INF/lib/ttExpenseHelper.class.php b/WEB-INF/lib/ttExpenseHelper.class.php index 9f5e838d..0b202c6b 100644 --- a/WEB-INF/lib/ttExpenseHelper.class.php +++ b/WEB-INF/lib/ttExpenseHelper.class.php @@ -110,14 +110,14 @@ class ttExpenseHelper { $group_id = $user->getGroup(); $org_id = $user->org_id; - $sql = "select sum(cost) as sm from tt_expense_items". + $sql = "select sum(cost) as total from tt_expense_items". " where user_id = $user_id and group_id = $group_id and org_id = $org_id". " and date = ".$mdb2->quote($date)." and status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { $val = $res->fetchRow(); - $val['sm'] = str_replace('.', $user->getDecimalMark(), $val['sm']); - return $val['sm']; + $val['total'] = str_replace('.', $user->getDecimalMark(), $val['total']); + return $val['total']; } return false; } diff --git a/WEB-INF/lib/ttGroup.class.php b/WEB-INF/lib/ttGroup.class.php index b7e78f95..b0c50eef 100644 --- a/WEB-INF/lib/ttGroup.class.php +++ b/WEB-INF/lib/ttGroup.class.php @@ -94,8 +94,8 @@ class ttGroup { $this->allow_ip = $val['allow_ip']; $this->password_complexity = $val['password_complexity']; $this->group_name = $val['group_name']; - $this->currency = $val['currency']; */ + $this->currency = $val['currency']; $this->plugins = $val['plugins']; /* $this->lock_spec = $val['lock_spec']; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 5e359cd2..548d70ec 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -179,6 +179,16 @@ class ttUser { return ($this->behalfGroup ? $this->behalfGroup->decimal_mark : $this->decimal_mark); } + // getDateFormat returns date format for active group. + function getDateFormat() { + return ($this->behalfGroup ? $this->behalfGroup->date_format : $this->date_format); + } + + // getTimeFormat returns time format for active group. + function getTimeFormat() { + return ($this->behalfGroup ? $this->behalfGroup->time_format : $this->time_format); + } + // getTrackingMode returns tracking mode for active group. function getTrackingMode() { return ($this->behalfGroup ? $this->behalfGroup->tracking_mode : $this->tracking_mode); @@ -189,6 +199,11 @@ class ttUser { return ($this->behalfGroup ? $this->behalfGroup->record_type : $this->record_type); } + // getCurrency returns currency string for active group. + function getCurrency() { + return ($this->behalfGroup ? $this->behalfGroup->currency : $this->currency); + } + // getPlugins returns plugins string for active group. function getPlugins() { return ($this->behalfGroup ? $this->behalfGroup->plugins : $this->plugins); diff --git a/WEB-INF/templates/expenses.tpl b/WEB-INF/templates/expenses.tpl index ed98bb57..8e1ef0a8 100644 --- a/WEB-INF/templates/expenses.tpl +++ b/WEB-INF/templates/expenses.tpl @@ -86,7 +86,7 @@ function recalculateCost() { var comment_control = document.getElementById("item_name"); var cost_control = document.getElementById("cost"); - var replaceDecimalMark = ("." != "{$user->decimal_mark}"); + var replaceDecimalMark = ("." != "{$user->getDecimalMark()}"); // Calculate cost. var dropdown = document.getElementById("predefined_expense"); @@ -102,10 +102,10 @@ function recalculateCost() { else { var expenseCost = defined_expenses[dropdown.selectedIndex - 1][2]; if (replaceDecimalMark) - expenseCost = expenseCost.replace("{$user->decimal_mark}", "."); + expenseCost = expenseCost.replace("{$user->getDecimalMark()}", "."); var newCost = (quantity_control.value * expenseCost).toFixed(2); if (replaceDecimalMark) - newCost = newCost.replace(".", "{$user->decimal_mark}"); + newCost = newCost.replace(".", "{$user->getDecimalMark()}"); cost_control.value = newCost; } } @@ -201,7 +201,7 @@ function recalculateCost() { - +
{$i18n.label.day_total}: {$user->currency|escape} {$day_total}{$i18n.label.day_total}: {$user->getCurrency()|escape} {$day_total}
{/if} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 747f7201..7654f5d8 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4583 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4584 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}