Bug 13813: Remove deprecated module C4::Dates from system
authorMarc Véron <veron@veron.ch>
Thu, 12 Mar 2015 14:00:11 +0000 (15:00 +0100)
committerTomas Cohen Arazi <tomascohen@unc.edu.ar>
Fri, 18 Sep 2015 15:40:55 +0000 (12:40 -0300)
Test plan: See Bugzilla.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
28 files changed:
C4/Acquisition.pm
C4/Barcodes.pm
C4/Barcodes/annual.pm
C4/Barcodes/hbyymmincr.pm
C4/Biblio.pm
C4/HoldsQueue.pm
C4/Items.pm
C4/Log.pm
C4/NewsChannels.pm
C4/Output.pm
C4/Suggestions.pm
Koha/Borrower/Files.pm
Koha/Misc/Files.pm
cataloguing/value_builder/barcode.pl
cataloguing/value_builder/barcode_manual.pl
cataloguing/value_builder/dateaccessioned.pl
circ/transferstoreceive.pl
circ/waitingreserves.pl
members/notices.pl
members/printinvoice.pl
members/readingrec.pl
opac/opac-messaging.pl
opac/opac-privacy.pl
opac/opac-user.pl
tags/list.pl
tools/koha-news.pl
tools/scheduler.pl
tools/viewlog.pl

index 0118b7c..4a7cad0 100644 (file)
@@ -22,7 +22,6 @@ use Modern::Perl;
 use Carp;
 use C4::Context;
 use C4::Debug;
-use C4::Dates qw(format_date format_date_in_iso);
 use C4::Suggestions;
 use C4::Biblio;
 use C4::Contract;
@@ -1393,7 +1392,7 @@ sub ModReceiveOrder {
     my $order_vendornote = $params->{order_vendornote};
 
     my $dbh = C4::Context->dbh;
-    $datereceived = C4::Dates->output('iso') unless $datereceived;
+    $datereceived = output_pref({ dt=>dt_from_string, dateonly=>1, dateformat=>'iso' }) unless $datereceived;
     my $suggestionid = GetSuggestionFromBiblionumber( $biblionumber );
     if ($suggestionid) {
         ModSuggestion( {suggestionid=>$suggestionid,
@@ -2719,7 +2718,7 @@ sub CloseInvoice {
 
 Reopen an invoice
 
-Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => C4::Dates->new()->output('iso'))
+Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => output_pref({ dt=>dt_from_string, dateonly=>1, otputpref=>'iso' }))
 
 =cut
 
index 0872056..35c5d6a 100644 (file)
@@ -24,7 +24,6 @@ use Carp;
 
 use C4::Context;
 use C4::Debug;
-use C4::Dates;
 use C4::Barcodes::hbyymmincr;
 use C4::Barcodes::annual;
 use C4::Barcodes::incremental;
index cb62b58..eb1b1e1 100644 (file)
@@ -24,7 +24,8 @@ use Carp;
 
 use C4::Context;
 use C4::Debug;
-use C4::Dates;
+
+use Koha::DateUtils qw( output_pref dt_from_string );
 
 use vars qw($VERSION @ISA);
 use vars qw($debug $cgi_debug);        # from C4::Debug, of course
@@ -44,13 +45,13 @@ sub db_max ($;$) {
        my ($iso);
        if (@_) {
                my $input = shift;
-               $iso = C4::Dates->new($input,'iso')->output('iso'); # try to set the date w/ 2nd arg
+        $iso = output_pref({ dt => dt_from_string( $input, 'iso' ), dateformat => 'iso', dateonly => 1 }); # try to set the date w/ 2nd arg
                unless ($iso) {
                        warn "Failed to create 'iso' Dates object with input '$input'.  Reverting to today's date.";
-                       $iso = C4::Dates->new->output('iso');   # failover back to today
+            $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });  # failover back to today
                }
        } else {
-               $iso = C4::Dates->new->output('iso');
+        $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
        }
        my $year = substr($iso,0,4);    # YYYY
        $sth->execute("$year-%");
@@ -61,7 +62,7 @@ sub db_max ($;$) {
 
 sub initial () {
        my $self = shift;
-       return substr(C4::Dates->new->output('iso'),0,4) .'-'. sprintf('%'."$width.$width".'d', 1);
+    return substr(output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 0, 4 ) .'-'. sprintf('%'."$width.$width".'d', 1);
 }
 
 sub parse ($;$) {
@@ -82,7 +83,7 @@ sub width ($;$) {
 sub process_head($$;$$) {      # (self,head,whole,specific)
        my ($self,$head,$whole,$specific) = @_;
        $specific and return $head;     # if this is built off an existing barcode, just return the head unchanged.
-       return substr(C4::Dates->new->output('iso'),0,4) . '-'; # else get new YYYY-
+    return substr(output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), 0, 4 ) . '-';     # else get new YYYY-
 }
 
 sub new_object {
index c2a6d38..6845284 100644 (file)
@@ -24,7 +24,8 @@ use Carp;
 
 use C4::Context;
 use C4::Debug;
-use C4::Dates;
+
+use Koha::DateUtils qw( dt_from_string output_pref );
 
 use vars qw($VERSION @ISA);
 use vars qw($debug $cgi_debug);        # from C4::Debug, of course
@@ -48,16 +49,16 @@ sub db_max {
        $debug and print STDERR "(hbyymmincr) db_max query: $query\n";
        my $sth = C4::Context->dbh->prepare($query);
        my ($iso);
-       if (@_) {
-               my $input = shift;
-               $iso = C4::Dates->new($input,'iso')->output('iso'); # try to set the date w/ 2nd arg
-               unless ($iso) {
-                       warn "Failed to create 'iso' Dates object with input '$input'.  Reverting to today's date.";
-                       $iso = C4::Dates->new->output('iso');   # failover back to today
-               }
-       } else {
-               $iso = C4::Dates->new->output('iso');
-       }
+        if (@_) {
+                my $input = shift;
+                $iso = output_pref({ dt => dt_from_string( $input, 'iso' ), dateformat => 'iso', dateonly => 1 }); # try to set the date w/ 2nd arg
+                unless ($iso) {
+                        warn "Failed to create 'iso' Dates object with input '$input'.  Reverting to today's date.";
+                        $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });      # failover back to today
+                }
+        } else {
+                $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
+        }
        my $year = substr($iso,2,2);    # i.e. "08" for 2008
        my $andtwo = $width+2;
        $sth->execute("^[a-zA-Z]{1,}" . $year . "[0-9]{$andtwo}");      # the extra two digits are the month.  we don't care what they are, just that they are there.
@@ -74,7 +75,7 @@ sub db_max {
 sub initial {
        my $self = shift;
        # FIXME: populated branch?
-       my $iso = C4::Dates->new->output('iso');        # like "2008-07-02"
+    my $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });       # like "2008-07-02"
        return $self->branch . substr($iso,2,2) . substr($iso,5,2) . sprintf('%' . "$width.$width" . 'd',1);
 }
 
@@ -104,7 +105,7 @@ sub process_head {  # (self,head,whole,specific)
        my ($self,$head,$whole,$specific) = @_;
        $specific and return $head;     # if this is built off an existing barcode, just return the head unchanged.
        $head =~ s/\d{4}$//;            # else strip the old yymm
-       my $iso = C4::Dates->new->output('iso');        # like "2008-07-02"
+    my $iso = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });       # like "2008-07-02"
        return $head . substr($iso,2,2) . substr($iso,5,2);
 }
 
index 9b83962..08c0c71 100644 (file)
@@ -31,7 +31,6 @@ use POSIX qw(strftime);
 use Module::Load::Conditional qw(can_load);
 
 use C4::Koha;
-use C4::Dates qw/format_date/;
 use C4::Log;    # logaction
 use C4::Budgets;
 use C4::ClassSource;
index 653b065..13cb295 100755 (executable)
@@ -29,7 +29,6 @@ use C4::Branch;
 use C4::Circulation;
 use C4::Members;
 use C4::Biblio;
-use C4::Dates qw/format_date/;
 
 use List::Util qw(shuffle);
 use List::MoreUtils qw(any);
index a78c9c4..fe6905c 100644 (file)
@@ -25,7 +25,7 @@ use Carp;
 use C4::Context;
 use C4::Koha;
 use C4::Biblio;
-use C4::Dates qw/format_date format_date_in_iso/;
+use Koha::DateUtils;
 use MARC::Record;
 use C4::ClassSource;
 use C4::Log;
@@ -648,8 +648,8 @@ C<$itemnum> is the item number
 sub ModDateLastSeen {
     my ($itemnumber) = @_;
     
-    my $today = C4::Dates->new();    
-    ModItem({ itemlost => 0, datelastseen => $today->output("iso") }, undef, $itemnumber);
+    my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
+    ModItem({ itemlost => 0, datelastseen => $today }, undef, $itemnumber);
 }
 
 =head2 DelItem
@@ -2128,7 +2128,7 @@ C<items.withdrawn>
 
 sub _set_defaults_for_add {
     my $item = shift;
-    $item->{dateaccessioned} ||= C4::Dates->new->output('iso');
+    $item->{dateaccessioned} ||= output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
     $item->{$_} ||= 0 for (qw( notforloan damaged itemlost withdrawn));
 }
 
@@ -2162,7 +2162,7 @@ sub _koha_new_item {
             notforloan          = ?,
             damaged             = ?,
             itemlost            = ?,
-            withdrawn            = ?,
+            withdrawn           = ?,
             itemcallnumber      = ?,
             coded_location_qualifier = ?,
             restricted          = ?,
@@ -2171,7 +2171,7 @@ sub _koha_new_item {
             holdingbranch       = ?,
             paidfor             = ?,
             location            = ?,
-            permanent_location            = ?,
+            permanent_location  = ?,
             onloan              = ?,
             issues              = ?,
             renewals            = ?,
@@ -2181,14 +2181,14 @@ sub _koha_new_item {
             ccode               = ?,
             itype               = ?,
             materials           = ?,
-            uri = ?,
+            uri                 = ?,
             enumchron           = ?,
             more_subfields_xml  = ?,
             copynumber          = ?,
             stocknumber         = ?
           ";
     my $sth = $dbh->prepare($query);
-    my $today = C4::Dates->today('iso');
+    my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
    $sth->execute(
             $item->{'biblionumber'},
             $item->{'biblioitemnumber'},
index f925040..d6926c0 100644 (file)
--- a/C4/Log.pm
+++ b/C4/Log.pm
@@ -25,7 +25,7 @@ use strict;
 use warnings;
 
 use C4::Context;
-use C4::Dates qw(format_date);
+use Koha::DateUtils;
 
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -220,8 +220,8 @@ sub GetLogs {
     my $object   = shift;
     my $info     = shift;
    
-    my $iso_datefrom = C4::Dates->new($datefrom,C4::Context->preference("dateformat"))->output('iso');
-    my $iso_dateto = C4::Dates->new($dateto,C4::Context->preference("dateformat"))->output('iso');
+    my $iso_datefrom = output_pref({ dt => dt_from_string( $datefrom ), dateformat => 'iso', dateonly => 1 });
+    my $iso_dateto = output_pref({ dt => dt_from_string( $dateto ), dateformat => 'iso', dateonly => 1 });
 
     my $dbh = C4::Context->dbh;
     my $query = "
index 8694c1b..f7fa1d7 100644 (file)
@@ -20,7 +20,7 @@ package C4::NewsChannels;
 
 use Modern::Perl;
 use C4::Context;
-use C4::Dates qw(format_date);
+use Koha::DateUtils;
 
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -135,8 +135,8 @@ sub get_opac_new {
     $sth->execute($idnew);
     my $data = $sth->fetchrow_hashref;
     $data->{$data->{'lang'}} = 1 if defined $data->{lang};
-    $data->{expirationdate} = format_date($data->{expirationdate});
-    $data->{timestamp}      = format_date($data->{timestamp});
+    $data->{expirationdate} = output_pref({ dt => dt_from_string( $data->{expirationdate} ), dateonly => 1 });
+    $data->{timestamp}      = output_pref({ dt => dt_from_string( $data->{timestamp} ), dateonly => 1 }) ;
     return $data;
 }
 
@@ -209,7 +209,7 @@ sub GetNewsToDisplay {
     $sth->execute($lang,$branch);
     my @results;
     while ( my $row = $sth->fetchrow_hashref ){
-        $row->{newdate} = format_date($row->{newdate});
+        $row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 });
         push @results, $row;
     }
     return \@results;
index 1dbdbee..a5f0dab 100644 (file)
@@ -31,7 +31,6 @@ use strict;
 use URI::Escape;
 
 use C4::Context;
-use C4::Dates qw(format_date);
 use C4::Templates;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
index b5af96e..02e32b9 100644 (file)
@@ -25,13 +25,11 @@ use CGI qw ( -utf8 );
 
 use C4::Context;
 use C4::Output;
-use C4::Dates qw(format_date format_date_in_iso);
 use C4::Debug;
 use C4::Letters;
-use Koha::DateUtils qw( dt_from_string );
+use Koha::DateUtils;
 
 use List::MoreUtils qw(any);
-use C4::Dates qw(format_date_in_iso);
 use base qw(Exporter);
 
 our $VERSION = 3.07.00.049;
@@ -176,16 +174,15 @@ sub SearchSuggestion {
     }
 
     # filter on date fields
-    my $today = C4::Dates->today('iso');
     foreach my $field (qw( suggesteddate manageddate accepteddate )) {
         my $from = $field . "_from";
         my $to   = $field . "_to";
         if ( $suggestion->{$from} || $suggestion->{$to} ) {
             push @query, qq{ AND suggestions.$field BETWEEN ? AND ? };
             push @sql_params,
-              format_date_in_iso( $suggestion->{$from} ) || '0000-00-00';
+              output_pref({ dt => dt_from_string( $suggestion->{$from} ), dateformat => 'iso', dateonly => 1 }) || '0000-00-00';
             push @sql_params,
-              format_date_in_iso( $suggestion->{$to} ) || $today;
+              output_pref({ dt => dt_from_string( $suggestion->{$to} ), dateformat => 'iso', dateonly => 1 }) || output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
         }
     }
 
index 7084c1e..028757d 100644 (file)
@@ -23,7 +23,6 @@ use vars qw($VERSION);
 
 use C4::Context;
 use C4::Output;
-use C4::Dates;
 use C4::Debug;
 
 BEGIN {
index 1aaf04f..e358f28 100644 (file)
@@ -25,7 +25,6 @@ $VERSION = '0.25';
 
 use C4::Context;
 use C4::Output;
-use C4::Dates;
 
 =head1 NAME
 
index e8e94cd..b1b4f61 100755 (executable)
@@ -23,7 +23,7 @@ no warnings 'redefine'; # otherwise loading up multiple plugins fills the log wi
 
 use C4::Context;
 require C4::Barcodes::ValueBuilder;
-require C4::Dates;
+use Koha::DateUtils;
 
 use Algorithm::CheckDigits;
 
@@ -35,7 +35,7 @@ sub plugin_javascript {
     my %args;
 
        # find today's date
-    ($args{year}, $args{mon}, $args{day}) = split('-', C4::Dates->today('iso'));
+    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
     ($args{tag},$args{subfield})       =  GetMarcFromKohaField("items.barcode", '');
     ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField("items.homebranch", '');
 
index dfe0419..6bf5ac4 100755 (executable)
@@ -23,7 +23,7 @@ no warnings 'redefine'; # otherwise loading up multiple plugins fills the log wi
 
 use C4::Context;
 require C4::Barcodes::ValueBuilder;
-require C4::Dates;
+use Koha::DateUtils;
 
 my $DEBUG = 0;
 
@@ -35,7 +35,7 @@ sub plugin_javascript {
     $args{dbh} = $dbh;
 
 # find today's date
-    ($args{year}, $args{mon}, $args{day}) = split('-', C4::Dates->today('iso'));
+    ($args{year}, $args{mon}, $args{day}) = split('-', output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }));
     ($args{tag},$args{subfield})       =  GetMarcFromKohaField("items.barcode", '');
     ($args{loctag},$args{locsubfield}) =  GetMarcFromKohaField("items.homebranch", '');
 
index 6ed5775..5244a1e 100755 (executable)
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-
+use Koha::DateUtils;
 no warnings 'redefine';
 
 sub plugin_javascript {
        # my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
        my $function_name = "dateaccessioned".(int(rand(100000))+1);
 
-    require C4::Dates;
-       my $date = C4::Dates->today('iso');
+    my $date = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
 
        # find the tag/subfield mapped to items.dateaccessioned
        my ($tag,$subfield) =  GetMarcFromKohaField("items.dateaccessioned","");
index 1beb6b3..30bceaa 100755 (executable)
@@ -25,7 +25,7 @@ use C4::Context;
 use C4::Output;
 use C4::Branch;     # GetBranches
 use C4::Auth;
-use C4::Dates qw/format_date/;
+use Koha::DateUtils;
 use C4::Biblio;
 use C4::Circulation;
 use C4::Members;
@@ -119,7 +119,7 @@ foreach my $br ( keys %$branches ) {
 
 $template->param(
     branchesloop => \@branchesloop,
-    show_date    => format_date(C4::Dates->today('iso')),
+    show_date    => output_pref({ dt => dt_from_string, dateonly => 1 }),
        TransfersMaxDaysWarning => C4::Context->preference('TransfersMaxDaysWarning'),
        latetransfers => $latetransfers ? 1 : 0,
 );
index 5471643..a8d3fe4 100755 (executable)
@@ -25,12 +25,11 @@ use C4::Context;
 use C4::Output;
 use C4::Branch; # GetBranchName
 use C4::Auth;
-use C4::Dates qw/format_date/;
 use C4::Circulation;
 use C4::Members;
 use C4::Biblio;
 use C4::Items;
-
+use Koha::DateUtils;
 use Date::Calc qw(
   Today
   Add_Delta_Days
@@ -158,7 +157,7 @@ $template->param(
     reservecount => $reservcount,
     overloop    => \@overloop,
     overcount   => $overcount,
-    show_date   => format_date(C4::Dates->today('iso')),
+    show_date   => output_pref({ dt => dt_from_string, dateonly => 1 }),
     ReservesMaxPickUpDelay => C4::Context->preference('ReservesMaxPickUpDelay')
 );
 
index be1e37c..82b9a3f 100755 (executable)
@@ -29,7 +29,6 @@ use C4::Branch;
 use C4::Letters;
 use C4::Members::Attributes qw(GetBorrowerAttributes);
 
-use C4::Dates qw/format_date/;
 my $input=new CGI;
 
 
index d9b1307..2175437 100755 (executable)
@@ -25,7 +25,7 @@ use warnings;
 
 use C4::Auth;
 use C4::Output;
-use C4::Dates qw/format_date/;
+use Koha::DateUtils;
 use CGI qw ( -utf8 );
 use C4::Members;
 use C4::Branch;
@@ -89,7 +89,7 @@ for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
     }
 
     my %row = (
-        'date'                    => format_date( $accts->[$i]{'date'} ),
+        'date'                    => output_pref({ dt => dt_from_string( $accts->[$i]{'date'}, 'iso' ), dateonly => 1 }),
         'amountcredit'            => $accts->[$i]{'amountcredit'},
         'amountoutstandingcredit' => $accts->[$i]{'amountoutstandingcredit'},
         'toggle'                  => $accts->[$i]{'toggle'},
index 62e653e..20860c2 100755 (executable)
@@ -31,8 +31,6 @@ use C4::Members;
 use C4::Branch qw(GetBranches);
 use List::MoreUtils qw/any uniq/;
 use Koha::DateUtils;
-
-use C4::Dates qw/format_date/;
 use C4::Members::Attributes qw(GetBorrowerAttributes);
 
 my $input = CGI->new;
@@ -77,8 +75,7 @@ my $branches = GetBranches();
 
 #   barcode export
 if ( $op eq 'export_barcodes' ) {
-    my $today = C4::Dates->new();
-    $today = $today->output('iso');
+    my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 });
     my @barcodes =
       map { $_->{barcode} } grep { $_->{returndate} =~ m/^$today/o } @{$issues};
     my $borrowercardnumber =
index 622f9ce..718a86e 100755 (executable)
@@ -27,7 +27,6 @@ use C4::Context;
 use C4::Koha;
 use C4::Circulation;
 use C4::Output;
-use C4::Dates qw/format_date/;
 use C4::Members;
 use C4::Members::Messaging;
 use C4::Branch;
index 09ca341..2f660ac 100755 (executable)
@@ -24,7 +24,6 @@ use C4::Context;
 use C4::Circulation;
 use C4::Members;
 use C4::Output;
-use C4::Dates;
 
 my $query = new CGI;
 
index d4fbbe3..28e73de 100755 (executable)
@@ -292,7 +292,9 @@ foreach my $res (@reserves) {
     if ($show_priority) {
         $res->{'priority'} ||= '';
     }
-    $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} );
+    if ( $res->{'suspend_until'} ) {
+        $res->{'suspend_until'} = output_pref({ dt => dt_from_string( $res->{'suspend_until'} , 'iso' ), dateonly => 1 });
+    }
 }
 
 # use Data::Dumper;
index 2d5c5c8..cbc1bd3 100755 (executable)
@@ -24,7 +24,6 @@ use CGI qw ( -utf8 );
 use C4::Auth qw(:DEFAULT check_cookie_auth);
 use C4::Biblio;
 use C4::Context;
-use C4::Dates qw(format_date);
 use C4::Items;
 use C4::Koha;
 use C4::Tags qw(get_tags remove_tag get_tag_rows);
index cf1e2b4..debe533 100755 (executable)
@@ -28,20 +28,20 @@ use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Koha;
 use C4::Context;
-use C4::Dates qw(format_date_in_iso);
 use C4::Output;
 use C4::NewsChannels;
 use C4::Languages qw(getTranslatedLanguages);
 use Date::Calc qw/Date_to_Days Today/;
 use C4::Branch qw/GetBranches/;
+use Koha::DateUtils;
 
 my $cgi = new CGI;
 
 my $id             = $cgi->param('id');
 my $title          = $cgi->param('title');
 my $new            = $cgi->param('new');
-my $expirationdate = format_date_in_iso($cgi->param('expirationdate'));
-my $timestamp      = format_date_in_iso($cgi->param('timestamp'));
+my $expirationdate = output_pref({ dt => dt_from_string( $cgi->param('expirationdate') ), dateformat => 'iso', dateonly => 1 });
+my $timestamp      = output_pref({ dt => dt_from_string( $cgi->param('timestamp') ), dateformat => 'iso', dateonly => 1 });
 my $number         = $cgi->param('number');
 my $lang           = $cgi->param('lang');
 my $branchcode     = $cgi->param('branch');
index 019886a..cb1bad3 100755 (executable)
@@ -25,7 +25,7 @@ use C4::Reports::Guided;
 use C4::Auth;
 use CGI qw ( -utf8 );
 use C4::Output;
-use C4::Dates;
+use Koha::DateUtils;;
 
 use vars qw($debug);
 
@@ -62,10 +62,10 @@ my $id   = $input->param('id');
 if ( $mode eq 'job_add' ) {
 
     # Retrieving the date according to the dateformat syspref
-    my $c4date = C4::Dates->new($input->param('startdate'));
+    my $c4date = output_pref({ dt => dt_from_string( $input->param('startdate') ), dateformat => 'iso', dateonly => 1 });
 
     # Formatting it for Schedule::At
-    my $startdate = join('', (split /-/, $c4date->output("iso")));
+    my $startdate = join('', (split /-/, $c4date));
 
     my $starttime = $input->param('starttime');
     $starttime =~ s/\://g;
index a13ec5f..a8ac49f 100755 (executable)
@@ -25,7 +25,6 @@ use CGI qw ( -utf8 );
 use Text::CSV::Encoded;
 use C4::Context;
 use C4::Koha;
-use C4::Dates;
 use C4::Output;
 use C4::Log;
 use C4::Items;