return true;
}
-
-// ttPluginEnabled is used to check whether a plugin is enabled for user.
-function ttPluginEnabled($plugin)
-{
- global $user;
- return in_array($plugin, explode(',', $user->plugins));
-}
// getItem - retrieves an entry from tt_expense_items table.
static function getItem($id, $user_id) {
- global $user;
+ global $user;
$mdb2 = getConnection();
$client_field = null;
- if (ttPluginEnabled('cl'))
+ if ($user->isPluginEnabled('cl'))
$client_field = ", c.name as client_name";
$left_joins = "";
$left_joins = " left join tt_projects p on (ei.project_id = p.id)";
- if (ttPluginEnabled('cl'))
+ if ($user->isPluginEnabled('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
// getItems - returns expense items for a user for a given date.
static function getItems($user_id, $date) {
- global $user;
+ global $user;
$result = array();
$mdb2 = getConnection();
$client_field = null;
- if (ttPluginEnabled('cl'))
+ if ($user->isPluginEnabled('cl'))
$client_field = ", c.name as client";
$left_joins = "";
$left_joins = " left join tt_projects p on (ei.project_id = p.id)";
- if (ttPluginEnabled('cl'))
+ if ($user->isPluginEnabled('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,
}
// If we have expenses, we need to do a union with a separate query for expense items from tt_expense_items table.
- if (ttPluginEnabled('ex')) { // if ex(penses) plugin is enabled
+ if ($user->isPluginEnabled('ex')) {
$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
foreach($invoice_items as $item)
$subtotal += $item['cost'];
if ($tax_percent) {
- $tax_expenses = ttPluginEnabled('et');
+ $tax_expenses = $user->isPluginEnabled('et');
foreach($invoice_items as $item) {
if ($item['type'] == 2 && !$tax_expenses)
continue;
$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() || ttPluginEnabled('ex'))
+ 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') && ttPluginEnabled('ex')) { // 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() || ttPluginEnabled('ex'))
+ 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)";
var $name = null; // User name.
var $id = null; // User id.
var $team_id = null; // Team id.
- var $role = null; // User role (user, client, comanager, manager, admin).
- var $client_id = null; // Client id for client user role.
+ var $role = null; // User role (user, client, comanager, manager, admin).
+ var $client_id = null; // Client id for client user role.
var $behalf_id = null; // User id, on behalf of whom we are working.
var $behalf_name = null; // User name, on behalf of whom we are working.
var $email = null; // User email.
var $record_type = 0; // Record type (duration vs start and finish, or both).
var $currency = null; // Currency.
var $plugins = null; // Comma-separated list of enabled plugins.
- var $team = null; // Team name.
+ var $team = null; // Team name.
var $custom_logo = 0; // Whether to use a custom logo for team.
- var $address = null; // Address for invoices.
- var $lock_interval = 0; // Lock interval in days for time records.
+ var $address = null; // Address for invoices.
+ var $lock_interval = 0; // Lock interval in days for time records.
var $rights = 0; // A mask of user rights.
// Constructor.
return (right_manage_team & $this->role);
}
+ // isPluginEnabled checks whether a plugin is enabled for user.
+ function isPluginEnabled($plugin)
+ {
+ return in_array($plugin, explode(',', $this->plugins));
+ }
+
// getAssignedProjects - returns an array of assigned projects.
function getAssignedProjects()
{
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.9.20.3457 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.9.20.3458 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
$_SESSION['date'] = $cl_date;
// Use custom fields plugin if it is enabled.
-if (ttPluginEnabled('cf')) {
+if ($user->isPluginEnabled('cf')) {
require_once('plugins/CustomFields.class.php');
$custom_fields = new CustomFields($user->team_id);
$smarty->assign('custom_fields', $custom_fields);