$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() || $user->isPluginEnabled('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)";
// 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') && $user->isPluginEnabled('ex')) { // if ex(penses) plugin is enabled
$fields = array(); // An array of fields for database query.
array_push($fields, 'ei.id');
$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() || $user->isPluginEnabled('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)";
// 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.
$totals = ttReportHelper::getTotals($bean);
// Use custom fields plugin if it is enabled.
- if (in_array('cf', explode(',', $user->plugins)))
+ if ($user->isPluginEnabled('cf'))
$custom_fields = new CustomFields($user->team_id);
// Define some styles to use in email.
$totals = ttReportHelper::getFavTotals($report);
// Use custom fields plugin if it is enabled.
- if (in_array('cf', explode(',', $user->plugins)))
+ if ($user->isPluginEnabled('cf'))
$custom_fields = new CustomFields($user->team_id);
// Define some styles to use in email.