Improved ttUser::markUserDeleted by marking user custom fields as deleted also.
authorNik Okuntseff <support@anuko.com>
Mon, 1 Jul 2019 14:42:45 +0000 (14:42 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 1 Jul 2019 14:42:45 +0000 (14:42 +0000)
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl

index 5498a99..6db6278 100644 (file)
@@ -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;
   }
 
index 5f090d9..39edd60 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.19.7.5028 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.19.7.5029 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>