From: Nik Okuntseff Date: Wed, 30 Mar 2016 16:44:47 +0000 (+0000) Subject: Work in progress switching to ttUser::isPluginEnabled(). X-Git-Tag: timetracker_1.19-1~1761 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=05e0f5266a2959a452adfcae9d53c9729d3a3668;p=timetracker.git Work in progress switching to ttUser::isPluginEnabled(). --- diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index 9d0fc87f..b4557f14 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -517,7 +517,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 ($report['show_cost'] && in_array('ex', explode(',', $user->plugins))) { // if ex(penses) plugin is enabled + if ($report['show_cost'] && $user->isPluginEnabled('ex')) { // if ex(penses) plugin is enabled $fields = array(); // An array of fields for database query. array_push($fields, 'ei.id'); @@ -697,7 +697,7 @@ class ttReportHelper { // By now we have sql for time items. // 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') && $user->isPluginEnabled('ex')) { // if ex(penses) plugin is enabled // Determine group by field and a required join. $group_join = null; @@ -825,7 +825,7 @@ class ttReportHelper { // By now we have sql for time items. // However, when we have expenses, we need to do a union with a separate query for expense items from tt_expense_items table. - if ($report['show_cost'] && in_array('ex', explode(',', $user->plugins))) { // if ex(penses) plugin is enabled + if ($report['show_cost'] && $user->isPluginEnabled('ex')) { // if ex(penses) plugin is enabled // Determine group by field and a required join. $group_join = null; @@ -912,7 +912,7 @@ class ttReportHelper { $sql = "select sum(time_to_sec(l.duration)) as time, null as cost, null as expenses from tt_log l $where"; // If we have expenses, query becomes a bit more complex. - if ($bean->getAttribute('chcost') && in_array('ex', explode(',', $user->plugins))) { + if ($bean->getAttribute('chcost') && $user->isPluginEnabled('ex')) { $where = ttReportHelper::getExpenseWhere($bean); $sql_for_expenses = "select null as time, sum(cost) as cost, sum(cost) as expenses from tt_expense_items ei $where"; // Create a combined query. @@ -982,7 +982,7 @@ class ttReportHelper { $sql = "select sum(time_to_sec(l.duration)) as time, null as cost, null as expenses from tt_log l $where"; // If we have expenses, query becomes a bit more complex. - if ($report['show_cost'] && in_array('ex', explode(',', $user->plugins))) { + if ($report['show_cost'] && $user->isPluginEnabled('ex')) { $where = ttReportHelper::getFavExpenseWhere($report); $sql_for_expenses = "select null as time, sum(cost) as cost, sum(cost) as expenses from tt_expense_items ei $where"; // Create a combined query. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index b1b27b00..3203e5de 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- -{if ((($user->canManageTeam() || $user->isClient()) || in_array('ex', explode(',', $user->plugins))) && defined('COST_ON_REPORTS') && isTrue($smarty.const.COST_ON_REPORTS))} +{if ((($user->canManageTeam() || $user->isClient()) || $user->isPluginEnabled('ex')) && defined('COST_ON_REPORTS') && isTrue($smarty.const.COST_ON_REPORTS))} {else}
 Anuko Time Tracker 1.9.20.3458 | Copyright © Anuko | +  Anuko Time Tracker 1.9.20.3459 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/header.tpl b/WEB-INF/templates/header.tpl index 3affffc1..4d08cfc1 100644 --- a/WEB-INF/templates/header.tpl +++ b/WEB-INF/templates/header.tpl @@ -101,7 +101,7 @@ With 101% height we essentially force the scrollbar to always appear. --> {if !$user->isClient()} {$i18n.menu.time} {/if} - {if in_array('ex', explode(',', $user->plugins)) && !$user->isClient()} + {if $user->isPluginEnabled('ex') && !$user->isClient()} · {$i18n.menu.expenses} {/if} {if !$user->isClient()}· {/if}{$i18n.menu.reports} diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl index 2f75835d..696142bf 100644 --- a/WEB-INF/templates/reports.tpl +++ b/WEB-INF/templates/reports.tpl @@ -250,7 +250,7 @@ function handleCheckboxes() { {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}{/if} {if (($smarty.const.TYPE_START_FINISH == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}{/if}