// 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');
// 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;
// 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;
$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.
$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.
<td width="25%">{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}<label>{$forms.reportForm.chproject.control} {$i18n.label.project}</label>{/if}</td>
<td width="25%">{if (($smarty.const.TYPE_START_FINISH == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}<label>{$forms.reportForm.chstart.control} {$i18n.label.start}</label>{/if}</td>
<td width="25%"><label>{$forms.reportForm.chduration.control} {$i18n.label.duration}</label></td>
-{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))}
<td width="25%"><label>{$forms.reportForm.chcost.control} {$i18n.label.cost}</label></td>
{else}
<td></td>