Refactoring, finished with last insert ids.
[timetracker.git] / WEB-INF / lib / ttInvoiceHelper.class.php
index 41dace0..0867ee1 100644 (file)
@@ -332,11 +332,7 @@ class ttInvoiceHelper {
     if (is_a($affected, 'PEAR_Error')) return false;
 
     // Mark associated invoice items with invoice id.
-    $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_invoices', 'id');
 
     // Our update sql is different depending on tracking mode.
     if (MODE_TIME == $user->getTrackingMode()) {