Bug 28924: Add a template method and update template usages

This patch adds a method to be used in the template where currently the Koha.Preference('noissuescharge') method is used. This currently does not take into account the new patron category level limits and so needs to be updated to its own method to handle these.

Sponsored-by: Cuyahoga County Public Library <https://cuyahogalibrary.org/>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Matt Blenkinsop 2024-01-22 15:55:57 +00:00 committed by Katrin Fischer
parent ddaa75ecd4
commit f215fe5370
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
4 changed files with 13 additions and 6 deletions

View File

@ -45,6 +45,12 @@ sub can_any_reset_password {
: 0;
}
sub GetPatronCharges {
my ( $self, $params ) = @_;
my $charges = Koha::Patron->is_patron_inside_charge_limits({ borrowernumber => $params });
return $charges->{noissuescharge};
}
1;
=head1 NAME

View File

@ -1,10 +1,11 @@
[% USE Price %]
[% SET NoIssuesCharge = Koha.Preference('noissuescharge') %]
[% IF fines and fines > 0 %]
[% USE Categories %]
[% SET NoIssuesCharge = Categories.GetPatronCharges(borrowernumber) %]
[% IF NoIssuesCharge.charge and NoIssuesCharge.charge > 0 %]
<li>
<span class="circ-hlt">Charges:</span>
<span>Patron has outstanding charges of [% fines | $Price %].</span>
[% IF !Koha.Preference('AllowFineOverride') && NoIssuesCharge && fines > NoIssuesCharge %]
<span>Patron has outstanding charges of [% NoIssuesCharge.charge | $Price %].</span>
[% IF !Koha.Preference('AllowFineOverride') && NoIssuesCharge.limit && NoIssuesCharge.overlimit %]
<span class="circ-hlt">Checkouts are BLOCKED because fine balance is OVER THE LIMIT.</span>
[% END %]
[% IF CAN_user_updatecharges_remaining_permissions %]

View File

@ -119,7 +119,7 @@
[% END %]
[% IF ( charges ) %]
[% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
[% INCLUDE 'blocked-fines.inc' borrowernumber = patron.borrowernumber %]
[% END %]
[% IF ( charges_guarantors_guarantees ) %]

View File

@ -63,7 +63,7 @@
<div class="dialog alert">
Cannot check out!
[% IF ( charges ) %]
[% INCLUDE 'blocked-fines.inc' fines = chargesamount %]
[% INCLUDE 'blocked-fines.inc' borrowernumber = patron.borrowernumber %]
[% END %]
[% IF ( charges_guarantors_guarantees ) %]
<li>