From: Nik Okuntseff Date: Wed, 30 Mar 2016 16:11:57 +0000 (+0000) Subject: Refactoring - using ttPluginEnabled. X-Git-Tag: timetracker_1.19-1~1763 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=c9ab2e84d7c459e4d5e8e946be78c2e49533796e;p=timetracker.git Refactoring - using ttPluginEnabled. --- diff --git a/WEB-INF/lib/ttExpenseHelper.class.php b/WEB-INF/lib/ttExpenseHelper.class.php index 3338e58e..86ccbcd8 100644 --- a/WEB-INF/lib/ttExpenseHelper.class.php +++ b/WEB-INF/lib/ttExpenseHelper.class.php @@ -114,12 +114,12 @@ class ttExpenseHelper { $mdb2 = getConnection(); $client_field = null; - if (in_array('cl', explode(',', $user->plugins))) + if (ttPluginEnabled('cl')) $client_field = ", c.name as client_name"; $left_joins = ""; $left_joins = " left join tt_projects p on (ei.project_id = p.id)"; - if (in_array('cl', explode(',', $user->plugins))) + if (ttPluginEnabled('cl')) $left_joins .= " left join tt_clients c on (ei.client_id = c.id)"; $sql = "select ei.id, ei.date, ei.client_id, ei.project_id, ei.name, ei.cost, ei.invoice_id $client_field, p.name as project_name @@ -165,12 +165,12 @@ class ttExpenseHelper { $mdb2 = getConnection(); $client_field = null; - if (in_array('cl', explode(',', $user->plugins))) + if (ttPluginEnabled('cl')) $client_field = ", c.name as client"; $left_joins = ""; $left_joins = " left join tt_projects p on (ei.project_id = p.id)"; - if (in_array('cl', explode(',', $user->plugins))) + if (ttPluginEnabled('cl')) $left_joins .= " left join tt_clients c on (ei.client_id = c.id)"; $sql = "select ei.id as id $client_field, p.name as project, ei.name as item, ei.cost as cost, diff --git a/WEB-INF/lib/ttInvoiceHelper.class.php b/WEB-INF/lib/ttInvoiceHelper.class.php index aecafbdb..d5068309 100644 --- a/WEB-INF/lib/ttInvoiceHelper.class.php +++ b/WEB-INF/lib/ttInvoiceHelper.class.php @@ -129,7 +129,7 @@ class ttInvoiceHelper { } // If we have expenses, we need to do a union with a separate query for expense items from tt_expense_items table. - if (in_array('ex', explode(',', $user->plugins))) { // if ex(penses) plugin is enabled + if (ttPluginEnabled('ex')) { // if ex(penses) plugin is enabled $sql_for_expense_items = "select ei.date as date, 2 as type, u.name as user_name, p.name as project_name, null as task_name, ei.name as note, null as duration, ei.cost as cost from tt_expense_items ei @@ -336,7 +336,7 @@ class ttInvoiceHelper { foreach($invoice_items as $item) $subtotal += $item['cost']; if ($tax_percent) { - $tax_expenses = in_array('et', explode(',', $user->plugins)); + $tax_expenses = ttPluginEnabled('et'); foreach($invoice_items as $item) { if ($item['type'] == 2 && !$tax_expenses) continue; diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index b815461b..3520dfd9 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -286,7 +286,7 @@ class ttReportHelper { $left_joins .= " left join tt_clients c on (c.id = l.client_id)"; if (($user->canManageTeam() || $user->isClient()) && $bean->getAttribute('chinvoice')) $left_joins .= " left join tt_invoices i on (i.id = l.invoice_id and i.status = 1)"; - if ($user->canManageTeam() || $user->isClient() || in_array('ex', explode(',', $user->plugins))) + if ($user->canManageTeam() || $user->isClient() || ttPluginEnabled('ex')) $left_joins .= " left join tt_users u on (u.id = l.user_id)"; if ($bean->getAttribute('chproject') || 'project' == $group_by_option) $left_joins .= " left join tt_projects p on (p.id = l.project_id)"; @@ -311,7 +311,7 @@ class ttReportHelper { // with an exception of sorting part, that is added in the end. // However, when we have expenses, we need to do a union with a separate query for expense items from tt_expense_items table. - if ($bean->getAttribute('chcost') && in_array('ex', explode(',', $user->plugins))) { // if ex(penses) plugin is enabled + if ($bean->getAttribute('chcost') && ttPluginEnabled('ex')) { // if ex(penses) plugin is enabled $fields = array(); // An array of fields for database query. array_push($fields, 'ei.id'); @@ -492,7 +492,7 @@ class ttReportHelper { $left_joins .= " left join tt_clients c on (c.id = l.client_id)"; if (($user->canManageTeam() || $user->isClient()) && $report['show_invoice']) $left_joins .= " left join tt_invoices i on (i.id = l.invoice_id and i.status = 1)"; - if ($user->canManageTeam() || $user->isClient() || in_array('ex', explode(',', $user->plugins))) + if ($user->canManageTeam() || $user->isClient() || ttPluginEnabled('ex')) $left_joins .= " left join tt_users u on (u.id = l.user_id)"; if ($report['show_project'] || 'project' == $group_by_option) $left_joins .= " left join tt_projects p on (p.id = l.project_id)"; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 5a4923c3..1a1cf38f 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.9.20.3456 | Copyright © Anuko | +  Anuko Time Tracker 1.9.20.3457 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}