[Koha-patches] [PATCH] [SIGNED-OFF] Bug 6598 : ensure OPACFineRenewals can prevent opac renewals

Nicole C. Engard nengard at bywatersolutions.com
Thu Jul 14 12:58:59 CEST 2011


From: Colin Campbell <colin.campbell at ptfs-europe.com>

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 <nengard at bywatersolutions.com>
---
 .../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 ) %]
                 <li><strong>Please note: </strong> Your library card has been marked as lost or stolen. If this is an error, please contact the library.</li>
             [% END %]
-            [% IF ( BORROWER_INF.renewal_blocked_fines ) %]
-                <li><strong>Please note: </strong> Since you have <a href="/cgi-bin/koha/opac-account.pl">more than [% BORROWER_INF.renewal_blocked_fines %]</a> in fines, you cannot renew your books online. Please pay your fines if you wish to renew your books.</li>
+            [% IF renewal_blocked_fines %]
+                <li><strong>Please note: </strong> Since you have <a href="/cgi-bin/koha/opac-account.pl">more than [% renewal_blocked_fines %]</a> in fines, you cannot renew your books online. Please pay your fines if you wish to renew your books.</li>
             [% END %]
         </ul></div>
         [% END %]
@@ -205,7 +205,7 @@ $.tablesorter.addParser({
         <th>Call No.</th>
         <th>Due</th>
         [% IF ( OpacRenewalAllowed ) %]
-        [% UNLESS ( patron_flagged ) %]<th>Renew</th>[% END %]
+        [% UNLESS  patron_flagged %]<th>Renew</th>[% END %]
         [% END %]
 [% IF ( OPACFinesTab ) %]
         <th>Fines</th>
@@ -253,7 +253,7 @@ $.tablesorter.addParser({
                     <td>[% ISSUE.date_due %]</td>
                 [% END %]
                 [% IF ( OpacRenewalAllowed ) %]
-                    [% UNLESS ( ISSUE.patron_flagged ) %]
+                    [% UNLESS patron_flagged %]
                     <td>[% IF ( ISSUE.status ) %]<input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/><a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;borrowernumber=[% ISSUE.borrowernumber %]">Renew</a> <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
                         [% ELSE %]
                         Not renewable[% IF ( ISSUE.too_many ) %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>[% ELSE %][% IF ( ISSUE.on_reserve ) %] <span class="renewals">(On hold)</span>[% END %][% END %] 
@@ -269,10 +269,12 @@ $.tablesorter.addParser({
             </tr>
         [% END %]</tbody>
         </table>
-	
-		[% IF ( OpacRenewalAllowed ) %]
-		<input type="submit" value="Renew Selected" />
-		[% END %]
+
+        [% IF OpacRenewalAllowed %]
+            [% UNLESS patron_flagged %]
+            <input type="submit" value="Renew Selected" />
+            [% END %]
+        [% END %]
 		</form>
 		[% IF ( OpacRenewalAllowed ) %]
 		
@@ -282,7 +284,7 @@ $.tablesorter.addParser({
 			[% FOREACH ISSUE IN ISSUES %]
 			<input type="hidden" name="item" value="[% ISSUE.itemnumber %]" />
 			[% END %]
-			[% UNLESS ( patron_flagged ) %]<input type="submit" value="Renew All" />[% END %]
+			[% UNLESS patron_flagged %]<input type="submit" value="Renew All" />[% END %]
 		</form>
 		[% END %]
     [% ELSE %]
@@ -304,7 +306,7 @@ $.tablesorter.addParser({
 <th>Call No.</th>
 <th>Due</th>
 [% IF ( OpacRenewalAllowed ) %]
-                    [% UNLESS ( patron_flagged ) %]<th>Renew</th>[% END %][% END %]
+                    [% UNLESS  patron_flagged  %]<th>Renew</th>[% END %][% END %]
 [% IF ( OPACFinesTab ) %]
 <th>Fines</th>
 [% END %]
@@ -336,7 +338,7 @@ $.tablesorter.addParser({
 <td>[% OVERDUE.itemcallnumber %]</td>
 <td>[% OVERDUE.date_due %]</td>
                 [% IF ( OpacRenewalAllowed ) %]
-                    [% UNLESS ( OVERDUE.patron_flagged ) %]
+                    [% UNLESS patron_flagged %]
 <td>
 [% 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.2.3



More information about the Koha-patches mailing list