From 23b28d9f1bed21ad53c99fdd6c5649e4aa8be66b Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 12 Mar 2016 23:27:20 +0000 Subject: [PATCH] Introduced ALLOW_OVERLAP setting ALLOW_OVERLAP can be set to true in config.php to allow time entries to overlap --- WEB-INF/config.php.dist | 6 ++++++ WEB-INF/lib/ttTimeHelper.class.php | 9 ++++++++- WEB-INF/templates/footer.tpl | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/WEB-INF/config.php.dist b/WEB-INF/config.php.dist index 25ba2c0d..bca0da0e 100644 --- a/WEB-INF/config.php.dist +++ b/WEB-INF/config.php.dist @@ -86,11 +86,17 @@ 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); +// ALLOW_OVERLAP - defines whether overlapping time entries are allowed. Defaults to false. +// +// define('ALLOW_OVERLAP', true); + + // WEEKEND_START_DAY // // This option defines which days are highlighted with weekend color. diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 1333894b..f743e61d 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -365,7 +365,10 @@ class ttTimeHelper { $duration = ttTimeHelper::normalizeDuration($duration); if (!$timestamp) { - $timestamp = date('YmdHis');//yyyymmddhhmmss + $timestamp = date('YmdHis'); //yyyymmddhhmmss + // TODO: this timestamp could be illegal if we hit inside DST switch deadzone, such as '2016-03-13 02:30:00' + // Anything between 2am and 3am on DST introduction date will not work if we run on a system with DST on. + // We need to address this properly to avoid potential complications. } if (!$billable) $billable = 0; @@ -512,6 +515,10 @@ class ttTimeHelper { // $finish - new record finish time, may be null // $record_id - optional record id we may be editing, excluded from overlap set static function overlaps($user_id, $date, $start, $finish, $record_id = null) { + // Do not bother checking if we allow overlaps. + if (defined('ALLOW_OVERLAP') && ALLOW_OVERLAP == true) + return false; + $mdb2 = getConnection(); $start = ttTimeHelper::to24HourFormat($start); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index cbdfffd1..05ec3607 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.9.14.3412 | Copyright © Anuko | +  Anuko Time Tracker 1.9.15.3413 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1