From 9dab021e08d44f730564686bd9ef7856c7a3b4a0 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 1 Jul 2019 14:42:45 +0000 Subject: [PATCH] Improved ttUser::markUserDeleted by marking user custom fields as deleted also. --- WEB-INF/lib/ttUser.class.php | 14 +++++++++++++- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 5498a996..6db62788 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -708,14 +708,26 @@ class ttUser { if (is_a($affected, 'PEAR_Error')) return false; - // Mark user as deleted. + // Mark user custom fields as deleted, + require_once('plugins/CustomFields.class.php'); + $entity_type = CustomFields::ENTITY_USER; $modified_part = ', modified = now(), modified_ip = '.$mdb2->quote($_SERVER['REMOTE_ADDR']).', modified_by = '.$mdb2->quote($this->id); + $sql = "update tt_entity_custom_fields set status = null $modified_part". + " where entity_type = $entity_type and entity_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; + + // Mark user as deleted. $sql = "update tt_users set status = null $modified_part where 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; + + return true; } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 5f090d99..39edd60c 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.19.7.5028 | Copyright © Anuko | +  Anuko Time Tracker 1.19.7.5029 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1