Bug 14998: Restore previous behavior
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 11 Nov 2015 12:40:52 +0000 (12:40 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 11 Nov 2015 14:07:27 +0000 (11:07 -0300)
We want to convert a us or metric date formatted to the format defined in
the pref.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
misc/maintenance/fix_accountlines_date.pl

index e0c97f6..470b84b 100755 (executable)
@@ -146,14 +146,14 @@ while (my $accountline = $sth->fetchrow_hashref) {
 
     if ($mode eq 'us') {
         if ($description =~ /$US_DATE/) { # mm/dd/yyyy
-            my $date = eval { output_pref( { dt => dt_from_string( $1 ), dateonly => 1, dateformat => 'us' } ); };
+            my $date = output_pref( { dt => dt_from_string( $1, 'us' ), dateonly => 1} );
             print "Converting $1 (us) to " . $date . "\n" if $DEBUG;i
             $description =~ s/$US_DATE/$date/;
             $updated = 1;
         }
     } elsif ($mode eq 'metric') {
         if ($description =~ /$METRIC_DATE/) { # dd/mm/yyyy
-            my $date = eval { output_pref( { dt => dt_from_string( $1 ), dateonly => 1, dateformat => 'metric' } ); };
+            my $date = output_pref( { dt => dt_from_string( $1, 'metric' ), dateonly => 1} );
             print "Converting $1 (metric) to " . $date . "\n" if $DEBUG;
             $description =~ s/$METRIC_DATE/$date/;
             $updated = 2;