From 38edd714c598322e81a32a0dfc5f2ce0da46826d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Nov 2013 11:55:57 +0100 Subject: [PATCH] Bug 9788: QA followup 1/ CURRENT_DATE() is a MySQLism and should be replaced with CAST(now() AS DATE). 2/ The date formatting should be done in the template (using the TT plugin). Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy Signed-off-by: Galen Charlton --- C4/Reserves.pm | 2 +- catalogue/detail.pl | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 3 ++- koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt | 3 ++- opac/opac-reserve.pl | 2 +- reserve/request.pl | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index ea46f2ab7c..f066404036 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -372,7 +372,7 @@ sub GetReservesFromItemnumber { my $query = " SELECT reservedate,borrowernumber,branchcode,reserve_id,waitingdate FROM reserves - WHERE itemnumber=? AND ( reservedate <= CURRENT_DATE() OR + WHERE itemnumber=? AND ( reservedate <= CAST(now() AS date) OR waitingdate IS NOT NULL ) ORDER BY priority "; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 25893be82a..a3df03bb56 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -249,7 +249,7 @@ foreach my $item (@items) { $item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname}; $item->{Reservedcardnumber} = $ItemBorrowerReserveInfo->{'cardnumber'}; # Check waiting status - $item->{waitingdate} = format_date($wait) if $wait; + $item->{waitingdate} = $wait; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 0a44dbfdff..1a81ef72dd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -1,5 +1,6 @@ [% USE KohaDates %] [% USE AuthorisedValues %] +[% USE KohaDates %] [% ShowCourseReserves = 0 %] [% IF UseCourseReserves %] @@ -634,7 +635,7 @@ function verify_images() { [% END %] [% item.ExpectedAtLibrary %] [% IF ( item.waitingdate ) %] - since [% item.waitingdate %] + since [% item.waitingdate | $KohaDates %] [% ELSE %] [% IF ( item.reservedate ) %] (placed [% item.reservedate %]) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index beeb5d720f..79ec493466 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -456,7 +456,7 @@ function checkMultiHold() { [% IF ( itemloo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] [% IF ( itemloo.canreservefromotherbranches ) %]for [% itemloo.ReservedForFirstname %] [% itemloo.ReservedForSurname %][% END %] [% IF ( itemloo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemloo.ExpectedAtLibrary %] since - [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. Cancel hold + [% IF ( itemloo.waitingdate ) %][% itemloo.waitingdate | $KohaDates %][% ELSE %][% IF ( itemloo.reservedate ) %][% itemloo.reservedate %][% END %][% END %]. Cancel hold [% END %] [% ELSE %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index 671e1f95cc..b2e20c402a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -1,4 +1,5 @@ [% USE Koha %] +[% USE KohaDates %] [% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog › Placing a hold [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] @@ -529,7 +530,7 @@ [% IF ( itemLoo.waitingdate ) %]Waiting[% ELSE %]On hold[% END %] for patron [% IF ( itemLoo.waitingdate ) %]at[% ELSE %]expected at[% END %] [% itemLoo.ExpectedAtLibrary %] since - [% IF ( itemLoo.waitingdate ) %][% itemLoo.waitingdate %][% ELSE %][% IF ( itemLoo.reservedate ) %][% itemLoo.reservedate %][% END %][% END %]. + [% IF ( itemLoo.waitingdate ) %][% itemLoo.waitingdate | $KohaDates %][% ELSE %][% IF ( itemLoo.reservedate ) %][% itemLoo.reservedate %][% END %][% END %]. [% ELSE %] Not on hold diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 3b1ca2b5f7..df55c19435 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -447,7 +447,7 @@ foreach my $biblioNum (@biblionumbers) { $itemLoopIter->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'}; $itemLoopIter->{ExpectedAtLibrary} = $expectedAt; #waiting status - $itemLoopIter->{waitingdate} = format_date($wait) if $wait; + $itemLoopIter->{waitingdate} = $wait; } $itemLoopIter->{notforloan} = $itemInfo->{notforloan}; diff --git a/reserve/request.pl b/reserve/request.pl index 8701586ae1..e915dbf43e 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -338,7 +338,7 @@ foreach my $biblionumber (@biblionumbers) { $item->{ReservedForSurname} = $ItemBorrowerReserveInfo->{'surname'}; $item->{ReservedForFirstname} = $ItemBorrowerReserveInfo->{'firstname'}; $item->{ExpectedAtLibrary} = $branches->{$expectedAt}{branchname}; - $item->{waitingdate} = format_date($wait) if $wait; + $item->{waitingdate} = $wait; } # Management of the notforloan document -- 2.39.5