From 26c79241868e981a0e3a90f9ce83d28f286ee285 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 8 Apr 2014 23:22:05 +0000 Subject: [PATCH] Bug 7413: (follow-up) teach renew interface about too_soon This patch ensures that the new staff interface for renewals recognizes when premature renewals are requested. If the AllowRenewalLimitOverride system preference is enabled, staff members are able to override the block: To test: [1] Set up a loan policy with a "no renewal before" value and check out an item. [2] In the renewal page, verify that attempting to renew the loan results in an error forbidding the renew. [3] If AllowRenewalLimitOverride is enabled, the operator should also be given the option to override the block. Signed-off-by: Galen Charlton --- circ/renew.pl | 10 +++++++++- .../intranet-tmpl/prog/en/modules/circ/renew.tt | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/circ/renew.pl b/circ/renew.pl index 8cde6339d4..26c7bf0c5b 100755 --- a/circ/renew.pl +++ b/circ/renew.pl @@ -47,6 +47,7 @@ my $override_holds = $cgi->param('override_holds'); my ( $item, $issue, $borrower ); my $error = q{}; +my $soonest_renew_date; if ($barcode) { $item = $schema->resultset("Item")->single( { barcode => $barcode } ); @@ -75,6 +76,12 @@ if ($barcode) { } } + if ( $error && ($error eq 'too_soon') ) { + $soonest_renew_date = C4::Circulation::GetSoonestRenewDate( + $borrower->borrowernumber(), + $item->itemnumber(), + ); + } if ($can_renew) { my $date_due = AddRenewal( undef, $item->itemnumber() ); $template->param( date_due => $date_due ); @@ -96,7 +103,8 @@ if ($barcode) { item => $item, issue => $issue, borrower => $borrower, - error => $error + error => $error, + soonestrenewdate => $soonest_renew_date, ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt index c7bb1af2d4..3ebd00601f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -54,6 +54,18 @@ [% END %] + [% ELSIF error == "too_soon" %] + +

[% item.biblio.title | $EncodeUTF8 %] [% item.biblioitem.subtitle | $EncodeUTF8 %] ( [% item.barcode %] ) cannot be renewed before [% soonestrenewdate | $KohaDates %].

+ + [% IF Koha.Preference('AllowRenewalLimitOverride') %] +
+ + + +
+ [% END %] + [% ELSIF error == "on_reserve" %]

This item is on hold for another patron.

-- 2.39.5