if (!$val['id'] || !$val['role_id'])
return false;
- $modified_part = ', modified = now(), modified_ip = '.$mdb2->quote($_SERVER['REMOTE_ADDR']).', modified_by = '.$mdb2->quote($user->id);
+ $modified_part = ', modified = now(), modified_ip = '.$mdb2->quote($_SERVER['REMOTE_ADDR']).', modified_by = '.$user->id;
// Promote user.
$sql = "update tt_users set role_id = $user->role_id".$modified_part." where id = $user_id and group_id = $user->group_id";
return false;
}
- // getActiveProjects - returns an array of active projects for a group.
- static function getActiveProjects($group_id)
- {
- $result = array();
- $mdb2 = getConnection();
-
- $sql = "select id, name, description, tasks from tt_projects
- where group_id = $group_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;
- }
-
- // getInactiveProjects - returns an array of inactive projects for a group.
- static function getInactiveProjects($group_id)
- {
- $result = array();
- $mdb2 = getConnection();
-
- $sql = "select id, name, description, tasks from tt_projects
- where group_id = $group_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;
- }
-
// The getAllProjects obtains all projects in a group.
static function getAllProjects($group_id, $all_fields = false) {
$mdb2 = getConnection();
return $result;
}
- // The getActiveClients returns an array of active clients for a group.
- static function getActiveClients($group_id, $all_fields = false)
- {
- $result = array();
- $mdb2 = getConnection();
-
- if ($all_fields)
- $sql = "select * from tt_clients where group_id = $group_id and status = 1 order by upper(name)";
- else
- $sql = "select id, name from tt_clients where group_id = $group_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($group_id, $all_fields = false)
- {
- $result = array();
- $mdb2 = getConnection();
-
- if ($all_fields)
- $sql = "select * from tt_clients where group_id = $group_id and status = 0 order by upper(name)";
- else
- $sql = "select id, name from tt_clients where group_id = $group_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;
- }
-
// The getAllClients obtains all clients in a group.
static function getAllClients($group_id, $all_fields = false) {
$mdb2 = getConnection();
return false;
}
- // getPredefinedExpenses - obtains predefined expenses for a group.
- static function getPredefinedExpenses($group_id) {
- global $user;
- $replaceDecimalMark = ('.' != $user->decimal_mark);
-
- $mdb2 = getConnection();
-
- $result = array();
- $sql = "select id, name, cost from tt_predefined_expenses where group_id = $group_id";
- $res = $mdb2->query($sql);
- $result = array();
- if (!is_a($res, 'PEAR_Error')) {
- while ($val = $res->fetchRow()) {
- if ($replaceDecimalMark)
- $val['cost'] = str_replace('.', $user->decimal_mark, $val['cost']);
- $result[] = $val;
- }
- return $result;
- }
- return false;
- }
-
// getNotifications - obtains notification descriptions for a group.
static function getNotifications($group_id) {
$mdb2 = getConnection();