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 <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Colin Campbell 2011-07-14 06:58:59 -04:00 committed by Chris Cormack
parent 4b2ea4cf44
commit b84276a3b1
3 changed files with 18 additions and 14 deletions

View file

@ -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:

View file

@ -73,8 +73,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 %]
@ -168,7 +168,7 @@ $.tablesorter.addParser({
[% IF ( show_barcode ) %]<th>Barcode</th>[% END %]
<th>Call No.</th>
[% IF ( OpacRenewalAllowed ) %]
[% UNLESS ( patron_flagged ) %]<th class="{sorter: false}">Renew</th>[% END %]
[% UNLESS patron_flagged %]<th class="{sorter: false}">Renew</th>[% END %]
[% END %]
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
@ -216,7 +216,7 @@ $.tablesorter.addParser({
[% IF ( show_barcode ) %]<td>[% ISSUE.barcode %]</td>[% END %]
<td>[% ISSUE.itemcallnumber %]</td>
[% 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 %]
@ -232,10 +232,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 ) %]
@ -245,7 +247,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 %]
@ -267,7 +269,7 @@ $.tablesorter.addParser({
<th>Call No.</th>
<th>Due</th>
[% IF ( OpacRenewalAllowed ) %]
[% UNLESS ( patron_flagged ) %]<th class="{sorter: false}">Renew</th>[% END %][% END %]
[% UNLESS patron_flagged %]<th class="{sorter: false}">Renew</th>[% END %][% END %]
[% IF ( OPACFinesTab ) %]
<th>Fines</th>
[% END %]
@ -299,7 +301,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 ) %]

View file

@ -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 ),
);
}