X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Flib%2FttClientHelper.class.php;h=9009f570add7685a2e75b5a7b5e745b2a84ce4cc;hb=45a530c33fdd7ab2ccd1905c24a371c94e17eac5;hp=8f673f43ed2ead7beec139bf1269217dbc541d5b;hpb=5492c8b02d8f7ff98a159c01948101000d98e06e;p=timetracker.git diff --git a/WEB-INF/lib/ttClientHelper.class.php b/WEB-INF/lib/ttClientHelper.class.php index 8f673f43..9009f570 100644 --- a/WEB-INF/lib/ttClientHelper.class.php +++ b/WEB-INF/lib/ttClientHelper.class.php @@ -121,7 +121,7 @@ class ttClientHelper { } // Handle time records. - $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; if ($delete_client_entries) { $sql = 'update tt_log set status = NULL'.$modified_part." where client_id = $id"; $affected = $mdb2->exec($sql); @@ -189,12 +189,7 @@ class ttClientHelper { if (is_a($affected, 'PEAR_Error')) return false; - $last_id = 0; - $sql = "select last_insert_id() as last_insert_id"; - $res = $mdb2->query($sql); - $val = $res->fetchRow(); - $last_id = $val['last_insert_id']; - + $last_id = $mdb2->lastInsertID('tt_clients', 'id'); if (count($projects) > 0) foreach ($projects as $p_id) { $sql = "insert into tt_client_project_binds (client_id, project_id, group_id, org_id) values($last_id, $p_id, $group_id, $org_id)"; @@ -244,18 +239,6 @@ class ttClientHelper { 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); @@ -289,7 +272,7 @@ class ttClientHelper { static function getClientsForUser() { global $user; - $user_id = $user->getActiveUser(); + $user_id = $user->getUser(); $result = array(); $mdb2 = getConnection();