diff --git a/include/class.auth.php b/include/class.auth.php index ed9a7373167f4b54c2ca8ad48ca3374228a0efc7..4cbbea0359ea071be9791ad9b8dba85eeb82ee5e 100644 --- a/include/class.auth.php +++ b/include/class.auth.php @@ -101,8 +101,7 @@ class ClientCreateRequest { $this_form = UserForm::getUserForm()->getForm($this->getInfo()); $bk = $this->getBackend(); $defaults = array( - 'timezone_id' => $cfg->getDefaultTimezoneId(), - 'dst' => $cfg->observeDaylightSaving(), + 'timezone' => $cfg->getDefaultTimezone(), 'username' => $this->getUsername(), ); if ($bk->supportsInteractiveAuthentication()) diff --git a/include/class.config.php b/include/class.config.php index 66a607241253170842e1657119a7e41ebf1893c9..d47d4144f3e8c084f502a5d9c00f78edabe01648 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -178,17 +178,6 @@ class OsticketConfig extends Config { $this->config[$key] = array('value'=>$value); } - //Get the default time zone - // We can't JOIN timezone table above due to upgrade support. - if ($this->get('default_timezone_id')) { - if (!$this->exists('tz_offset')) - $this->persist('tz_offset', - Timezone::getOffsetById($this->get('default_timezone_id'))); - } else - // Previous osTicket versions saved the offset value instead of - // a timezone instance. This is compatibility for the upgrader - $this->persist('tz_offset', 0); - return true; } @@ -275,9 +264,6 @@ class OsticketConfig extends Config { } /* Date & Time Formats */ - function observeDaylightSaving() { - return ($this->get('enable_daylight_saving')); - } function getTimeFormat() { if ($this->get('date_formats') == 'custom') return $this->get('time_format'); @@ -286,6 +272,18 @@ class OsticketConfig extends Config { function isForce24HourTime() { return $this->get('date_formats') == '24'; } + /** + * getDateFormat + * + * Retrieve the current date format for the system, as a string, and in + * the intl (icu) format. + * + * Parameters: + * $propogate - (boolean:default=false), if set and the configuration + * indicates default date and time formats (ie. not custom), then + * the intl date formatter will be queried to find the pattern used + * internally for the current locale settings. + */ function getDateFormat($propogate=false) { if ($this->get('date_formats') == 'custom') return $this->get('date_format'); @@ -336,10 +334,6 @@ class OsticketConfig extends Config { return rtrim($this->getUrl(),'/'); } - function getTZOffset() { - return $this->get('tz_offset'); - } - function getPageSize() { return $this->get('max_page_size'); } diff --git a/include/class.staff.php b/include/class.staff.php index e78c88dfd143c931dfe1c817d0c411b6d65e13f3..33f9cef7f14a870da5d7b5e37a34393c8bbd8a4f 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -150,10 +150,6 @@ class Staff extends AuthenticatedUser { return $this->isPasswdResetDue(); } - function observeDaylight() { - return $this->ht['daylight_saving']?true:false; - } - function getRefreshRate() { return $this->ht['auto_refresh_rate']; } diff --git a/include/i18n/en_US/help/tips/settings.system.yaml b/include/i18n/en_US/help/tips/settings.system.yaml index 138b6cdb85012ccdc3bf88aa19c6ec25ae595d86..cfd4d3ef6caf49fccbc946d5a31ac41dc0548088 100644 --- a/include/i18n/en_US/help/tips/settings.system.yaml +++ b/include/i18n/en_US/help/tips/settings.system.yaml @@ -81,13 +81,15 @@ default_name_formatting: date_time_options: title: Date & Time Options content: > - The following settings define the Date & Time settings for - Clients. You can change how these appear by following the PHP date - format characters. The dates shown below simply illustrate the - result of their corresponding values. + The following settings define the default settings for Date & + Time settings for the help desk. You can choose to use the locale + defaults for the selected locale or use customize the formats to + meet your unique requirements. Refer to the ICU format strings as a + reference for customization. The dates shown below simply + illustrate the result of their corresponding values. links: - - title: See the PHP Date Formatting Table - href: http://www.php.net/manual/en/function.date.php + - title: See the ICU Date Formatting Table + href: http://userguide.icu-project.org/formatparse/datetime languages: title: System Languages diff --git a/include/upgrader/streams/core/b26f29a6-00000000.task.php b/include/upgrader/streams/core/b26f29a6-00000000.task.php new file mode 100644 index 0000000000000000000000000000000000000000..dcf1fe680774ab3ac8cdce2efb7b2a0251a7932c --- /dev/null +++ b/include/upgrader/streams/core/b26f29a6-00000000.task.php @@ -0,0 +1,73 @@ +<?php + +class IntlMigrator extends MigrationTask { + static $dateToIntl = array( + 'd' => 'dd', + 'D' => 'EEE', + 'j' => 'd', + 'l' => 'EEEE', + 'N' => 'e', + 'w' => 'c', + 'z' => 'D', + + 'W' => 'w', + + 'F' => 'MMMM', + 'm' => 'MM', + 'M' => 'MMM', + 'n' => 'M', + + 'o' => 'Y', + 'Y' => 'y', + 'y' => 'yy', + + 'A' => 'a', + 'g' => 'h', + 'G' => 'H', + 'h' => 'hh', + 'H' => 'HH', + 'i' => 'mm', + 's' => 'ss', + 'u' => 'SSSSSS', + + 'e' => 'VV', + 'O' => 'ZZZ', + 'P' => 'ZZZZZ', + 'T' => 'z', + + 'c' => "yyyy-MM-dd'T'HH:mm:ssXXXXX", + 'r' => 'EEE, d MMM yyyy HH:mm:ss XXXXX', + ); + + function run($max_time) { + global $cfg; + + // Detect rough install date — rationale: the schema_signature is + // touched by the database migrater; however the updated timestamp + // associated with it is not touched. + $install_date = $cfg->lastModified('schema_signature'); + $touched = false; + + // Upgrade date formats + foreach ( + array('datetime_format', 'daydatetime_format', 'time_format', 'date_format') + as $key + ) { + $new_format = ''; + $format = $cfg->get($key); + foreach (str_split($format) as $char) { + $new_format .= @$dateToIntl[$char] ?: $char; + } + $cfg->set($key, $new_format); + + // Consider the last-updated time of the key to see if the + // format has been modified since installation + $touched |= $cfg->lastModified($key) != $install_date; + } + + // Add in new custom date format flag + $cfg->set('date_formats', $touched ? 'custom' : '' ); + } +} + +return 'IntlMigrator';