From: Nik Okuntseff Date: Wed, 9 Jan 2019 18:12:48 +0000 (+0000) Subject: Added handling of expiration dates. X-Git-Tag: timetracker_1.19-1~362 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=903dae76e54a4e0c081532a8113c00ef1b56a1b5;p=timetracker.git Added handling of expiration dates. --- diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 4e10f4ed..a66652b7 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -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; + } } diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index f38bcabd..7b5a5d62 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -117,6 +117,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index baf085b5..8c875b92 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -119,6 +119,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 051b6f8c..7b9faf3b 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -111,6 +111,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index 6eaa77f7..2c21205d 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -105,6 +105,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index 687f19da..2db7e2d9 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -102,6 +102,7 @@ $i18n_key_words = array( 'error.cannot_import' => 'Cannot import: %s.', 'error.format' => 'Invalid file format.', 'error.user_count' => 'Limit on user count.', +'error.expired' => 'Expiration date reached.', // Warning messages. 'warn.sure' => 'Are you sure?', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index fbf7076a..0f8bc123 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -115,6 +115,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 860b8cd9..1387bea3 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -120,6 +120,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index 3ec01e23..dfb01050 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -118,6 +118,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index 4895713b..1bd09822 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -113,6 +113,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index 5e003665..430c5b1c 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -111,6 +111,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/gr.lang.php b/WEB-INF/resources/gr.lang.php index 6e7b32ef..88dad80f 100644 --- a/WEB-INF/resources/gr.lang.php +++ b/WEB-INF/resources/gr.lang.php @@ -106,6 +106,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index daedb00b..1420500b 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -128,6 +128,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index fcd4c256..6d4698e6 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -117,6 +117,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index 36f8ab3d..c14d770e 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -110,6 +110,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index 4cb224fb..d7e2dcf9 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -121,6 +121,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index 2c0a898e..1866dd54 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -120,6 +120,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index d98188f4..823035ce 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -103,6 +103,7 @@ $i18n_key_words = array( 'error.format' => 'Bestandsformaat niet valide.', // TODO: translate the following. // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index 650957ed..8a698d1d 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -120,6 +120,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index 11b6c4b4..2922a342 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -115,6 +115,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index 3e36200e..8691f938 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -112,6 +112,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index c3ef6c5c..bc5d8386 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -114,6 +114,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index 01ecded5..6eb22112 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -121,6 +121,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index f68e0631..4b524b82 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -101,6 +101,7 @@ $i18n_key_words = array( 'error.cannot_import' => 'Невозможно импортировать: %s.', 'error.format' => 'Неверный формат файла.', 'error.user_count' => 'Ограничение на количество пользователей.', +'error.expired' => 'Достигнута дата экспирации.', // Warning messages. 'warn.sure' => 'Вы уверены?', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 33622c99..726c78e8 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -117,6 +117,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index 6b3881a1..18ddd37f 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -111,6 +111,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php index 3b12961d..c20cc43f 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -112,6 +112,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index 5ddd55d1..d1a10648 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -110,6 +110,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index fafeeaaf..38b4a4b2 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -124,6 +124,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index 656eb451..fd4e2b88 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -112,6 +112,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index 0bdb2e05..4112fa15 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -118,6 +118,7 @@ $i18n_key_words = array( // 'error.cannot_import' => 'Cannot import: %s.', // 'error.format' => 'Invalid file format.', // 'error.user_count' => 'Limit on user count.', +// 'error.expired' => 'Expiration date reached.', // Warning messages. // TODO: translate the following. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index bf9a81c0..35fc2a5d 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.36.4701 | Copyright © Anuko | +  Anuko Time Tracker 1.18.36.4702 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/expense_edit.php b/expense_edit.php index 8eb7d4fe..b1115f1e 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -30,6 +30,7 @@ require_once('initialize.php'); import('form.Form'); import('ttGroupHelper'); import('DateAndTime'); +import('ttTimeHelper'); import('ttExpenseHelper'); // Access checks. @@ -176,6 +177,8 @@ if ($request->isPost()) { if ($new_date->after($browser_today)) $err->add($i18n->get('error.future_date')); } + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); + // Finished validating user input. // Save record. if ($request->getParameter('btn_save')) { diff --git a/expenses.php b/expenses.php index 9a345422..e1eaedda 100644 --- a/expenses.php +++ b/expenses.php @@ -31,6 +31,7 @@ import('form.Form'); import('ttUserHelper'); import('ttGroupHelper'); import('DateAndTime'); +import('ttTimeHelper'); import('ttExpenseHelper'); // Access checks. @@ -202,6 +203,7 @@ if ($request->isPost()) { if ($selected_date->after($browser_today)) $err->add($i18n->get('error.future_date')); } + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating input data. // Prohibit creating entries in locked range. diff --git a/mobile/expense_edit.php b/mobile/expense_edit.php index 4c183afd..e9e1ca63 100644 --- a/mobile/expense_edit.php +++ b/mobile/expense_edit.php @@ -30,6 +30,7 @@ require_once('../initialize.php'); import('form.Form'); import('ttGroupHelper'); import('DateAndTime'); +import('ttTimeHelper'); import('ttExpenseHelper'); // Access checks. @@ -171,6 +172,8 @@ if ($request->isPost()) { if ($new_date->after($browser_today)) $err->add($i18n->get('error.future_date')); } + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); + // Finished validating input data. // Save record. if ($request->getParameter('btn_save')) { diff --git a/mobile/expenses.php b/mobile/expenses.php index ac565207..1b8f7cda 100644 --- a/mobile/expenses.php +++ b/mobile/expenses.php @@ -31,6 +31,7 @@ import('form.Form'); import('ttUserHelper'); import('ttGroupHelper'); import('DateAndTime'); +import('ttTimeHelper'); import('ttExpenseHelper'); // Access checks. @@ -207,6 +208,7 @@ if ($request->isPost()) { if ($selected_date->after($browser_today)) $err->add($i18n->get('error.future_date')); } + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating input data. // Prohibit creating entries in locked range. diff --git a/mobile/time.php b/mobile/time.php index 107a72c7..364379f4 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -267,6 +267,7 @@ if ($request->isPost()) { $err->add($i18n->get('error.field'), $i18n->get('label.duration')); } if (!ttValidString($cl_note, true)) $err->add($i18n->get('error.field'), $i18n->get('label.note')); + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating user input. // Prohibit creating entries in future. diff --git a/mobile/time_edit.php b/mobile/time_edit.php index cdd50707..803ca4e4 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -252,6 +252,7 @@ if ($request->isPost()) { } if (!ttValidDate($cl_date)) $err->add($i18n->get('error.field'), $i18n->get('label.date')); if (!ttValidString($cl_note, true)) $err->add($i18n->get('error.field'), $i18n->get('label.note')); + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating user input. // This is a new date for the time record. diff --git a/time.php b/time.php index 0431c2be..5a9b5210 100644 --- a/time.php +++ b/time.php @@ -288,6 +288,7 @@ if ($request->isPost()) { $err->add($i18n->get('error.field'), $i18n->get('label.duration')); } if (!ttValidString($cl_note, true)) $err->add($i18n->get('error.field'), $i18n->get('label.note')); + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating user input. // Prohibit creating entries in future. diff --git a/time_edit.php b/time_edit.php index 16f69d2a..3bd52e6f 100644 --- a/time_edit.php +++ b/time_edit.php @@ -257,6 +257,7 @@ if ($request->isPost()) { } if (!ttValidDate($cl_date)) $err->add($i18n->get('error.field'), $i18n->get('label.date')); if (!ttValidString($cl_note, true)) $err->add($i18n->get('error.field'), $i18n->get('label.note')); + if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired')); // Finished validating user input. // This is a new date for the time record.