From: Nick Clemens Date: Wed, 24 May 2017 13:31:59 +0000 (-0400) Subject: Bug 15494: Update display of renewal errors X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=72750cf3b7001b02237c4145121e1071b2ca65da;p=koha.git Bug 15494: Update display of renewal errors To test: 1 - Define a rule to deny renewal 2 - Checkout an item meeting this rule 3 - Attempt renew an item via the OPAC 4 - Attempt renewal via SIP 5 - Attempt renewal via staff client 6 - Verify errors are reasonable Signed-off-by: Katrin Fischer Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- diff --git a/C4/SIP/ILS/Transaction/Renew.pm b/C4/SIP/ILS/Transaction/Renew.pm index 7e1e9b7496..af96f93901 100644 --- a/C4/SIP/ILS/Transaction/Renew.pm +++ b/C4/SIP/ILS/Transaction/Renew.pm @@ -51,6 +51,7 @@ sub do_renew_for { } else { $renewerror=~s/on_reserve/Item unavailable due to outstanding holds/; $renewerror=~s/too_many/Item has reached maximum renewals/; + $renewerror=~s/item_denied_renewal/Item renewal is not allowed/; $self->screen_msg($renewerror); $self->renewal_ok(0); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc index bd513293dd..cb90180f64 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc @@ -21,6 +21,7 @@ var NOT_RENEWABLE_AUTO_TOO_MUCH_OWEING = _("Automatic renewal failed, patron has unpaid fines"); var NOT_RENEWABLE_AUTO_ACCOUNT_EXPIRED = _("Automatic renewal failed, account expired"); var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal"); + var NOT_RENEWABLE_DENIED = _("Renewal denied by syspref"); var RENEWALS_REMAINING = _("%s of %s renewals remaining"); var HOLD_IS_SUSPENDED = _("Hold is suspended"); var UNTIL = _("until %s"); 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 3e38f8fdca..5498c169ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -117,6 +117,10 @@

[% borrower.firstname | html %] [% borrower.surname | html %] ( [% borrower.cardnumber | html %] ) is currently restricted.

+ [% ELSIF error == "item_denied_renewal" %] + +

Item is not allowed renewal.

+ [% ELSE %] [% error | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index c4f1f3523d..9902f5be01 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -431,6 +431,13 @@ $(document).ready(function() { span_class = "renewals-allowed"; } else if ( oObj.can_renew_error == "onsite_checkout" ) { // Don't display something if it's an onsite checkout + } else if ( oObj.can_renew_error == "item_denied_renewal" ) { + content += "" + + NOT_RENEWABLE_DENIED + + ""; + + span_style = "display: none"; + span_class = "renewals-allowed"; } else { content += "" + oObj.can_renew_error diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 3c8a273795..bf5738ef14 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -85,6 +85,8 @@
  • It is too soon after the checkout date for this item to be renewed.
  • [% ELSIF error == 'on_reserve' %]
  • This item is on hold for another borrower.
  • + [% ELSIF error == 'item_denied_renewal' %] +
  • Item renewal is not allowed.
  • [% END %] [% END %] @@ -316,6 +318,8 @@ [% ELSIF ( ISSUE.too_soon ) %] No renewal before [% ISSUE.soonestrenewdate | html %] ([% ISSUE.renewsleft | html %] of [% ISSUE.renewsallowed | html %] renewals remaining) + [% ELSIF ( ISSUE.item_denied_renewal ) %] + Renewal not allowed [% END %] [% END %] diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index 6a170ca20f..b50a6d565a 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -88,7 +88,8 @@ while ( my $auto_renew = $auto_renews->next ) { or $error eq 'auto_account_expired' or $error eq 'auto_too_late' or $error eq 'auto_too_much_oweing' - or $error eq 'auto_too_soon' ) { + or $error eq 'auto_too_soon' + or $error eq 'item_denied_renewal' ) { if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) { $auto_renew->auto_renew_error($error)->store; push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 98638c3a01..d3ff888848 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -236,6 +236,7 @@ if ( $pending_checkouts->count ) { # Useless test $issue->{'auto_too_soon'} = 1 if $renewerror eq 'auto_too_soon'; $issue->{'auto_too_late'} = 1 if $renewerror eq 'auto_too_late'; $issue->{'auto_too_much_oweing'} = 1 if $renewerror eq 'auto_too_much_oweing'; + $issue->{'item_denied_renewal'} = 1 if $renewerror eq 'item_denied_renewal'; if ( $renewerror eq 'too_soon' ) { $issue->{'too_soon'} = 1;