+
+ my $func = "$alias.$field";
+
+ my $db_type = RT->Config->Get('DatabaseType');
+ if ( RT->Config->Get('ChartsTimezonesInDB') ) {
+ my $tz = $self->CurrentUser->UserObj->Timezone
+ || RT->Config->Get('Timezone')
+ || 'UTC';
+ if ( lc $tz eq 'utc' ) {
+ # do nothing
+ }
+ elsif ( $db_type eq 'Pg' ) {
+ $func = "timezone('UTC', $func)";
+ $func = "timezone(". $self->_Handle->dbh->quote($tz) .", $func)";
+ }
+ elsif ( $db_type eq 'mysql' ) {
+ $func = "CONVERT_TZ($func, 'UTC', "
+ . $self->_Handle->dbh->quote($tz)
+ .")";
+ }
+ else {
+ $RT::Logger->warning(
+ "ChartsTimezonesInDB config option"
+ ." is not supported on $db_type."
+ );
+ }
+ }
+