Bug 14969: Remove C4::Dates from serials/*.pl files
[koha.git] / serials / serials-edit.pl
index 9b6f5d0..efd9c78 100755 (executable)
@@ -66,7 +66,6 @@ use warnings;
 use CGI qw ( -utf8 );
 use Encode qw( decode is_utf8 );
 use C4::Auth;
-use C4::Dates qw/format_date format_date_in_iso/;
 use C4::Biblio;
 use C4::Items;
 use C4::Koha;
@@ -74,6 +73,8 @@ use C4::Output;
 use C4::Context;
 use C4::Serials;
 use C4::Search qw/enabled_staff_search_views/;
+use Koha::DateUtils;
+
 use List::MoreUtils qw/uniq/;
 
 my $query           = CGI->new();
@@ -127,7 +128,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 my @serialdatalist;
 my %processedserialid;
 
-my $today = C4::Dates->new();
+my $today = output_pref( dt_from_string );
 foreach my $serialid (@serialids) {
 
     #filtering serialid for duplication
@@ -143,10 +144,10 @@ foreach my $serialid (@serialids) {
                 $serinfo->{$d} = q{};
             }
             else {
-                $serinfo->{$d} = format_date( $serinfo->{$d} );
+                $serinfo->{$d} = output_pref( { dt => dt_from_string( $serinfo->{$d} ), dateonly => 1 } );
             }
         }
-        $serinfo->{arriveddate}=$today->output('syspref');
+        $serinfo->{arriveddate} = $today;
 
         $serinfo->{'editdisable'} = (
             (
@@ -187,7 +188,7 @@ foreach my $subscriptionid (@subscriptionids) {
         $cell->{'itemid'}         = 'NNEW';
         $cell->{'serialid'}       = 'NEW';
         $cell->{'issuesatonce'}   = 1;
-        $cell->{arriveddate}=$today->output('syspref');
+        $cell->{arriveddate}      = $today;
 
         push @newserialloop, $cell;
         push @subscriptionloop,
@@ -214,10 +215,10 @@ if ( $op and $op eq 'serialchangestatus' ) {
         my ($plan_date, $pub_date);
 
         if (defined $planneddates[$i] && $planneddates[$i] ne 'XXX') {
-            $plan_date = format_date_in_iso( $planneddates[$i] );
+            $plan_date = eval { output_pref( { dt => dt_from_string( $planneddates[$i] ), dateonly => 1, dateformat => 'iso' } ); };
         }
         if (defined $publisheddates[$i] && $publisheddates[$i] ne 'XXX') {
-            $pub_date = format_date_in_iso( $publisheddates[$i] );
+            $pub_date = eval { output_pref( { dt => dt_from_string( $publisheddates[$i] ), dateonly => 1, dateformat => 'iso' } ); };
         }
 
         if ( $serialids[$i] && $serialids[$i] eq 'NEW' ) {