From 45a530c33fdd7ab2ccd1905c24a371c94e17eac5 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 2 Dec 2018 15:58:41 +0000 Subject: [PATCH] More refactoring for subgroups. --- WEB-INF/lib/ttTimeHelper.class.php | 13 ++++++++++--- WEB-INF/templates/footer.tpl | 2 +- mobile/time_delete.php | 2 +- time_delete.php | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 5f8852ef..6ddedc45 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -506,15 +506,22 @@ class ttTimeHelper { } // delete - deletes a record from tt_log table and its associated custom field values. - static function delete($id, $user_id) { + static function delete($id) { + global $user; $mdb2 = getConnection(); - $sql = "update tt_log set status = NULL where id = $id and user_id = $user_id"; + $user_id = $user->getUser(); + $group_id = $user->getGroup(); + $org_id = $user->org_id; + + $sql = "update tt_log set status = null". + " where id = $id and user_id = $user_id and group_id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; - $sql = "update tt_custom_field_log set status = NULL where log_id = $id"; + $sql = "update tt_custom_field_log set status = null". + " where log_id = $id and group_id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 4cfac191..b0529d29 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4568 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4569 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/time_delete.php b/mobile/time_delete.php index f5305bc6..10473260 100644 --- a/mobile/time_delete.php +++ b/mobile/time_delete.php @@ -64,7 +64,7 @@ if ($request->isPost()) { if ($err->no()) { // Delete the record. - if (ttTimeHelper::delete($cl_id, $user_id)) { + if (ttTimeHelper::delete($cl_id)) { header('Location: time.php'); exit(); } else { diff --git a/time_delete.php b/time_delete.php index 385e4f11..5d6e5729 100644 --- a/time_delete.php +++ b/time_delete.php @@ -64,7 +64,7 @@ if ($request->isPost()) { if ($err->no()) { // Delete the record. - if (ttTimeHelper::delete($cl_id, $user_id)) { + if (ttTimeHelper::delete($cl_id)) { header('Location: time.php'); exit(); } else { -- 2.20.1