else
$sql .= 'name ';
- $sql .= "from tt_clients where group_id = ".$user->getActiveGroup().
+ $sql .= "from tt_clients where group_id = ".$user->getGroup().
" and id = $client_id and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$result = array();
$mdb2 = getConnection();
- $sql = "select id, name from tt_clients where group_id = ".$user->getActiveGroup()." and (status = 0 or status = 1) order by upper(name)";
+ $sql = "select id, name from tt_clients where group_id = ".$user->getGroup()." and (status = 0 or status = 1) order by upper(name)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$mdb2 = getConnection();
global $user;
- $sql = "select id from tt_clients where group_id = ".$user->getActiveGroup().
+ $sql = "select id from tt_clients where group_id = ".$user->getGroup().
" and name = ".$mdb2->quote($client_name)." and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
$mdb2 = getConnection();
global $user;
- $sql = "select name, address from tt_clients where group_id = ".$user->getActiveGroup().
+ $sql = "select name, address from tt_clients where group_id = ".$user->getGroup().
" and id = $client_id and status is NULL";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
// Handle invoices.
if ($delete_client_entries) {
- $sql = "update tt_invoices set status = NULL where client_id = $id and group_id = ".$user->getActiveGroup();
+ $sql = "update tt_invoices set status = NULL where client_id = $id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
return false;
// Handle users for client.
- $sql = 'update tt_users set status = NULL'.$modified_part." where client_id = $id and group_id = ".$user->getActiveGroup();
+ $sql = 'update tt_users set status = NULL'.$modified_part." where client_id = $id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
// Mark client deleted.
- $sql = "update tt_clients set status = NULL where id = $id and group_id = ".$user->getActiveGroup();
+ $sql = "update tt_clients set status = NULL where id = $id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
$comma_separated = implode(",", $projects); // This is a comma-separated list of associated project ids.
$sql = "update tt_clients set name = ".$mdb2->quote($name).", address = ".$mdb2->quote($address).
", tax = $tax, projects = ".$mdb2->quote($comma_separated).", status = $status".
- " where group_id = ".$user->getActiveGroup()." and id = ".$id;
+ " where group_id = ".$user->getGroup()." and id = ".$id;
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name from tt_projects p".
" inner join tt_client_project_binds cpb on (cpb.client_id = $client_id and cpb.project_id = p.id)".
- " where p.group_id = ".$user->getActiveGroup()." and p.status = 1 order by p.name";
+ " where p.group_id = ".$user->getGroup()." and p.status = 1 order by p.name";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$mdb2 = getConnection();
$user_id = $user->getActiveUser();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$date = $fields['date'];
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "insert into tt_fav_reports".
global $user;
$mdb2 = getConnection();
- $parent_id = $user->getActiveGroup();
+ $parent_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "select id from tt_groups where parent_id = $parent_id and org_id = $org_id".
global $user;
$mdb2 = getConnection();
- $parent_id = $user->getActiveGroup();
+ $parent_id = $user->getGroup();
$org_id = $user->org_id;
$name = $fields['name'];
$description = $fields['description'];
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "select * from tt_roles".
" where group_id = $group_id and org_id = $org_id and status is not null";
if ($user->isClient()) $client_part = " and client_id = $user->client_id";
$sql = "select * from tt_invoices where id = $invoice_id and group_id = ".
- $user->getActiveGroup()."$client_part and status = 1";
+ $user->getGroup()."$client_part and status = 1";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
if ($val = $res->fetchRow())
global $user;
$sql = "select id from tt_invoices where group_id = ".
- $user->getActiveGroup()." and name = ".$mdb2->quote($invoice_name)." and status = 1";
+ $user->getGroup()." and name = ".$mdb2->quote($invoice_name)." and status = 1";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
- $sql = "update tt_invoices set status = NULL where id = $invoice_id and group_id = ".$user->getActiveGroup();
+ $sql = "update tt_invoices set status = NULL where id = $invoice_id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
// Create a new invoice record.
$sql = "insert into tt_invoices (group_id, org_id, name, date, client_id) values(".
- $user->getActiveGroup().", $user->org_id, ".$mdb2->quote($name).", ".$mdb2->quote($date).", $client_id)";
+ $user->getGroup().", $user->org_id, ".$mdb2->quote($name).", ".$mdb2->quote($date).", $client_id)";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
$sql = "select c.id, c.cron_spec, c.report_id, c.email, c.cc, c.subject, c.report_condition, c.status, fr.name from tt_cron c
left join tt_fav_reports fr on (fr.id = c.report_id)
- where c.id = $id and c.group_id = ".$user->getActiveGroup();
+ where c.id = $id and c.group_id = ".$user->getGroup();
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
$mdb2 = getConnection();
- $sql = "delete from tt_cron where id = $id and group_id = ".$user->getActiveGroup();
+ $sql = "delete from tt_cron where id = $id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$cron_spec = $fields['cron_spec'];
$next = (int) $fields['next'];
$mdb2 = getConnection();
$sql = "select id, name, cost from tt_predefined_expenses
- where id = $id and group_id = ".$user->getActiveGroup();
+ where id = $id and group_id = ".$user->getGroup();
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
$mdb2 = getConnection();
- $sql = "delete from tt_predefined_expenses where id = $id and group_id = ".$user->getActiveGroup();
+ $sql = "delete from tt_predefined_expenses where id = $id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$name = $fields['name'];
$cost = $fields['cost'];
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$predefined_expense_id = (int) $fields['id'];
$name = $fields['name'];
// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name, p.tasks, upb.rate from tt_projects p".
" inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id and upb.status = 1)".
- " where p.group_id = ".$user->getActiveGroup()." and p.status = 1 order by p.name";
+ " where p.group_id = ".$user->getGroup()." and p.status = 1 order by p.name";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$sql = "select p.id, upb.rate from tt_projects p".
" inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id)".
- " where group_id = ".$user->getActiveGroup();
+ " where group_id = ".$user->getGroup();
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$mdb2 = getConnection();
$sql = "select id, name, tasks from tt_projects".
- " where group_id = ".$user->getActiveGroup()." and (status = 0 or status = 1) order by name";
+ " where group_id = ".$user->getGroup()." and (status = 0 or status = 1) order by name";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$sql = "select p.id, p.name, p.tasks from tt_projects p".
" inner join tt_client_project_binds cpb on (cpb.client_id = $user->client_id and cpb.project_id = p.id)".
- " where p.group_id = ".$user->getActiveGroup()." and (p.status = 0 or p.status = 1)".
+ " where p.group_id = ".$user->getGroup()." and (p.status = 0 or p.status = 1)".
" order by p.name";
$res = $mdb2->query($sql);
$mdb2 = getConnection();
$sql = "select id, name, description, status, tasks from tt_projects where id = $id and group_id = ".
- $user->getActiveGroup()." and (status = 0 or status = 1)";
+ $user->getGroup()." and (status = 0 or status = 1)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
global $user;
$sql = "select id from tt_projects where group_id = ".
- $user->getActiveGroup()." and name = ".$mdb2->quote($name).
+ $user->getGroup()." and name = ".$mdb2->quote($name).
" and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
// Start with project itself. Reason: if the passed in project_id is bogus,
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$project_id = $fields['id']; // Project we are updating.
$name = $fields['name']; // Project name.
// Update project name, description, tasks and status in tt_projects table.
$comma_separated = implode(",", $tasks_to_bind); // This is a comma-separated list of associated task ids.
$sql = "update tt_projects set name = ".$mdb2->quote($name).", description = ".$mdb2->quote($description).
- ", tasks = ".$mdb2->quote($comma_separated).", status = $status where id = $project_id and group_id = ".$user->getActiveGroup();
+ ", tasks = ".$mdb2->quote($comma_separated).", status = $status where id = $project_id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
$user_list_part = " and l.user_id in ($userlist)";
else
$user_list_part = " and l.user_id = ".$user->id;
- $user_list_part .= " and l.group_id = ".$user->getActiveGroup();
+ $user_list_part .= " and l.group_id = ".$user->getGroup();
// Prepare sql query part for where.
if ($options['period'])
$user_list_part = " and ei.user_id in ($userlist)";
else
$user_list_part = " and ei.user_id = ".$user->id;
- $user_list_part .= " and ei.group_id = ".$user->getActiveGroup();
+ $user_list_part .= " and ei.group_id = ".$user->getGroup();
// Prepare sql query part for where.
if ($options['period'])
// Add custom field.
$include_cf_1 = $options['show_custom_field_1'] || $grouping_by_cf_1;
if ($include_cf_1) {
- $custom_fields = new CustomFields($user->getActiveGroup());
+ $custom_fields = new CustomFields($user->getGroup());
$cf_1_type = $custom_fields->fields[0]['type'];
if ($cf_1_type == CustomFields::TYPE_TEXT) {
array_push($fields, 'cfl.value as cf_1');
// Use custom fields plugin if it is enabled.
if ($user->isPluginEnabled('cf'))
- $custom_fields = new CustomFields($user->getActiveGroup());
+ $custom_fields = new CustomFields($user->getGroup());
// Define some styles to use in email.
$style_title = 'text-align: center; font-size: 15pt; font-family: Arial, Helvetica, sans-serif;';
$join .= ' left join tt_tasks t on (l.task_id = t.id)';
}
if (ttReportHelper::groupingBy('cf_1', $options)) {
- $custom_fields = new CustomFields($user->getActiveGroup());
+ $custom_fields = new CustomFields($user->getGroup());
if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_TEXT)
$join .= ' left join tt_custom_field_log cfl on (l.id = cfl.log_id and cfl.status = 1) left join tt_custom_field_options cfo on (cfl.value = cfo.id)';
elseif ($custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN)
$mdb2 = getConnection();
$sql = "select id, name, description, rank, rights, status from tt_roles
- where id = $id and group_id = ".$user->getActiveGroup()." and (status = 0 or status = 1)";
+ where id = $id and group_id = ".$user->getGroup()." and (status = 0 or status = 1)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$mdb2 = getConnection();
global $user;
- $sql = "select id from tt_roles where group_id = ".$user->getActiveGroup().
+ $sql = "select id from tt_roles where group_id = ".$user->getGroup().
" and name = ".$mdb2->quote($role_name)." and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
global $user;
$mdb2 = getConnection();
- $sql = "select rights from tt_roles where group_id = ".$user->getActiveGroup()." and id = $role_id";
+ $sql = "select rights from tt_roles where group_id = ".$user->getGroup()." and id = $role_id";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$id = (int)$fields['id'];
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
// Mark the task as deleted.
function __construct($user_id) {
global $user;
$this->user_id = $user_id; // TODO: review "on behalf" situation and refactor if necessary.
- $this->group_id = $user->getActiveGroup();
+ $this->group_id = $user->getGroup();
$this->org_id = $user->org_id;
$this->mdb2 = getConnection();
}
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$task_id = (int)$fields['task_id'];
$name = $fields['name'];
global $i18n;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
if (isset($options['getAllFields']))
$result = array();
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $user->rank and status = 1 order by rank";
$result = array();
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $user->rank and status = 0 order by rank";
}
}
+ // The getGroup returns group id on behalf of which the current user is operating.
+ function getGroup() {
+ return ($this->behalfGroup ? $this->behalfGroup->id : $this->group_id);
+ }
+
// getDecimalMark returns decimal mark for active group.
function getDecimalMark() {
return ($this->behalfGroup ? $this->behalfGroup->decimal_mark : $this->decimal_mark);
return ($this->behalf_id ? $this->behalf_id : $this->id);
}
- // The getActiveGroup returns group id on behalf of which the current user is operating.
- function getActiveGroup() {
- return ($this->behalf_group_id ? $this->behalf_group_id : $this->group_id);
- }
-
// can - determines whether user has a right to do something.
function can($do_something) {
return in_array($do_something, $this->rights);
function getUsers($options) {
$mdb2 = getConnection();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$org_id = $this->org_id;
$skipClients = !isset($options['include_clients']);
// Start with subgroups.
$groups = array();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$sql = "select id, name from tt_groups where org_id = $this->org_id and parent_id = $group_id and status = 1";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
function getSubgroups($group_id = null) {
$mdb2 = getConnection();
- if (!$group_id) $group_id = $this->getActiveGroup();
+ if (!$group_id) $group_id = $this->getGroup();
$sql = "select id, name, description from tt_groups where org_id = $this->org_id".
" and parent_id = $group_id and status is not null order by upper(name)";
if (!$this->can('manage_users')) return false;
$mdb2 = getConnection();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$org_id = $this->org_id;
$sql = "select u.id, u.name, u.login, u.role_id, u.client_id, u.status, u.rate, u.email from tt_users u".
if ($group_id && !$this->isGroupValid($group_id)) return false;
$mdb2 = getConnection();
- if (!$group_id) $group_id = $this->getActiveGroup();
+ if (!$group_id) $group_id = $this->getGroup();
if (isset($fields['name'])) $name_part = ', name = '.$mdb2->quote($fields['name']);
if (isset($fields['description'])) $description_part = ', description = '.$mdb2->quote($fields['description']);
if (!$user_details) return false;
$mdb2 = getConnection();
- $group_id = $this->getActiveGroup();
+ $group_id = $this->getGroup();
$org_id = $this->org_id;
// Mark user to project binds as deleted.
ttUserHelper::insertBind(array(
'user_id' => $user_id,
'project_id' => $project_id,
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'rate' => $rate,
'status' => ACTIVE));
$mdb2 = getConnection();
// This may be used during import. Use the following until we have import refactored.
- $group_id = $fields['group_id'] ? (int) $fields['group_id'] : $user->getActiveGroup();
+ $group_id = $fields['group_id'] ? (int) $fields['group_id'] : $user->getGroup();
$org_id = $fields['org_id'] ? (int) $fields['org_id'] : $user->org_id;
$user_id = (int) $fields['user_id'];
// Prepare an array of fields for regular insert function.
$fields4insert = array();
$fields4insert['user_id'] = $user->getActiveUser();
- $fields4insert['group_id'] = $user->getActiveGroup();
+ $fields4insert['group_id'] = $user->getGroup();
$fields4insert['org_id'] = $user->org_id;
$fields4insert['date'] = $entry_date;
$fields4insert['duration'] = $fields['duration'];
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.28.4520 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.28.4521 | 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>
if ($err->no()) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'address' => $cl_address,
if ($request->getParameter('btn_copy')) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'address' => $cl_address,
$user->setOnBehalfGroup($group_id);
}
-if (!$group_id) $group_id = $user->getActiveGroup();
+if (!$group_id) $group_id = $user->getGroup();
$groups = $user->getGroupsForDropdown();
$group = ttGroupHelper::getGroupAttrs($group_id);
$config = new ttConfigHelper($group['config']);
$group_id = $request->getParameter('group');
$user->setOnBehalfGroup($group_id);
} else {
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
}
$form = new Form('subgroupsForm');
if ($err->no()) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'address' => $cl_address,
if ($request->getParameter('btn_copy')) {
if (!ttClientHelper::getClientByName($cl_name)) {
if (ttClientHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'address' => $cl_address,
if ($err->no()) {
if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
if ($request->getParameter('btn_copy')) {
if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
if ($err->no()) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
if ($request->getParameter('btn_copy')) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'client' => $cl_client,
'project' => $cl_project,
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'client' => $cl_client,
'project' => $cl_project,
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "insert into tt_custom_field_log (group_id, org_id, log_id, field_id, option_id, value)".
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
// Check if the option exists.
static function insertField($field_name, $field_type, $required) {
global $user;
$mdb2 = getConnection();
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
$org_id = $user->org_id;
$sql = "insert into tt_custom_fields (group_id, org_id, type, label, required, status)".
" values($group_id, $org_id, $field_type, ".$mdb2->quote($field_name).", $required, 1)";
function __construct() {
$this->db = getConnection();
global $user;
- $this->group_id = $user->getActiveGroup();
+ $this->group_id = $user->getGroup();
$this->org_id = $user->org_id;
}
foreach ($users as $user_item)
$all_users[$user_item['id']] = $user_item['name'];
-$tasks = ttTeamHelper::getActiveTasks($user->getActiveGroup());
+$tasks = ttTeamHelper::getActiveTasks($user->getGroup());
foreach ($tasks as $task_item)
$all_tasks[$task_item['id']] = $task_item['name'];
if ($err->no()) {
if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
foreach ($users as $user_item)
$all_users[$user_item['id']] = $user_item['name'];
-$tasks = ttTeamHelper::getActiveTasks($user->getActiveGroup());
+$tasks = ttTeamHelper::getActiveTasks($user->getGroup());
foreach ($tasks as $task_item)
$all_tasks[$task_item['id']] = $task_item['name'];
if ($request->getParameter('btn_copy')) {
if (!ttProjectHelper::getProjectByName($cl_name)) {
if (ttProjectHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
exit();
}
} else {
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
}
$form = new Form('projectsForm');
if ($err->no()) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
if ($request->getParameter('btn_copy')) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
$id = ttTimeHelper::insert(array(
'date' => $cl_date,
'user_id' => $user->getActiveUser(),
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'client' => $cl_client,
'project' => $cl_project,
$id = ttTimeHelper::insert(array(
'date'=>$new_date->toString(DB_DATEFORMAT),
'user_id'=>$user->getActiveUser(),
- 'group_id'=>$user->getActiveGroup(),
+ 'group_id'=>$user->getGroup(),
'org_id' => $user->org_id,
'client'=>$cl_client,
'project'=>$cl_project,
@include('plugins/limit/user_add.php');
if ($user->isPluginEnabled('cl'))
- $clients = ttTeamHelper::getActiveClients($user->getActiveGroup());
+ $clients = ttTeamHelper::getActiveClients($user->getGroup());
$assigned_projects = array();
if ($request->isPost()) {
$form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate));
-$projects = ttTeamHelper::getActiveProjects($user->getActiveGroup());
+$projects = ttTeamHelper::getActiveProjects($user->getGroup());
// Define classes for the projects table.
class NameCellRenderer extends DefaultCellRenderer {
'login' => $cl_login,
'password' => $cl_password1,
'rate' => $cl_rate,
- 'group_id' => $user->getActiveGroup(),
+ 'group_id' => $user->getGroup(),
'org_id' => $user->org_id,
'role_id' => $cl_role_id,
'client_id' => $cl_client_id,
// End of access checks.
if ($user->isPluginEnabled('cl'))
- $clients = ttTeamHelper::getActiveClients($user->getActiveGroup());
+ $clients = ttTeamHelper::getActiveClients($user->getGroup());
-$projects = ttTeamHelper::getActiveProjects($user->getActiveGroup());
+$projects = ttTeamHelper::getActiveProjects($user->getGroup());
$assigned_projects = array();
if ($request->isPost()) {
$group_id = $request->getParameter('group');
$user->setOnBehalfGroup($group_id);
} else {
- $group_id = $user->getActiveGroup();
+ $group_id = $user->getGroup();
}
$form = new Form('usersForm');