Bug 5549 : Add a timezone object to C4::Context
Will be required by rolling loans to get correct times
NB the setting of the TZ in mysql has not been changed as
this appears to rely on $ENV{TZ} being undefined
This commit is contained in:
parent
8cea8e5cc0
commit
7716fce253
|
|
@ -104,6 +104,7 @@ use XML::Simple;
|
|||
use C4::Boolean;
|
||||
use C4::Debug;
|
||||
use POSIX ();
|
||||
use DateTime::TimeZone;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -384,6 +385,7 @@ sub new {
|
|||
$self->{"userenv"} = undef; # User env
|
||||
$self->{"activeuser"} = undef; # current active user
|
||||
$self->{"shelves"} = undef;
|
||||
$self->{tz} = undef; # local timezone object
|
||||
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
|
|
@ -1112,6 +1114,24 @@ sub get_versions {
|
|||
}
|
||||
|
||||
|
||||
=head2 tz
|
||||
|
||||
C4::Context->tz
|
||||
|
||||
Returns a DateTime::TimeZone object for the system timezone
|
||||
|
||||
=cut
|
||||
|
||||
sub tz {
|
||||
my $self = shift;
|
||||
if (!defined $context->{tz}) {
|
||||
$context->{tz} = DateTime::TimeZone->new(name => 'local');
|
||||
}
|
||||
return $context->{tz};
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue