From 5dceb851dd8b186dd6a9b4bf4e032bbe1ea81865 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Thu, 12 Mar 2015 15:00:11 +0100 Subject: [PATCH] Bug 13813: Remove deprecated module C4::Dates from system Test plan: See Bugzilla. Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- C4/Acquisition.pm | 5 ++-- C4/Barcodes.pm | 1 - C4/Barcodes/annual.pm | 13 +++++----- C4/Barcodes/hbyymmincr.pm | 27 ++++++++++---------- C4/Biblio.pm | 1 - C4/HoldsQueue.pm | 1 - C4/Items.pm | 16 ++++++------ C4/Log.pm | 6 ++--- C4/NewsChannels.pm | 8 +++--- C4/Output.pm | 1 - C4/Suggestions.pm | 9 +++---- Koha/Borrower/Files.pm | 1 - Koha/Misc/Files.pm | 1 - cataloguing/value_builder/barcode.pl | 4 +-- cataloguing/value_builder/barcode_manual.pl | 4 +-- cataloguing/value_builder/dateaccessioned.pl | 5 ++-- circ/transferstoreceive.pl | 4 +-- circ/waitingreserves.pl | 5 ++-- members/notices.pl | 1 - members/printinvoice.pl | 4 +-- members/readingrec.pl | 5 +--- opac/opac-messaging.pl | 1 - opac/opac-privacy.pl | 1 - opac/opac-user.pl | 4 ++- tags/list.pl | 1 - tools/koha-news.pl | 6 ++--- tools/scheduler.pl | 6 ++--- tools/viewlog.pl | 1 - 28 files changed, 63 insertions(+), 79 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 0118b7c99f..4a7cad0b0a 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -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 diff --git a/C4/Barcodes.pm b/C4/Barcodes.pm index 0872056c6f..35c5d6a97b 100644 --- a/C4/Barcodes.pm +++ b/C4/Barcodes.pm @@ -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; diff --git a/C4/Barcodes/annual.pm b/C4/Barcodes/annual.pm index cb62b584dc..eb1b1e19f6 100644 --- a/C4/Barcodes/annual.pm +++ b/C4/Barcodes/annual.pm @@ -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 { diff --git a/C4/Barcodes/hbyymmincr.pm b/C4/Barcodes/hbyymmincr.pm index c2a6d3848a..6845284bf4 100644 --- a/C4/Barcodes/hbyymmincr.pm +++ b/C4/Barcodes/hbyymmincr.pm @@ -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); } diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 9b839621ff..08c0c7184b 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -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; diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index 653b065455..13cb295e9e 100755 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -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); diff --git a/C4/Items.pm b/C4/Items.pm index a78c9c4023..fe6905cf98 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -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 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'}, diff --git a/C4/Log.pm b/C4/Log.pm index f92504012d..d6926c0e3d 100644 --- 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 = " diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index 8694c1b964..f7fa1d790f 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -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; diff --git a/C4/Output.pm b/C4/Output.pm index 1dbdbee973..a5f0dabdd7 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -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); diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index b5af96e05a..02e32b9672 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -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 }); } } diff --git a/Koha/Borrower/Files.pm b/Koha/Borrower/Files.pm index 7084c1e125..028757d089 100644 --- a/Koha/Borrower/Files.pm +++ b/Koha/Borrower/Files.pm @@ -23,7 +23,6 @@ use vars qw($VERSION); use C4::Context; use C4::Output; -use C4::Dates; use C4::Debug; BEGIN { diff --git a/Koha/Misc/Files.pm b/Koha/Misc/Files.pm index 1aaf04f298..e358f28b58 100644 --- a/Koha/Misc/Files.pm +++ b/Koha/Misc/Files.pm @@ -25,7 +25,6 @@ $VERSION = '0.25'; use C4::Context; use C4::Output; -use C4::Dates; =head1 NAME diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index e8e94cd142..b1b4f619b6 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -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", ''); diff --git a/cataloguing/value_builder/barcode_manual.pl b/cataloguing/value_builder/barcode_manual.pl index dfe0419eb4..6bf5ac4df7 100755 --- a/cataloguing/value_builder/barcode_manual.pl +++ b/cataloguing/value_builder/barcode_manual.pl @@ -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", ''); diff --git a/cataloguing/value_builder/dateaccessioned.pl b/cataloguing/value_builder/dateaccessioned.pl index 6ed5775edf..5244a1e62d 100755 --- a/cataloguing/value_builder/dateaccessioned.pl +++ b/cataloguing/value_builder/dateaccessioned.pl @@ -18,15 +18,14 @@ # along with Koha; if not, see . 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",""); diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index 1beb6b33fb..30bceaadda 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -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, ); diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl index 547164355f..a8d3fe4700 100755 --- a/circ/waitingreserves.pl +++ b/circ/waitingreserves.pl @@ -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') ); diff --git a/members/notices.pl b/members/notices.pl index be1e37c31c..82b9a3fc25 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -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; diff --git a/members/printinvoice.pl b/members/printinvoice.pl index d9b1307024..2175437e97 100755 --- a/members/printinvoice.pl +++ b/members/printinvoice.pl @@ -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'}, diff --git a/members/readingrec.pl b/members/readingrec.pl index 62e653e876..20860c2bf1 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -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 = diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index 622f9cee24..718a86e62e 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -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; diff --git a/opac/opac-privacy.pl b/opac/opac-privacy.pl index 09ca341d2e..2f660ac4de 100755 --- a/opac/opac-privacy.pl +++ b/opac/opac-privacy.pl @@ -24,7 +24,6 @@ use C4::Context; use C4::Circulation; use C4::Members; use C4::Output; -use C4::Dates; my $query = new CGI; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index d4fbbe31c2..28e73de023 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -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; diff --git a/tags/list.pl b/tags/list.pl index 2d5c5c8836..cbc1bd34a2 100755 --- a/tags/list.pl +++ b/tags/list.pl @@ -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); diff --git a/tools/koha-news.pl b/tools/koha-news.pl index cf1e2b40e7..debe53365c 100755 --- a/tools/koha-news.pl +++ b/tools/koha-news.pl @@ -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'); diff --git a/tools/scheduler.pl b/tools/scheduler.pl index 019886a1df..cb1bad3078 100755 --- a/tools/scheduler.pl +++ b/tools/scheduler.pl @@ -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; diff --git a/tools/viewlog.pl b/tools/viewlog.pl index a13ec5faf2..a8ac49fb16 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -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; -- 2.39.5