Implemented locking feature as an optionally enabled plugin.
[timetracker.git] / mobile / time_delete.php
index 9e818e7..e9f0e22 100644 (file)
@@ -38,12 +38,6 @@ if (!ttAccessCheck(right_data_entry)) {
   exit();
 }
 
-// Use Custom Fields plugin if we have one.
-// if (file_exists("plugins/CustomFields.class.php")) {
-//   require_once("plugins/CustomFields.class.php");
-//   $custom_fields = new CustomFields($user->team_id);
-// }
-
 $cl_id = $request->getParameter('id');
 $time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
 
@@ -59,19 +53,11 @@ if ($request->isPost()) {
     // Determine if it's okay to delete the record.
     $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']);
 
-    // Determine lock date.
-    $lock_interval = $user->lock_interval;
-    $lockdate = 0;
-    if ($lock_interval > 0) {
-      $lockdate = new DateAndTime();
-      $lockdate->decDay($lock_interval);
-    }
     // Determine if the record is uncompleted.
     $uncompleted = ($time_rec['duration'] == '0:00');
 
-    if($lockdate && $item_date->before($lockdate) && !$uncompleted) {
+    if ($user->isDateLocked($item_date) && !$uncompleted)
       $err->add($i18n->getKey('error.period_locked'));
-    }
 
     if ($err->no()) {