From 9d59962e9a88c9773cb1a47ecac716a25ed55f79 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 11 Oct 2011 14:52:19 -0400 Subject: [PATCH] Fix for Bug 6598 - 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: Brendan --- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 27 ++++++++++----------- opac/opac-user.pl | 6 ++-- 2 files changed, 16 insertions(+), 17 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 d9417ec..fbc54ba 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

@@ -80,7 +79,7 @@ $.tablesorter.addParser({ [% IF ( patronupdate ) %]

Thank you!

Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.

[% END %] - [% IF ( BORROWER_INF.flagged ) %] + [% IF ( patron_flagged ) %]
    [% IF ( BORROWER_INF.debarred ) %] @@ -187,7 +186,7 @@ $.tablesorter.addParser({ [% IF ( show_barcode ) %]Barcode[% END %] Call No. [% IF ( OpacRenewalAllowed ) %] - [% UNLESS patron_flagged %]Renew[% END %] + Renew [% END %] [% IF ( OPACFinesTab ) %] Fines @@ -235,12 +234,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 %] @@ -253,8 +250,10 @@ $.tablesorter.addParser({ [% IF ( canrenew ) %] [% IF ( OpacRenewalAllowed ) %] - - [% END %] + [% IF ( canrenew ) %] + + [% END %] + [% END %] [% END %] [% IF ( OpacRenewalAllowed ) %] @@ -265,7 +264,7 @@ $.tablesorter.addParser({ [% FOREACH ISSUE IN ISSUES %] [% END %] - [% UNLESS patron_flagged %][% END %] + [% END %] [% END %] @@ -288,7 +287,8 @@ $.tablesorter.addParser({ Call No. Due [% IF ( OpacRenewalAllowed ) %] - [% UNLESS patron_flagged %]Renew[% END %][% END %] + Renew +[% END %] [% IF ( OPACFinesTab ) %] Fines [% END %] @@ -320,15 +320,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 e99e557..ddfa071 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -60,6 +60,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 ); @@ -71,6 +72,7 @@ $borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} ); if ( $borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'} ) { $borr->{'flagged'} = 1; + $canrenew = 0; } if ( $borr->{'amountoutstanding'} > 5 ) { @@ -84,6 +86,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 ), ); @@ -108,13 +111,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 @@ -145,7 +146,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'; -- 1.7.2.5