X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FDates.pm;h=50db12e01ad36578b62218f5e9830e9028021c85;hb=8e9fc9b38565e574d9537250b579db023234cbcb;hp=335de1c8ae5860cb9dd49f09ccd3c24463ce2ffb;hpb=b06a289173d0f2e299b0c8652d59d47dc196062c;p=koha_gimpoz diff --git a/C4/Dates.pm b/C4/Dates.pm index 335de1c8ae..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 ) ]; - $debug and 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; }