]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttTimeHelper.class.php
Added handling of expiration dates.
[timetracker.git] / WEB-INF / lib / ttTimeHelper.class.php
index 4e10f4ed749b8d9d89faf9ba8a474d22beb878e0..a66652b70a2edd0c8d45e0a55f0621ae3e5004ba 100644 (file)
@@ -748,4 +748,18 @@ class ttTimeHelper {
 
     return $result;
   }
+
+  // canAdd determines if we can add a record in case there is a limit.
+  static function canAdd() {
+    $mdb2 = getConnection();
+    $sql = "select param_value from tt_site_config where param_name = 'exp_date'";
+    $res = $mdb2->query($sql);
+    $val = $res->fetchRow();
+    if (!$val) return true; // No expiration date.
+
+    if (strtotime($val['param_value']) > time())
+      return true; // Expiration date exists but not reached.
+
+    return false;
+  }
 }