From 3c60698710dfd998fd1488c674b944f5df9b0dce Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 7 Dec 2018 15:16:22 +0000 Subject: [PATCH] Adjusted invoice_view.php for subgroups. --- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/invoice_view.tpl | 8 ++++---- invoice_view.php | 22 ++++++++++++++-------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 696890b6..ca4c7a04 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} + {if $show_project} {/if} - {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} + {if $show_task} {/if} @@ -37,10 +37,10 @@ - {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} + {if $show_project} {/if} - {if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} + {if $show_task} {/if} diff --git a/invoice_view.php b/invoice_view.php index 8168c3ad..772500ef 100644 --- a/invoice_view.php +++ b/invoice_view.php @@ -71,20 +71,24 @@ if ($tax_percent > 0) { } $total = $subtotal + $tax; -$smarty->assign('subtotal', $user->currency.' '.str_replace('.', $user->decimal_mark, sprintf('%8.2f', round($subtotal, 2)))); -if ($tax) $smarty->assign('tax', $user->currency.' '.str_replace('.', $user->decimal_mark, sprintf('%8.2f', round($tax, 2)))); -$smarty->assign('total', $user->currency.' '.str_replace('.', $user->decimal_mark, sprintf('%8.2f', round($total, 2)))); +$currency = $user->getCurrency(); +$decimalMark = $user->getDecimalMark(); -if ('.' != $user->decimal_mark) { +$smarty->assign('subtotal', $currency.' '.str_replace('.', $decimalMark, sprintf('%8.2f', round($subtotal, 2)))); +if ($tax) $smarty->assign('tax', $currency.' '.str_replace('.', $decimalMark, sprintf('%8.2f', round($tax, 2)))); +$smarty->assign('total', $currency.' '.str_replace('.', $decimalMark, sprintf('%8.2f', round($total, 2)))); + +if ('.' != $decimalMark) { foreach ($invoice_items as &$item) - $item['cost'] = str_replace('.', $user->decimal_mark, $item['cost']); + $item['cost'] = str_replace('.', $decimalMark, $item['cost']); } // Calculate colspan for invoice summary. $colspan = 4; -if (MODE_PROJECTS == $user->tracking_mode) +$trackingMode = $user->getTrackingMode(); +if (MODE_PROJECTS == $trackingMode) $colspan++; -elseif (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) +elseif (MODE_PROJECTS_AND_TASKS == $trackingMode) $colspan += 2; $form = new Form('invoiceForm'); @@ -117,9 +121,11 @@ if ($request->isPost()) { $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('invoice_id', $cl_invoice_id); $smarty->assign('invoice_name', $invoice['name']); -$smarty->assign('invoice_date', $invoice_date->toString($user->date_format)); +$smarty->assign('invoice_date', $invoice_date->toString($user->getDateFormat())); $smarty->assign('client_name', $client['name']); $smarty->assign('client_address', $client['address']); +$smarty->assign('show_project', MODE_PROJECTS == $trackingMode || MODE_PROJECTS_AND_TASKS == $trackingMode); +$smarty->assign('show_task', MODE_PROJECTS_AND_TASKS == $trackingMode); $smarty->assign('invoice_items', $invoice_items); $smarty->assign('colspan', $colspan); $smarty->assign('title', $i18n->get('title.view_invoice')); -- 2.20.1
 Anuko Time Tracker 1.18.29.4606 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4607 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/invoice_view.tpl b/WEB-INF/templates/invoice_view.tpl index 9faa3bb2..6441b44d 100644 --- a/WEB-INF/templates/invoice_view.tpl +++ b/WEB-INF/templates/invoice_view.tpl @@ -20,10 +20,10 @@
{$i18n.label.date} {$i18n.form.invoice.person}{$i18n.label.project}{$i18n.label.task}{$i18n.label.note}
{$invoice_item.date} {$invoice_item.user_name|escape}{$invoice_item.project_name|escape}{$invoice_item.task_name|escape}{$invoice_item.note|escape}