X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FDates.pm;h=50db12e01ad36578b62218f5e9830e9028021c85;hb=c5abb58f7c9e4cfa01829dd2f388b14784b0141f;hp=8b292646ccae659312b0e72a287319466656a9af;hpb=f21577986f8ff5da5fde88deaae2302a8b40dbe7;p=koha_gimpoz diff --git a/C4/Dates.pm b/C4/Dates.pm index 8b292646cc..50db12e01a 100644 --- a/C4/Dates.pm +++ b/C4/Dates.pm @@ -41,6 +41,12 @@ sub _prefformat { return $prefformat; } +sub reset_prefformat { # subroutine to clear the prefformat, called when we change it + if (defined $prefformat){ + $prefformat = C4::Context->preference('dateformat'); + } +} + our %format_map = ( iso => 'yyyy-mm-dd', # plus " HH:MM:SS" metric => 'dd/mm/yyyy', # plus " HH:MM:SS" @@ -167,7 +173,7 @@ sub init ($;$$) { $self->{'dateformat'} = $dformat = ( scalar(@_) >= 2 ) ? $_[1] : _prefformat(); ( $format_map{$dformat} ) or croak "Invalid date format '$dformat' from " . ( ( scalar(@_) >= 2 ) ? 'argument' : 'system preferences' ); $self->{'dmy_arrayref'} = [ ( (@_) ? $self->dmy_map(shift) : localtime ) ]; - if ($debug > 1) { warn "(during init) \@\$self->{'dmy_arrayref'}: " . join( ' ', @{ $self->{'dmy_arrayref'} } ) . "\n"; } + if ($debug && $debug > 1) { warn "(during init) \@\$self->{'dmy_arrayref'}: " . join( ' ', @{ $self->{'dmy_arrayref'} } ) . "\n"; } return $self; }