From 3c857ca72d35f70449f20f1156ab35db92f84828 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 14 Feb 2018 23:15:00 +0000 Subject: [PATCH] FUTURE_ENTRIES option is now configurable as per issue #53. --- WEB-INF/config.php.dist | 5 ----- WEB-INF/lib/ttUser.class.php | 2 ++ WEB-INF/lib/ttWeekViewHelper.class.php | 2 +- WEB-INF/resources/ca.lang.php | 1 + WEB-INF/resources/cs.lang.php | 1 + WEB-INF/resources/da.lang.php | 1 + WEB-INF/resources/de.lang.php | 1 + WEB-INF/resources/en.lang.php | 1 + WEB-INF/resources/es.lang.php | 1 + WEB-INF/resources/et.lang.php | 1 + WEB-INF/resources/fa.lang.php | 1 + WEB-INF/resources/fi.lang.php | 1 + WEB-INF/resources/fr.lang.php | 1 + WEB-INF/resources/he.lang.php | 1 + WEB-INF/resources/hu.lang.php | 1 + WEB-INF/resources/it.lang.php | 1 + WEB-INF/resources/ja.lang.php | 1 + WEB-INF/resources/ko.lang.php | 1 + WEB-INF/resources/nl.lang.php | 1 + WEB-INF/resources/no.lang.php | 1 + WEB-INF/resources/pl.lang.php | 1 + WEB-INF/resources/pt-br.lang.php | 1 + WEB-INF/resources/pt.lang.php | 1 + WEB-INF/resources/ro.lang.php | 1 + WEB-INF/resources/ru.lang.php | 1 + WEB-INF/resources/sk.lang.php | 1 + WEB-INF/resources/sl.lang.php | 1 + WEB-INF/resources/sr.lang.php | 1 + WEB-INF/resources/sv.lang.php | 1 + WEB-INF/resources/tr.lang.php | 1 + WEB-INF/resources/zh-cn.lang.php | 1 + WEB-INF/resources/zh-tw.lang.php | 1 + WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/profile_edit.tpl | 4 ++++ expense_edit.php | 2 +- expenses.php | 2 +- mobile/expense_edit.php | 2 +- mobile/expenses.php | 2 +- mobile/time.php | 2 +- mobile/time_edit.php | 2 +- mobile/timer.php | 2 +- profile_edit.php | 7 +++++++ time.php | 2 +- time_edit.php | 2 +- 44 files changed, 53 insertions(+), 16 deletions(-) diff --git a/WEB-INF/config.php.dist b/WEB-INF/config.php.dist index e4fb3c0a..c0dd256d 100644 --- a/WEB-INF/config.php.dist +++ b/WEB-INF/config.php.dist @@ -81,11 +81,6 @@ define('COST_ON_REPORTS', true); // define('READONLY_START_FINISH', false); -// FUTURE_ENTRIES - defines whether users can create entries for future dates. Defaults to true. -// -// define('FUTURE_ENTRIES', false); - - // WEEKEND_START_DAY // // This option defines which days are highlighted with weekend color. diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index f64a76c0..915d241f 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -47,6 +47,7 @@ class ttUser { var $task_required = 0; // Whether task selection is required on time entires. var $record_type = 0; // Record type (duration vs start and finish, or both). var $allow_overlap = 0; // Whether to allow overlapping time entries. + var $future_entries = 0; // Whether to allow creating future entries. var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page). var $bcc_email = null; // Bcc email. var $currency = null; // Currency. @@ -115,6 +116,7 @@ class ttUser { // Set user config options. $this->show_holidays = in_array('show_holidays', $config_array); $this->allow_overlap = in_array('allow_overlap', $config_array); + $this->future_entries = in_array('future_entries', $config_array); $this->uncompleted_indicators = in_array('uncompleted_indicators', $config_array); // Set "on behalf" id and name. diff --git a/WEB-INF/lib/ttWeekViewHelper.class.php b/WEB-INF/lib/ttWeekViewHelper.class.php index 130cc3d6..af0960ae 100644 --- a/WEB-INF/lib/ttWeekViewHelper.class.php +++ b/WEB-INF/lib/ttWeekViewHelper.class.php @@ -482,7 +482,7 @@ class ttWeekViewHelper { $objEntryDate = new DateAndTime(DB_DATEFORMAT, $entry_date); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES) && $fields['browser_today']) { + if (!$user->future_entries && $fields['browser_today']) { $objBrowserToday = new DateAndTime(DB_DATEFORMAT, $fields['browser_today']); if ($objEntryDate->after($objBrowserToday)) { $err->add($i18n->getKey('error.future_date')); diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 08e3fc06..523fabf8 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -486,6 +486,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index 0a300d8e..dd3c68bb 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -501,6 +501,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 262c4f45..41cbcec6 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -434,6 +434,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'Varighed', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', 'form.profile.uncompleted_indicators' => 'Uafsluttede indikatore', 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index 7a9b178c..a9771451 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -432,6 +432,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'Dauer', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Erweiterungen', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index e5330ca9..73f15638 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -427,6 +427,7 @@ $i18n_key_words = array( 'form.profile.type_start_finish' => 'start and finish', 'form.profile.type_duration' => 'duration', 'form.profile.allow_overlap' => 'Allow overlap', +'form.profile.future_entries' => 'Future entries', 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index 0caf6e50..b6b487de 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -499,6 +499,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 69a71332..ea56258b 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -497,6 +497,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index d4d9eb91..116de7ce 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -463,6 +463,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'مدت زمان', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'پلاگین ها', diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index 6becda6b..f1c98c98 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -441,6 +441,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'kesto', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Lisäosat', diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index eb39469f..288eaa51 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -431,6 +431,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'Durée', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index 9ce2735b..70e6d078 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -468,6 +468,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'משך זמן', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'תוספים', diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index dd94782e..e9e3a8bd 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -496,6 +496,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index 074abd55..396dbfe4 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -434,6 +434,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'durata', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', 'form.profile.uncompleted_indicators' => 'Indicatori incompleti', // TODO: translate the following. If the translation is the same word, indicate so. Plugini, perhaps? // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index e2054395..e89da2ff 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -486,6 +486,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index 6948e804..c77f4b89 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -488,6 +488,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index ec5fa511..13040d66 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -430,6 +430,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'duur', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', 'form.profile.uncompleted_indicators' => 'Onvolledige indicatoren', 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index 1cf77464..c71fdabd 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -484,6 +484,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index 7ea5e96e..9d833c3b 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -444,6 +444,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'czas trwania', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Dodatkowe moduły', diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index a832f7e6..0e4f76de 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -439,6 +439,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'duração', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index b0923333..52617669 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -477,6 +477,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index 3dfc9fdc..d3a6ef99 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -494,6 +494,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index 76e78705..13a2446f 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -425,6 +425,7 @@ $i18n_key_words = array( 'form.profile.type_start_finish' => 'начало и конец', 'form.profile.type_duration' => 'длительность', 'form.profile.allow_overlap' => 'Возможное перекрывание', +'form.profile.future_entries' => 'Будущие записи', 'form.profile.uncompleted_indicators' => 'Индикаторы незавершения', 'form.profile.plugins' => 'Плагины', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 81bcc725..d0ebdc3e 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -460,6 +460,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'trvanie', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Doplnkové moduly', diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index bdf54a49..0cc067f2 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -473,6 +473,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php index 519f9a13..ea3ec697 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -442,6 +442,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'trajanje', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', 'form.profile.plugins' => 'Dodaci', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index 567bb544..dc9a3eec 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -439,6 +439,7 @@ $i18n_key_words = array( 'form.profile.type_duration' => 'Varaktighet', // TODO: translate the following. // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', 'form.profile.uncompleted_indicators' => 'Indikatorer för oavslutad registrering', 'form.profile.plugins' => 'Tillägg', diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index ce0d563a..c0f8f978 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -505,6 +505,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index 59b4916f..26d80a5d 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -473,6 +473,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index bd66279d..b40cfc32 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -483,6 +483,7 @@ $i18n_key_words = array( // 'form.profile.type_start_finish' => 'start and finish', // 'form.profile.type_duration' => 'duration', // 'form.profile.allow_overlap' => 'Allow overlap', +// 'form.profile.future_entries' => 'Future entries', // 'form.profile.uncompleted_indicators' => 'Uncompleted indicators', // 'form.profile.plugins' => 'Plugins', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index b95b9d85..66f27732 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- + + + + diff --git a/expense_edit.php b/expense_edit.php index d7d815c3..f13c7919 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -162,7 +162,7 @@ if ($request->isPost()) { $new_date = new DateAndTime($user->date_format, $cl_date); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($new_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/expenses.php b/expenses.php index 2d1c5306..99418276 100644 --- a/expenses.php +++ b/expenses.php @@ -159,7 +159,7 @@ if ($request->isPost()) { if (!ttValidFloat($cl_cost)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cost')); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($selected_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/mobile/expense_edit.php b/mobile/expense_edit.php index c2df1abb..69c13ecc 100644 --- a/mobile/expense_edit.php +++ b/mobile/expense_edit.php @@ -144,7 +144,7 @@ if ($request->isPost()) { $new_date = new DateAndTime($user->date_format, $cl_date); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($new_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/mobile/expenses.php b/mobile/expenses.php index 790a7ace..dd8e87c0 100644 --- a/mobile/expenses.php +++ b/mobile/expenses.php @@ -150,7 +150,7 @@ if ($request->isPost()) { if (!ttValidFloat($cl_cost)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.cost')); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($selected_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/mobile/time.php b/mobile/time.php index 2b1f8395..827eadca 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -225,7 +225,7 @@ if ($request->isPost()) { // Finished validating user input. // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($selected_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/mobile/time_edit.php b/mobile/time_edit.php index 81337c9c..1e1a3897 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -253,7 +253,7 @@ if ($request->isPost()) { $new_date = new DateAndTime($user->date_format, $cl_date); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($new_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/mobile/timer.php b/mobile/timer.php index 1fa6c137..95790311 100644 --- a/mobile/timer.php +++ b/mobile/timer.php @@ -200,7 +200,7 @@ if ($request->isPost()) { // Finished validating user input. // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($selected_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/profile_edit.php b/profile_edit.php index 7ce14f66..fc13d0c5 100644 --- a/profile_edit.php +++ b/profile_edit.php @@ -63,6 +63,7 @@ if ($request->isPost()) { $cl_task_required = $request->getParameter('task_required'); $cl_record_type = $request->getParameter('record_type'); $cl_allow_overlap = $request->getParameter('allow_overlap'); + $cl_future_entries = $request->getParameter('future_entries'); $cl_uncompleted_indicators = $request->getParameter('uncompleted_indicators'); $cl_bcc_email = trim($request->getParameter('bcc_email')); @@ -98,6 +99,7 @@ if ($request->isPost()) { $cl_task_required = $user->task_required; $cl_record_type = $user->record_type; $cl_allow_overlap = $user->allow_overlap; + $cl_future_entries = $user->future_entries; $cl_uncompleted_indicators = $user->uncompleted_indicators; $cl_bcc_email = $user->bcc_email; @@ -194,6 +196,9 @@ if ($user->canManageTeam()) { // Allow overlap checkbox. $form->addInput(array('type'=>'checkbox','name'=>'allow_overlap','value'=>$cl_allow_overlap)); + // Future entries checkbox. + $form->addInput(array('type'=>'checkbox','name'=>'future_entries','value'=>$cl_future_entries)); + // Uncompleted indicators checkbox. $form->addInput(array('type'=>'checkbox','name'=>'uncompleted_indicators','value'=>$cl_uncompleted_indicators)); @@ -290,6 +295,8 @@ if ($request->isPost()) { $config .= ',show_holidays'; if ($cl_allow_overlap) $config .= ',allow_overlap'; + if ($cl_future_entries) + $config .= ',future_entries'; if ($cl_uncompleted_indicators) $config .= ',uncompleted_indicators'; $config = trim($config, ','); diff --git a/time.php b/time.php index 11f95c49..9fca8898 100644 --- a/time.php +++ b/time.php @@ -260,7 +260,7 @@ if ($request->isPost()) { // Finished validating user input. // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($selected_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); diff --git a/time_edit.php b/time_edit.php index d24d7f19..60719971 100644 --- a/time_edit.php +++ b/time_edit.php @@ -259,7 +259,7 @@ if ($request->isPost()) { $new_date = new DateAndTime($user->date_format, $cl_date); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($new_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); -- 2.20.1
 Anuko Time Tracker 1.17.19.3991 | Copyright © Anuko | +  Anuko Time Tracker 1.17.20.3992 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/profile_edit.tpl b/WEB-INF/templates/profile_edit.tpl index 420a1985..51d01cc2 100644 --- a/WEB-INF/templates/profile_edit.tpl +++ b/WEB-INF/templates/profile_edit.tpl @@ -176,6 +176,10 @@ function handlePluginCheckboxes() { {$i18n.form.profile.allow_overlap}: {$forms.profileForm.allow_overlap.control} {$i18n.label.what_is_it}
{$i18n.form.profile.future_entries}:{$forms.profileForm.future_entries.control} {$i18n.label.what_is_it}
{$i18n.form.profile.uncompleted_indicators}: {$forms.profileForm.uncompleted_indicators.control} {$i18n.label.what_is_it}