From: Nik Okuntseff Date: Wed, 5 Dec 2018 19:31:43 +0000 (+0000) Subject: Refactored regular expense pages for subgroups. X-Git-Tag: timetracker_1.19-1~472 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=cb611bf2abbb4072459632155b11301ae6fe840b;p=timetracker.git Refactored regular expense pages for subgroups. --- diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index 4411fb58..0e9ff9e4 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -226,7 +226,7 @@ function ttValidFloat($val, $emptyValid = false) return ($emptyValid ? true : false); global $user; - $decimal = $user->decimal_mark; + $decimal = $user->getDecimalMark(); if (!preg_match('/^-?[0-9'.$decimal.']+$/', $val)) return false; diff --git a/WEB-INF/lib/ttExpenseHelper.class.php b/WEB-INF/lib/ttExpenseHelper.class.php index 0b202c6b..40a3e88f 100644 --- a/WEB-INF/lib/ttExpenseHelper.class.php +++ b/WEB-INF/lib/ttExpenseHelper.class.php @@ -60,12 +60,12 @@ class ttExpenseHelper { global $user; $mdb2 = getConnection(); + $user_id = $user->getUser(); $group_id = $user->getGroup(); $org_id = $user->org_id; $id = (int) $fields['id']; $date = $fields['date']; - $user_id = (int) $fields['user_id']; $client_id = $fields['client_id']; $project_id = $fields['project_id']; $name = $fields['name']; diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index 1d1b178a..0d628f6d 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -189,7 +189,7 @@ class ttUserHelper { // otherwise de-activate the bind (set its status to inactive). This will keep the bind // and its rate in database for reporting. - $all_projects = ttTeamHelper::getAllProjects($user->group_id); + $all_projects = ttTeamHelper::getAllProjects($user->getGroup()); $assigned_projects = isset($fields['projects']) ? $fields['projects'] : array(); foreach($all_projects as $p) { diff --git a/WEB-INF/templates/expense_edit.tpl b/WEB-INF/templates/expense_edit.tpl index d3a27375..850e6442 100644 --- a/WEB-INF/templates/expense_edit.tpl +++ b/WEB-INF/templates/expense_edit.tpl @@ -98,7 +98,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"); @@ -114,10 +114,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; } } @@ -138,7 +138,7 @@ function recalculateCost() { {$forms.expenseItemForm.client.control} {/if} -{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} +{if $show_project} {$i18n.label.project} (*): {$forms.expenseItemForm.project.control} @@ -160,7 +160,7 @@ function recalculateCost() { {$i18n.label.cost}: - {$forms.expenseItemForm.cost.control} {$user->currency|escape} + {$forms.expenseItemForm.cost.control} {$user->getCurrency()|escape} {if ($user->can('manage_invoices') && $user->isPluginEnabled('ps'))} diff --git a/WEB-INF/templates/expenses.tpl b/WEB-INF/templates/expenses.tpl index 4eea0b8d..45a8ef27 100644 --- a/WEB-INF/templates/expenses.tpl +++ b/WEB-INF/templates/expenses.tpl @@ -151,7 +151,7 @@ function recalculateCost() { {$i18n.label.cost} (*): - {$forms.expensesForm.cost.control} {$user->currency|escape} + {$forms.expensesForm.cost.control} {$user->getCurrency()|escape} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 99e8d0ee..20a0db7c 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4592 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4593 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/expense_edit.php b/expense_edit.php index 667d0346..8eb7d4fe 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -194,7 +194,7 @@ if ($request->isPost()) { // Now, an update. if ($err->no()) { - if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getUser(), + if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT), 'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost,'paid'=>$cl_paid))) { header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT)); exit(); @@ -229,11 +229,12 @@ if ($confirm_save) { $smarty->assign('confirm_save', true); $smarty->assign('entry_date', $cl_date); } +$smarty->assign('forms', array($form->getName()=>$form->toArray())); +$smarty->assign('show_project', $show_project); $smarty->assign('predefined_expenses', $predefined_expenses); $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); $smarty->assign('task_list', $task_list); -$smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('title', $i18n->get('title.edit_expense')); $smarty->assign('content_page_name', 'expense_edit.tpl'); $smarty->display('index.tpl');