From 7a46b1599e3a7600e4383ad11932b98e3c5eca06 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marc=20V=C3=A9ron?= Date: Mon, 5 Oct 2015 14:38:08 +0200 Subject: [PATCH] Bug 14956: C4::Dates from files opac/*.pl Remove C4::Dates from files: - opac/opac-memberentry.pl - opac/opac-reserve.pl - opac/opac-search-history.pl - opac/opac-showreviews.pl - opac/opac-suggestions.pl - opac/opac-serial-issues.pl - opac/opac-alert-subscribe.pl - opac/opac-ics.pl To test: - Apply patch - Verify, that self registration and holds work as before - Verify that tabs in catalog item detail work and display as before - For serials: Verify that subscriptions work as before. It is a little bit hidden, in tab Subscriptions, then 'More details', then tab 'Brief history', button 'Subscribe to email notificatin on new issues' - For ics: Can not be tested at the moment, not yet used (Bug 5456), pls. have a look at the code changes (Amended following comment #2) Signed-off-by: Hector Castro Works as advertised Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- opac/opac-alert-subscribe.pl | 1 - opac/opac-ics.pl | 1 - opac/opac-memberentry.pl | 10 +++++++--- opac/opac-reserve.pl | 5 ++--- opac/opac-search-history.pl | 2 +- opac/opac-serial-issues.pl | 1 - opac/opac-showreviews.pl | 11 ++++++----- opac/opac-suggestions.pl | 1 - 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/opac/opac-alert-subscribe.pl b/opac/opac-alert-subscribe.pl index 2a614f2f7f..86a72fe32c 100755 --- a/opac/opac-alert-subscribe.pl +++ b/opac/opac-alert-subscribe.pl @@ -23,7 +23,6 @@ use warnings; use CGI qw ( -utf8 ); use C4::Auth; -use C4::Dates; use C4::Output; use C4::Context; use C4::Koha; diff --git a/opac/opac-ics.pl b/opac/opac-ics.pl index fe87409afb..0f5cbf9d06 100755 --- a/opac/opac-ics.pl +++ b/opac/opac-ics.pl @@ -35,7 +35,6 @@ use C4::Auth; use C4::Koha; use C4::Circulation; use C4::Members; -use C4::Dates; my $query = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 9a18afa47a..22fb843dee 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -29,6 +29,7 @@ use Koha::Borrower::Modifications; use C4::Branch qw(GetBranchesLoop); use C4::Scrubber; use Email::Valid; +use Koha::DateUtils; my $cgi = new CGI; my $dbh = C4::Context->dbh; @@ -331,9 +332,12 @@ sub ParseCgiForBorrower { } } - $borrower{'dateofbirth'} = - C4::Dates->new( $borrower{'dateofbirth'} )->output("iso") - if ( defined( $borrower{'dateofbirth'} ) ); + my $dob_dt; + $dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); } + if ( defined( $borrower{'dateofbirth'} ) ); + + $borrower{'dateofbirth'} = output_pref ( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' }) + if ( $dob_dt ); return %borrower; } diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index f0843a236c..60232cc6ee 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -28,7 +28,6 @@ use C4::Reserves; use C4::Biblio; use C4::Items; use C4::Output; -use C4::Dates qw/format_date/; use C4::Context; use C4::Members; use C4::Branch; # GetBranches @@ -467,7 +466,7 @@ foreach my $biblioNum (@biblionumbers) { if ( defined $reservedate ) { $itemLoopIter->{backgroundcolor} = 'reserved'; - $itemLoopIter->{reservedate} = format_date($reservedate); + $itemLoopIter->{reservedate} = output_pref({ dt => dt_from_string($reservedate), dateonly => 1 }); $itemLoopIter->{ReservedForBorrowernumber} = $reservedfor; $itemLoopIter->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'}; $itemLoopIter->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'}; @@ -501,7 +500,7 @@ foreach my $biblioNum (@biblionumbers) { my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itemNum); if ( $transfertwhen && ($transfertwhen ne '') ) { - $itemLoopIter->{transfertwhen} = format_date($transfertwhen); + $itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfertwhen), dateonly => 1 }); $itemLoopIter->{transfertfrom} = $branches->{$transfertfrom}{branchname}; $itemLoopIter->{transfertto} = $branches->{$transfertto}{branchname}; diff --git a/opac/opac-search-history.pl b/opac/opac-search-history.pl index 486bd08fae..0364960c46 100755 --- a/opac/opac-search-history.pl +++ b/opac/opac-search-history.pl @@ -26,8 +26,8 @@ use C4::Output; use C4::Log; use C4::Items; use C4::Debug; -use C4::Dates; use C4::Search::History; + use URI::Escape; use POSIX qw(strftime); diff --git a/opac/opac-serial-issues.pl b/opac/opac-serial-issues.pl index 15c4471348..fad612767d 100755 --- a/opac/opac-serial-issues.pl +++ b/opac/opac-serial-issues.pl @@ -24,7 +24,6 @@ use warnings; use CGI qw ( -utf8 ); use C4::Auth; use C4::Koha; -use C4::Dates; use C4::Serials; use C4::Letters; use C4::Output; diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index 33025711f5..628fec8659 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -28,8 +28,8 @@ use C4::Output; use C4::Circulation; use C4::Review; use C4::Biblio; -use C4::Dates; use C4::Members qw/GetMemberDetails/; +use Koha::DateUtils; use POSIX qw(ceil strftime); my $template_name; @@ -57,8 +57,8 @@ my ( $template, $borrowernumber, $cookie ) = &get_template_and_user( ); if($format eq "rss"){ - my $lastbuilddate = C4::Dates->new(); - my $lastbuilddate_output = $lastbuilddate->output("rfc822"); + my $lastbuilddate = dt_from_string; + my $lastbuilddate_output = $lastbuilddate->strftime("%a, %d %b %Y %H:%M:%S %z"); $template->param( rss => 1, timestamp => $lastbuilddate_output @@ -114,8 +114,9 @@ for my $result (@$reviews){ } if($format eq "rss"){ - my $rsstimestamp = C4::Dates->new($result->{datereviewed},"iso"); - my $rsstimestamp_output = $rsstimestamp->output("rfc822"); + my $rsstimestamp = eval { dt_from_string( $result->{datereviewed} ); }; + $rsstimestamp = dt_from_string unless ( $rsstimestamp ); #default to today if something went wrong + my $rsstimestamp_output = $rsstimestamp->strftime("%a, %d %b %Y %H:%M:%S %z"); $result->{timestamp} = $rsstimestamp_output; } } diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index e00fd9c77e..83b12f1d37 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -27,7 +27,6 @@ use C4::Koha; use C4::Output; use C4::Suggestions; use C4::Koha; -use C4::Dates; use C4::Scrubber; use Koha::DateUtils qw( dt_from_string ); -- 2.39.5