From b43967e75a9a02e61a8ac2263f3b5432556d661f Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 30 Nov 2018 13:32:31 +0000 Subject: [PATCH] A bit more refactoring. --- WEB-INF/lib/ttFavReportHelper.class.php | 9 ++------- WEB-INF/lib/ttInvoiceHelper.class.php | 7 +------ WEB-INF/templates/footer.tpl | 2 +- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/WEB-INF/lib/ttFavReportHelper.class.php b/WEB-INF/lib/ttFavReportHelper.class.php index f1943f71..36600e21 100644 --- a/WEB-INF/lib/ttFavReportHelper.class.php +++ b/WEB-INF/lib/ttFavReportHelper.class.php @@ -107,13 +107,8 @@ class ttFavReportHelper { 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; } // updateReport - updates report options in the database. diff --git a/WEB-INF/lib/ttInvoiceHelper.class.php b/WEB-INF/lib/ttInvoiceHelper.class.php index 3d67f6a7..41dace01 100644 --- a/WEB-INF/lib/ttInvoiceHelper.class.php +++ b/WEB-INF/lib/ttInvoiceHelper.class.php @@ -56,12 +56,7 @@ class ttInvoiceHelper { 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_invoices', 'id'); return $last_id; } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 501ebf76..c1615800 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.28.4544 | Copyright © Anuko | +  Anuko Time Tracker 1.18.28.4545 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1