From 0eeb2e42ab18eb236f8a32cef1533a2f5d0565a2 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Thu, 14 Jul 2011 06:58:59 -0400 Subject: [PATCH] Bug 6598 : ensure OPACFineRenewals can prevent opac renewals 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 Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack (cherry picked from commit b84276a3b117e3ebf558fede1c1ac5ce059d484d) Signed-off-by: Chris Nighswonger --- .../en/modules/admin/preferences/opac.pref | 2 +- .../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 024496363b..245b407a16 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 @@ -299,7 +299,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 92bd44d241..be67c8a420 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt @@ -73,8 +73,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 %] @@ -168,7 +168,7 @@ $.tablesorter.addParser({ [% IF ( show_barcode ) %]Barcode[% END %] Call No. [% IF ( OpacRenewalAllowed ) %] - [% UNLESS ( patron_flagged ) %]Renew[% END %] + [% UNLESS patron_flagged %]Renew[% END %] [% END %] [% IF ( OPACFinesTab ) %] Fines @@ -216,7 +216,7 @@ $.tablesorter.addParser({ [% IF ( show_barcode ) %][% ISSUE.barcode %][% END %] [% ISSUE.itemcallnumber %] [% 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 %] @@ -232,10 +232,12 @@ $.tablesorter.addParser({ [% END %] - - [% IF ( OpacRenewalAllowed ) %] - - [% END %] + + [% IF OpacRenewalAllowed %] + [% UNLESS patron_flagged %] + + [% END %] + [% END %] [% IF ( OpacRenewalAllowed ) %] @@ -245,7 +247,7 @@ $.tablesorter.addParser({ [% FOREACH ISSUE IN ISSUES %] [% END %] - [% UNLESS ( patron_flagged ) %][% END %] + [% UNLESS patron_flagged %][% END %] [% END %] [% ELSE %] @@ -267,7 +269,7 @@ $.tablesorter.addParser({ Call No. Due [% IF ( OpacRenewalAllowed ) %] - [% UNLESS ( patron_flagged ) %]Renew[% END %][% END %] + [% UNLESS patron_flagged %]Renew[% END %][% END %] [% IF ( OPACFinesTab ) %] Fines [% END %] @@ -299,7 +301,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 a2f7d9b121..27bd2a4dd9 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 ), ); }