return (!is_a($affected, 'PEAR_Error'));
}
- // The setMappedClient function is used during group import to change client_id value for tt_users to a mapped value.
- static function setMappedClient($group_id, $imported_id, $mapped_id)
- {
- $mdb2 = getConnection();
- $sql = "update tt_users set client_id = $mapped_id where client_id = $imported_id and group_id = $group_id ";
- $affected = $mdb2->exec($sql);
- if (is_a($affected, 'PEAR_Error'))
- return false;
-
- return true;
- }
-
// The fillBean function fills the ActionForm object with client data.
static function fillBean($client_id, &$bean) {
$client = ttClientHelper::getClient($client_id, true);
}
return $roles;
}
+
+ // The getActiveClients returns an array of active clients for a group.
+ static function getActiveClients($all_fields = false)
+ {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+ if ($all_fields)
+ $sql = "select * from tt_clients where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)";
+ else
+ $sql = "select id, name from tt_clients where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)";
+
+ $res = $mdb2->query($sql);
+ $result = array();
+ if (!is_a($res, 'PEAR_Error')) {
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ }
+ return $result;
+ }
+
+ // The getInactiveClients returns an array of inactive clients for a group.
+ static function getInactiveClients($all_fields = false)
+ {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+ if ($all_fields)
+ $sql = "select * from tt_clients where group_id = $group_id and org_id = $org_id and status = 0 order by upper(name)";
+ else
+ $sql = "select id, name from tt_clients where group_id = $group_id and org_id = $org_id and status = 0 order by upper(name)";
+
+ $res = $mdb2->query($sql);
+ $result = array();
+ if (!is_a($res, 'PEAR_Error')) {
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ }
+ return $result;
+ }
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.29.4557 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.29.4559 | 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>
require_once('initialize.php');
import('form.Form');
import('ttTeamHelper');
+import('ttGroupHelper');
// Access checks.
if (!(ttAccessAllowed('view_own_clients') || ttAccessAllowed('manage_clients'))) {
}
if($user->can('manage_clients')) {
- $active_clients = ttTeamHelper::getActiveClients($user->getGroup(), true);
- $inactive_clients = ttTeamHelper::getInactiveClients($user->getGroup(), true);
+ $active_clients = ttGroupHelper::getActiveClients(true);
+ $inactive_clients = ttGroupHelper::getInactiveClients(true);
} else
$active_clients = $user->getAssignedClients();