X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/b43967e75a9a02e61a8ac2263f3b5432556d661f..c30bd94928988ff03ade10ca872968681456e12c:/WEB-INF/lib/ttOrgImportHelper.class.php diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index 011f2081..328eabef 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -725,11 +725,7 @@ class ttOrgImportHelper { 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_projects', 'id'); // Insert binds into tt_project_task_binds table. if (is_array($tasks)) { @@ -764,10 +760,7 @@ class ttOrgImportHelper { if (is_a($affected, 'PEAR_Error')) return false; - $sql = "SELECT LAST_INSERT_ID() AS last_id"; - $res = $mdb2->query($sql); - $val = $res->fetchRow(); - $last_id = $val['last_id']; + $last_id = $mdb2->lastInsertID('tt_roles', 'id'); return $last_id; } @@ -796,11 +789,7 @@ class ttOrgImportHelper { 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) { @@ -844,13 +833,8 @@ class ttOrgImportHelper { if (is_a($affected, 'PEAR_Error')) return false; - $sql = "select last_insert_id() as last_id"; - $res = $mdb2->query($sql); - if (is_a($res, 'PEAR_Error')) - return false; - - $val = $res->fetchRow(); - return $val['last_id']; + $last_id = $mdb2->lastInsertID('tt_fav_reports', 'id'); + return $last_id; } // insertNotification function inserts a new notification into database. @@ -912,11 +896,7 @@ class ttOrgImportHelper { 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_custom_fields', 'id'); return $last_id; } @@ -935,11 +915,7 @@ class ttOrgImportHelper { 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_custom_field_options', 'id'); return $last_id; }