From 864117ba49408c17f80d955e0c9740953fa3c8c3 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 22 Apr 2013 13:24:16 +1000 Subject: [PATCH] Bug 100089 - Prevent renewing for restricted patrons Currently, restricted patrons are not able to check out items, BUT they are able to renew checked out items. This isn't logical, since "renewing" an item is, essentially, equivalent to checking out the item again. In the OPAC patron screen, they are informed that their account is frozen, but...they are still able to renew books. I propose that we prevent restricted patrons from renewing items in the OPAC, and we prevent library staff from (accidentally) renewing books for restricted patrons in the staff client. -- Test Plan: Before applying patch... 1) Choose a patron with some items checked out, or check out some items to a patron 2) Mark the patron as restricted (Edit a patron and go to the "Patron account flags" fieldset to find the restriction option) 3) Note that you can't check out any items (in the Check out tab), but you can renew items in the "Check out" and "Details" tabs. 4) Log in as this patron in the OPAC, you will see a message saying your account is frozen, but you will be able to renew the items still Apply the patch... 1) Re-visit the "Check out" and "Details" tabs in the staff client, and try to renew the books. 2) Note that the check box will be replaced with a message saying "Not renewable: Patron restricted". 3) Re-visit the OPAC, the check box to renew should be replaced with a message saying "Account frozen". --- C4/Circulation.pm | 6 ++++++ .../prog/en/modules/circ/circulation.tt | 6 ++++++ .../prog/en/modules/members/moremember.tt | 3 +++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 2 +- opac/opac-user.pl | 1 + 5 files changed, 17 insertions(+), 1 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 3fc124f..d33f7ef 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2465,6 +2465,12 @@ sub CanBookBeRenewed { $renewokay = 0; $error = "on_reserve"; } + + my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber); + if ($memberblocked == 1) { + $renewokay = 0; + $error="member_blocked"; + } return ( $renewokay, $error ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index b7f7c4c..8e9ab25 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -856,6 +856,9 @@ No patron matched [% message %] [% IF ( todayissue.renew_error_too_many ) %] Not renewable [% END %] + [% IF ( todayissue.renew_error_member_blocked ) %] + Not renewable: Patron restricted + [% END %] [% IF ( todayissue.can_confirm ) %] [% END %] @@ -938,6 +941,9 @@ No patron matched [% message %] [% IF ( previssue.renew_error_too_many ) %] Not renewable [% END %] + [% IF ( previssue.renew_error_member_blocked ) %] + Not renewable: Patron restricted + [% END %] [% IF ( previssue.can_confirm ) %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index b3eef3a..05f0c3f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -504,6 +504,9 @@ function validate1(date) { [% IF ( issueloo.norenew_reason_too_many ) %] Not renewable [% END %] + [% IF ( issueloo.norenew_reason_member_blocked ) %] + Not renewable: Patron restricted + [% END %] [% IF ( issueloo.can_confirm ) %] [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt index 96f6e8d..663ed8f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -195,7 +195,7 @@ $.tablesorter.addParser({ [% IF ( OpacRenewalAllowed ) %] [% IF ( ISSUE.status ) %][% IF ( canrenew ) %] Renew[% END %] ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining) [% ELSE %] - Not renewable[% IF ( ISSUE.too_many ) %] ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)[% ELSE %][% IF ( ISSUE.on_reserve ) %] (On hold)[% END %][% END %] + Not renewable[% IF ( ISSUE.too_many ) %] ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)[% ELSIF ( ISSUE.member_blocked ) %](Account frozen)[% ELSE %][% IF ( ISSUE.on_reserve ) %] (On hold)[% END %][% END %] [% END %] [% END %] [% IF ( OPACFinesTab ) %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 750a9c3..c6a8350 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -185,6 +185,7 @@ if ($issues){ } $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many'; $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve'; + $issue->{'member_blocked'} = 1 if $renewerror and $renewerror eq 'member_blocked'; if ( $issue->{'overdue'} ) { push @overdues, $issue; -- 1.7.7.4