From 129a1ee26811d5cd8c9d77300db74b9552cbfb93 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 19 Aug 2016 12:01:32 +0100 Subject: [PATCH] Bug 16873: Improve renewal error messages on self check When a patron is not allowed to renew from the self check module, the only message displayed is "No renewals allowed". It would be nicer to let him/her know that the renewal is not allowed because it's a on-site checkout or automatic renewal. To do so we can call CanBookBeRenewed instead of CanBookBeIssued and get the renewal error. Test plan: 0/ Switch off AllowSelfCheckReturns 1/ check out an item and tick "auto renewal" 2/ Go on the self check module => auto renewal message is displayed 3/ check out an item and tick "on-site checkout" 4/ Go on the self check module => on-site checkout message is displayed 5/ check out an item without ticking any checkboxes (regular checkout) Renew it to reach the max renew allowed 6/ Go on the self check module => regular checkout message is displayed 7/ Switch on AllowSelfCheckReturns and repeat previous steps => "Return this item" button is displayed in addition of the renewal error message --- .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 23 +++++++++++++--------- opac/sco/sco-main.pl | 12 +++++------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index 42d2508..ed8eb12 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -248,15 +248,7 @@
- [% IF ( ISSUE.norenew ) %] - [% IF ( AllowSelfCheckReturns ) %] - - - - [% ELSE %] - No renewals allowed - [% END %] - [% ELSE %] + [% IF ISSUE.can_be_renewed %] [% UNLESS ( ISSUE.renew ) %] @@ -264,6 +256,19 @@ [% ELSE %] [% END %] + [% ELSE %] + [% IF ISSUE.renew_error == 'auto_renew' OR ISSUE.renew_error == 'auto_too_soon' %] + This item has been scheduled for automatic renewal and cannot be renewed + [% ELSIF ISSUE.renew_error == 'onsite_checkout' %] + This is a on-site checkout, it cannot be renewed. + [% ELSE %] + No renewals allowed + [% END %] + [% IF AllowSelfCheckReturns %] + + + + [% END %] [% END %]
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 0e2a1b9..8569edf 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -226,14 +226,12 @@ if ($borrower->{cardnumber}) { my @issues; my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} ); foreach my $it (@$issueslist) { - my ($renewokay, $renewerror) = CanBookBeIssued( - $borrower, - $it->{'barcode'}, - undef, - 0, - C4::Context->preference("AllowItemsOnHoldCheckout") + my ($can_be_renewed, $renew_error) = CanBookBeRenewed( + $borrower->{borrowernumber}, + $it->{itemnumber}, ); - $it->{'norenew'} = 1 if $renewokay->{'NO_MORE_RENEWALS'}; + $it->{can_be_renewed} = $can_be_renewed; + $it->{renew_error} = $renew_error; push @issues, $it; } -- 2.8.1