From ec03815d924290cb56b40d17aa6e842d847e91d9 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 11 Oct 2011 14:52:19 -0400 Subject: [PATCH] Bug 6598 [REVISED] OPACFineNoRenewals syspreference does not stop user renewing in opac This patch standardizes the condition under which renewal controls are displayed at the page (as opposed to item) level. In some places "canrenew" was used, in others "patron_flagged" was used. Now "canrenew" controls renew controls and "patron_flagged" only triggers the display of user warnings. This patch also allows for renewal information to be displayed for each item in situations where OPAC renewals are allowed but disabled for whatever reason. This gives the patron information about used/available renew counts but hides renew controls. Signed-off-by: Paul Poulain (cherry picked from commit 0027fe0cc367632038f4562aaea22a582c785d9b) Signed-off-by: Chris Nighswonger (cherry picked from commit 02e56cdcacd27df1a5db5d0ae3e1196417a7efc1) Signed-off-by: Chris Nighswonger --- .../opac-tmpl/prog/en/modules/opac-user.tt | 21 ++++++++----------- opac/opac-user.pl | 6 +++--- 2 files changed, 12 insertions(+), 15 deletions(-) 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 4d33bd4369..bbe64a52e9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -58,7 +58,6 @@ $.tablesorter.addParser({
- [% IF ( bor_messages ) %]

Messages For You

@@ -86,7 +85,7 @@ $.tablesorter.addParser({
[% END %] - [% IF ( BORROWER_INF.flagged ) %] + [% IF ( patron_flagged ) %]
    [% IF ( BORROWER_INF.debarred ) %] @@ -193,7 +192,7 @@ $.tablesorter.addParser({ [% IF ( show_barcode ) %]Barcode[% END %] Call No. [% IF ( OpacRenewalAllowed ) %] - [% UNLESS patron_flagged %]Renew[% END %] + Renew [% END %] [% IF ( OPACFinesTab ) %] Fines @@ -241,12 +240,10 @@ $.tablesorter.addParser({ [% IF ( show_barcode ) %][% ISSUE.barcode %][% END %] [% ISSUE.itemcallnumber %] [% IF ( OpacRenewalAllowed ) %] - [% UNLESS patron_flagged %] - [% IF ( ISSUE.status ) %] Renew ([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining) + [% 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 %] [% END %] - [% END %] [% END %] [% IF ( OPACFinesTab ) %] [% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %] @@ -271,7 +268,7 @@ $.tablesorter.addParser({ [% FOREACH ISSUE IN ISSUES %] [% END %] - [% UNLESS patron_flagged %][% END %] + [% END %] [% END %] @@ -294,7 +291,8 @@ $.tablesorter.addParser({ Call No. Due [% IF ( OpacRenewalAllowed ) %] - [% UNLESS patron_flagged %]Renew[% END %][% END %] + Renew +[% END %] [% IF ( OPACFinesTab ) %] Fines [% END %] @@ -326,15 +324,14 @@ $.tablesorter.addParser({ [% OVERDUE.itemcallnumber %] [% OVERDUE.date_due %] [% IF ( OpacRenewalAllowed ) %] - [% UNLESS patron_flagged %] [% IF ( OVERDUE.debarred ) %]Account Frozen [% ELSIF ( OVERDUE.status ) %] -Renew ([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining) -[% ELSIF ( OVERDUE.onreserve ) %]On Reserve +[% IF ( canrenew ) %]Renew[% END %] ([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining) +[% ELSIF ( OVERDUE.onreserve ) %]On hold [% ELSE %]No renewals left [% END %] -[% END %][% END %] +[% END %] [% IF ( OPACFinesTab ) %] [% IF ( OVERDUE.charges ) %]Yes[% ELSE %]No[% END %] [% END %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 4df1e90e13..e90dbe41ff 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -66,6 +66,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0; my $patronupdate = $query->param('patronupdate'); +my $canrenew = 1; # get borrower information .... my ( $borr ) = GetMemberDetails( $borrowernumber ); @@ -80,6 +81,7 @@ $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} ); if ( $borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { $borr->{'flagged'} = 1; + $canrenew = 0; } if ( $borr->{'amountoutstanding'} > 5 ) { @@ -93,6 +95,7 @@ $no_renewal_amt ||= 0; if ( $borr->{amountoutstanding} > $no_renewal_amt ) { $borr->{'flagged'} = 1; + $canrenew = 0; $template->param( renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ), ); @@ -129,13 +132,11 @@ $template->param( BORROWER_INFO => \@bordat, #get issued items .... my $count = 0; -my $toggle = 0; my $overdues_count = 0; my @overdues; my @issuedat; my $itemtypes = GetItemTypes(); my ($issues) = GetPendingIssues($borrowernumber); -my $canrenew = 0; if ($issues){ foreach my $issue ( sort { $b->{'date_due'} cmp $a->{'date_due'} } @$issues ) { # check for reserves @@ -166,7 +167,6 @@ if ($issues){ ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'}); if($status && C4::Context->preference("OpacRenewalAllowed")){ $issue->{'status'} = $status; - $canrenew = 1; } $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many'; $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve'; -- 2.39.5