From 00a34f47bef9c5877135dc47255f88f490544806 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Fri, 15 Jul 2011 20:58:13 +0100 Subject: [PATCH] Bug 6598 : ensure OPACFineRenewals can prevent opac renewals Content-Type: text/plain; charset="utf-8" patron_flagged was being passed at global scope to the template but being checked as an element in other structures Also although items could not be selected the Renew Selected button was displayed, it too should check the flag Amended the preference text which incorrectly suggested the option could be turned off. (leading to the opposite to what the user might expect) In the script have explicitly assigned the value to a inumeric variable rather than making an implicit conversion as it may be that readers were missing that sleight of hand --- .../prog/en/modules/admin/preferences/opac.pref | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 24 ++++++++++--------- opac/opac-user.pl | 6 +++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index f4be568..56f479e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -320,7 +320,7 @@ OPAC: - Only allow patrons to renew their own books on the OPAC if they have less than - pref: OPACFineNoRenewals class: currency - - '[% local_currency %] in fines (leave blank to disable).' + - '[% local_currency %] in fines (set a large value to always allow renewal).' - - pref: OPACViewOthersSuggestions choices: 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 e6a44a8..f8b8063 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -110,8 +110,8 @@ $.tablesorter.addParser({ [% IF ( BORROWER_INF.lost ) %]
  • Please note: Your library card has been marked as lost or stolen. If this is an error, please contact the library.
  • [% END %] - [% IF ( BORROWER_INF.renewal_blocked_fines ) %] -
  • Please note: Since you have more than [% BORROWER_INF.renewal_blocked_fines %] in fines, you cannot renew your books online. Please pay your fines if you wish to renew your books.
  • + [% IF renewal_blocked_fines %] +
  • Please note: Since you have more than [% renewal_blocked_fines %] in fines, you cannot renew your books online. Please pay your fines if you wish to renew your books.
  • [% END %] [% END %] @@ -205,7 +205,7 @@ $.tablesorter.addParser({ Call No. Due [% IF ( OpacRenewalAllowed ) %] - [% UNLESS ( patron_flagged ) %]Renew[% END %] + [% UNLESS patron_flagged %]Renew[% END %] [% END %] [% IF ( OPACFinesTab ) %] Fines @@ -253,7 +253,7 @@ $.tablesorter.addParser({ [% ISSUE.date_due %] [% END %] [% IF ( OpacRenewalAllowed ) %] - [% UNLESS ( ISSUE.patron_flagged ) %] + [% UNLESS patron_flagged %] [% IF ( ISSUE.status ) %]Renew ([% 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 %] @@ -269,10 +269,12 @@ $.tablesorter.addParser({ [% END %] - - [% IF ( OpacRenewalAllowed ) %] - - [% END %] + + [% IF OpacRenewalAllowed %] + [% UNLESS patron_flagged %] + + [% END %] + [% END %] [% IF ( OpacRenewalAllowed ) %] @@ -282,7 +284,7 @@ $.tablesorter.addParser({ [% FOREACH ISSUE IN ISSUES %] [% END %] - [% UNLESS ( patron_flagged ) %][% END %] + [% UNLESS patron_flagged %][% END %] [% END %] [% ELSE %] @@ -304,7 +306,7 @@ $.tablesorter.addParser({ Call No. Due [% IF ( OpacRenewalAllowed ) %] - [% UNLESS ( patron_flagged ) %]Renew[% END %][% END %] + [% UNLESS patron_flagged %]Renew[% END %][% END %] [% IF ( OPACFinesTab ) %] Fines [% END %] @@ -336,7 +338,7 @@ $.tablesorter.addParser({ [% OVERDUE.itemcallnumber %] [% OVERDUE.date_due %] [% IF ( OpacRenewalAllowed ) %] - [% UNLESS ( OVERDUE.patron_flagged ) %] + [% UNLESS patron_flagged %] [% IF ( OVERDUE.debarred ) %]Account Frozen [% ELSIF ( OVERDUE.status ) %] diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 2c31ce7..97574b1 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -79,11 +79,13 @@ if ( $borr->{'amountoutstanding'} > 5 ) { if ( 5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) { $borr->{'amountoverzero'} = 1; } +my $no_renewal_amt = C4::Context->preference( 'OPACFineNoRenewals' ); +$no_renewal_amt ||= 0; -if ( $borr->{'amountoutstanding'} > C4::Context->preference( 'OPACFineNoRenewals' ) ) { +if ( $borr->{amountoutstanding} > $no_renewal_amt ) { $borr->{'flagged'} = 1; $template->param( - renewal_blocked_fines => sprintf( "%.02f", C4::Context->preference( 'OPACFineNoRenewals' ) ), + renewal_blocked_fines => sprintf( '%.02f', $no_renewal_amt ), ); } -- 1.7.6