From a98ea829d8a25369d014e579f49229bfe5d89ffe Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 24 Jul 2020 09:00:12 -0400 Subject: [PATCH] Bug 19382: Add blocking of ability to checkout on circulation.pl Signed-off-by: Katrin Fischer --- circ/circulation.pl | 13 +++++++++ .../prog/en/modules/circ/circulation.tt | 14 ++++++++-- .../en/modules/circ/circulation_batch_checkouts.tt | 32 ++++++++++++++-------- t/db_dependent/Koha/Patron.t | 2 +- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 338e13ea2c..b793aba47e 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -495,6 +495,19 @@ if ( $patron ) { ); } + # Check the debt of this patrons guarantors *and* the guarantees of those guarantors + my $no_issues_charge_guarantors = C4::Context->preference("NoIssuesChargeGuarantorsWithGuarantees"); + if ( $no_issues_charge_guarantors ) { + my $guarantors_non_issues_charges += $patron->relationships_debt({ include_guarantors => 1, only_this_guaranor => 0, include_this_patron => 1 }); + + if ( $guarantors_non_issues_charges > $no_issues_charge_guarantors ) { + $template->param( + charges_guarantors_guarantees => $guarantors_non_issues_charges + ); + $noissues = 1 unless C4::Context->preference("allowfineoverride"); + } + } + my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees"); $no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees ); if ( defined $no_issues_charge_guarantees ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 2d504b3f01..aaa5a68b84 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -764,14 +764,22 @@
  • Return claims: Patron has [% return_claims.count | html %] RETURN CLAIMS. [% END %] - [% IF ( charges ) %] - [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] - [% END %] [% IF age_limitations %] [% INCLUDE 'category-out-of-age-limit.inc' %] [% END %] + [% IF ( charges ) %] + [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] + [% END %] + [% IF ( charges_guarantors_guarantees ) %] +
  • + Charges: Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %]. + [% IF noissues %] + Checkouts are BLOCKED because fine balance is OVER THE LIMIT. + [% END %] +
  • + [% END %] [% IF ( charges_guarantees ) %]
  • Charges: Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %]. 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 8483d5763b..c6ea668bd8 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 @@ -46,18 +46,26 @@
    You are not allowed to use batch checkout for this patron
    [% ELSIF patron and noissues and not checkout_infos %]
    - Cannot check out! - [% IF charges %] - Checkouts are BLOCKED because fine balance is OVER THE LIMIT. - [% END %] - [% IF charges_guarantees %] -
  • - Charges: Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %]. -
  • -
  • - Checkouts are BLOCKED because fine balance is OVER THE LIMIT. -
  • - [% END %] + Cannot check out! + [% IF ( charges ) %] + [% INCLUDE 'blocked-fines.inc' fines = chargesamount %] + [% END %] + [% IF ( charges_guarantors_guarantees ) %] +
  • + Charges: Patron's guarantors and their other guarantees collectively owe [% charges_guarantors_guarantees | $Price %]. + [% IF noissues %] + Checkouts are BLOCKED because fine balance is OVER THE LIMIT. + [% END %] +
  • + [% END %] + [% IF ( charges_guarantees ) %] +
  • + Charges: Patron's guarantees collectively owe [% chargesamount_guarantees | $Price %]. + [% IF noissues %] + Checkouts are BLOCKED because fine balance is OVER THE LIMIT. + [% END %] +
  • + [% END %] [% ELSIF patron and not checkout_infos %]
    diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index e0078b0670..18043776e2 100644 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 4; +use Test::More tests => 5; use Test::Exception; use Koha::Database; -- 2.11.0