From f215fe537010877cdcf0c9ca40f83f9864d86a93 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Mon, 22 Jan 2024 15:55:57 +0000 Subject: [PATCH] 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 Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- Koha/Template/Plugin/Categories.pm | 6 ++++++ .../intranet-tmpl/prog/en/includes/blocked-fines.inc | 9 +++++---- .../intranet-tmpl/prog/en/includes/patron_messages.inc | 2 +- .../prog/en/modules/circ/circulation_batch_checkouts.tt | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Koha/Template/Plugin/Categories.pm b/Koha/Template/Plugin/Categories.pm index 4d425d6f9e..4b7c9c6e5d 100644 --- a/Koha/Template/Plugin/Categories.pm +++ b/Koha/Template/Plugin/Categories.pm @@ -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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc index b53f98d2f6..3e103ff770 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/blocked-fines.inc @@ -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 %]
  • Charges: - Patron has outstanding charges of [% fines | $Price %]. - [% IF !Koha.Preference('AllowFineOverride') && NoIssuesCharge && fines > NoIssuesCharge %] + Patron has outstanding charges of [% NoIssuesCharge.charge | $Price %]. + [% IF !Koha.Preference('AllowFineOverride') && NoIssuesCharge.limit && NoIssuesCharge.overlimit %] Checkouts are BLOCKED because fine balance is OVER THE LIMIT. [% END %] [% IF CAN_user_updatecharges_remaining_permissions %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index 666d07ad0f..38a0fb7c5c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -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 ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index 83f91ae8bd..3beb6d14af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -63,7 +63,7 @@
    Cannot check out! [% IF ( charges ) %] - [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] + [% INCLUDE 'blocked-fines.inc' borrowernumber = patron.borrowernumber %] [% END %] [% IF ( charges_guarantors_guarantees ) %]
  • -- 2.39.5