else
$sql .= 'name ';
- $sql .= "from tt_clients where group_id = $user->group_id
- and id = $client_id and (status = 1 or status = 0)";
+ $sql .= "from tt_clients where group_id = ".$user->getActiveGroup().
+ " and id = $client_id and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
return false;
}
- // getClients - returns an array of active and inactive clients in a team.
+ // getClients - returns an array of active and inactive clients in a group.
static function getClients()
{
global $user;
$result = array();
$mdb2 = getConnection();
- $sql = "select id, name from tt_clients
- where group_id = $user->group_id and (status = 0 or status = 1) order by upper(name)";
+ $sql = "select id, name from tt_clients where group_id = ".$user->getActiveGroup()." 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->group_id and name = ".
- $mdb2->quote($client_name)." and (status = 1 or status = 0)";
+ $sql = "select id from tt_clients where group_id = ".$user->getActiveGroup().
+ " and name = ".$mdb2->quote($client_name)." and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$mdb2 = getConnection();
global $user;
- $sql = "select name, address from tt_clients where group_id = $user->group_id
- and id = $client_id and status is NULL";
+ $sql = "select name, address from tt_clients where group_id = ".$user->getActiveGroup().
+ " and id = $client_id and status is NULL";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
return (!is_a($affected, 'PEAR_Error'));
}
- // The setMappedClient function is used during team import to change client_id value for tt_users to a mapped value.
+ // 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();