X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/19f479eb795f39d331fbfe33ab20534112555630..dc799619007c9eafdec69a70f89a2d08bb10864c:/WEB-INF/lib/ttTimeHelper.class.php diff --git a/WEB-INF/lib/ttTimeHelper.class.php b/WEB-INF/lib/ttTimeHelper.class.php index 6fd816e0..f6d8b92d 100644 --- a/WEB-INF/lib/ttTimeHelper.class.php +++ b/WEB-INF/lib/ttTimeHelper.class.php @@ -33,6 +33,11 @@ class ttTimeHelper { // isWeekend determines if $date falls on weekend. static function isWeekend($date) { + // NOTE: this does not work for subgroups with different WEEKEND_START_DAY + // as the setting is per server. Example: a parent group in USA, with a subgroup + // in Saudi Arabia. Their weekends are the same. + // Decided NOT to introduce a configurable WEEKEND_START_DAY for groups in UI + // to keep UI simple, for now. See also Calendar class with the same issue. $weekDay = date('w', strtotime($date)); return ($weekDay == WEEKEND_START_DAY || $weekDay == (WEEKEND_START_DAY + 1) % 7); } @@ -60,8 +65,10 @@ class ttTimeHelper { $holiDateSpecArray = explode('-', $holiDateSpec); // Check year. - if ($dateArray[0] != $holiDateSpecArray[0] && $holiDateSpecArray[0] != '****') // **** means all years. - return false; + for($i = 0; $i < 4; $i++) { + if ($dateArray[0][$i] != $holiDateSpecArray[0][$i] && $holiDateSpecArray[0][$i] != '*') // * means any digit matches + return false; + } // Check month. if ($dateArray[1] != $holiDateSpecArray[1]) return false;