From: Nik Okuntseff Date: Wed, 30 Mar 2016 16:59:35 +0000 (+0000) Subject: Work in progress switching to ttUser::isPluginEnabled(). X-Git-Tag: timetracker_1.19-1~1760 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2a998c95dd9e86a9ad57939b056b62cab7402b08;p=timetracker.git Work in progress switching to ttUser::isPluginEnabled(). --- diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 83f7968e..29b74145 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -615,12 +615,12 @@ class ttTimeHelper { $mdb2 = getConnection(); $client_field = null; - if (in_array('cl', explode(',', $user->plugins))) + if ($user->isPluginEnabled('cl')) $client_field = ", c.name as client"; $left_joins = " left join tt_projects p on (l.project_id = p.id)". " left join tt_tasks t on (l.task_id = t.id)"; - if (in_array('cl', explode(',', $user->plugins))) + if ($user->isPluginEnabled('cl')) $left_joins .= " left join tt_clients c on (l.client_id = c.id)"; $sql = "select l.id as id, TIME_FORMAT(l.start, $sql_time_format) as start, diff --git a/WEB-INF/templates/expense_delete.tpl b/WEB-INF/templates/expense_delete.tpl index fd5dc4eb..d6fda794 100644 --- a/WEB-INF/templates/expense_delete.tpl +++ b/WEB-INF/templates/expense_delete.tpl @@ -4,7 +4,7 @@ -{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} {/if} @@ -15,7 +15,7 @@ -{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} {/if} {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} diff --git a/WEB-INF/templates/expense_edit.tpl b/WEB-INF/templates/expense_edit.tpl index 5f4a4e46..4c921299 100644 --- a/WEB-INF/templates/expense_edit.tpl +++ b/WEB-INF/templates/expense_edit.tpl @@ -76,7 +76,7 @@ function get_date() {
{$i18n.label.client}{$i18n.label.cost}
{$expense_item.client_name|escape:'html'}
-{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} diff --git a/WEB-INF/templates/expenses.tpl b/WEB-INF/templates/expenses.tpl index cfc1fe67..a64fbc26 100644 --- a/WEB-INF/templates/expenses.tpl +++ b/WEB-INF/templates/expenses.tpl @@ -79,7 +79,7 @@ function get_date() { {/if} -{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} @@ -121,7 +121,7 @@ function get_date() { {if $expense_items}
{$i18n.label.client} {if in_array('cm', explode(',', $user->plugins))}(*){/if}: {$forms.expenseItemForm.client.control}{$forms.expensesForm.onBehalfUser.control}
{$i18n.label.client}{if in_array('cm', explode(',', $user->plugins))} (*){/if}: {$forms.expensesForm.client.control}
- {if in_array('cl', explode(',', $user->plugins))} + {if $user->isPluginEnabled('cl')} {/if} {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} @@ -133,7 +133,7 @@ function get_date() { {foreach $expense_items as $item} - {if in_array('cl', explode(',', $user->plugins))} + {if $user->isPluginEnabled('cl')} {/if} {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)} diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 3203e5de..6e45a438 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
{$i18n.label.client}
{$item.client|escape:'html'}
-
 Anuko Time Tracker 1.9.20.3459 | Copyright © Anuko | +  Anuko Time Tracker 1.9.20.3460 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/mobile/time.tpl b/WEB-INF/templates/mobile/time.tpl index 8c11af27..4371be29 100644 --- a/WEB-INF/templates/mobile/time.tpl +++ b/WEB-INF/templates/mobile/time.tpl @@ -250,7 +250,7 @@ function get_date() {
-{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} {/if} diff --git a/WEB-INF/templates/mobile/time_edit.tpl b/WEB-INF/templates/mobile/time_edit.tpl index 729d3ce9..2dbd7460 100644 --- a/WEB-INF/templates/mobile/time_edit.tpl +++ b/WEB-INF/templates/mobile/time_edit.tpl @@ -210,7 +210,7 @@ function get_date() {
{$i18n.label.client}:
{$forms.timeRecordForm.client.control}
-{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} {/if} diff --git a/WEB-INF/templates/mobile/timer.tpl b/WEB-INF/templates/mobile/timer.tpl index bd6bf8b8..b32da743 100644 --- a/WEB-INF/templates/mobile/timer.tpl +++ b/WEB-INF/templates/mobile/timer.tpl @@ -217,7 +217,7 @@ startTimer();
{$i18n.label.client}:
{$forms.timeRecordForm.client.control}
-{if in_array('cl', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl')} {/if} diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl index 696142bf..b5db6d3b 100644 --- a/WEB-INF/templates/reports.tpl +++ b/WEB-INF/templates/reports.tpl @@ -167,9 +167,9 @@ function handleCheckboxes() {
{$i18n.label.client}:
{$forms.timerRecordForm.client.control}
-{if ((in_array('cl', explode(',', $user->plugins)) && !($user->isClient() && $user->client_id)) || ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN))} +{if (($user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id)) || ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN))} - {if in_array('cl', explode(',', $user->plugins)) && !($user->isClient() && $user->client_id)}{else}{/if} + {if $user->isPluginEnabled('cl') && !($user->isClient() && $user->client_id)}{else}{/if} {if ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN)}{else}{/if} @@ -236,9 +236,9 @@ function handleCheckboxes() {
{$i18n.label.client} {$i18n.label.client}  {$i18n.label.option} 
-{if in_array('cl', explode(',', $user->plugins)) || in_array('iv', explode(',', $user->plugins))} +{if $user->isPluginEnabled('cl') || in_array('iv', explode(',', $user->plugins))} - {if in_array('cl', explode(',', $user->plugins))} + {if $user->isPluginEnabled('cl')} {/if} {if ($user->canManageTeam() || $user->isClient()) && in_array('iv', explode(',', $user->plugins))} diff --git a/user_edit.php b/user_edit.php index 1d588e8e..0dc7afb3 100644 --- a/user_edit.php +++ b/user_edit.php @@ -58,7 +58,7 @@ if (!$ok_to_go) { die ($i18n->getKey('error.sys')); } -if (in_array('cl', explode(',', $user->plugins))) +if ($user->isPluginEnabled('cl')) $clients = ttTeamHelper::getActiveClients($user->team_id); $projects = ttTeamHelper::getActiveProjects($user->team_id); @@ -114,10 +114,10 @@ $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'email','style'= $roles[ROLE_USER] = $i18n->getKey('label.user'); $roles[ROLE_COMANAGER] = $i18n->getKey('form.users.comanager'); -if (in_array('cl', explode(',', $user->plugins))) +if ($user->isPluginEnabled('cl')) $roles[ROLE_CLIENT] = $i18n->getKey('label.client'); $form->addInput(array('type'=>'combobox','onchange'=>'handleClientControl()','name'=>'role','value'=>$cl_role,'data'=>$roles)); -if (in_array('cl', explode(',', $user->plugins))) +if ($user->isPluginEnabled('cl')) $form->addInput(array('type'=>'combobox','name'=>'client','value'=>$cl_client_id,'data'=>$clients,'datakeys'=>array('id', 'name'),'empty'=>array(''=>$i18n->getKey('dropdown.select')))); $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status,