Fixed db maintenance code to delete monthly qoutas.
[timetracker.git] / WEB-INF / lib / ttOrgHelper.class.php
index d93e259..81bfbcf 100644 (file)
@@ -82,4 +82,19 @@ class ttOrgHelper {
     }
     return false;
   }
+
+  // deleteOrg deletes data for the entire organization from database permanently.
+  // Work in progress, currently not fully implemented.
+  static function deleteOrg($org_id) {
+    // We shall do it in a straightforward way by a delete operation from all tables by org_id.
+    // However, at this time not all tables have org_id.
+    // So, we need to add the field as we write code here.
+
+    // Delete monthly quotas.
+    $sql = "delete from tt_monthly_quotas where org_id = $org_id";
+    $affected = $mdb2->exec($sql);
+    if (is_a($affected, 'PEAR_Error')) return false;
+
+    return true; // Work in progress, currently not fully implemented.
+  }
 }