From 8939dc992854c1022e1910a96ca2ac90c13e7f36 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 12 Apr 2023 17:29:43 +0000 Subject: [PATCH] Bug 33271: Add collective owing message to moremember page To test: 1. Turn on NoIssuesChargeGuarantorsWithGuarantees and set the amount to 5. 2. Create a guarantor/guarantee relationship. 3. Add a manual invoice to the guarantor that is larger than 5.00. 4. Notice the message on that circulation ( check out tab ) page. " Charges: Patron's guarantors and their other guarantees collectively owe X. Checkouts are BLOCKED because fine balance is OVER THE LIMIT. " 5. Look at the moremember ( details ) page. The same message does not appear. 6. Apply patch, restart_all 7. Try step 5 again, the message should now appear. Signed-off-by: Barbara Johnson Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../prog/en/includes/patron_messages.inc | 2 +- members/moremember.pl | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) 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 4f2dc41e24..507c3fd0f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -76,7 +76,7 @@ [% END %] View restrictions - [% IF (noissues && CAN_user_circulate_force_checkout) %] + [% IF (noissues && CAN_user_circulate_force_checkout && !moremember) %] Override restriction temporarily diff --git a/members/moremember.pl b/members/moremember.pl index 6d5b3b2e03..5813c8d87f 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -251,6 +251,19 @@ if( ( my $owing = $account->non_issues_charges ) > 0 ) { ); } +# 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_guarantor => 0, include_this_patron => 1 }); + + if ( $guarantors_non_issues_charges > $no_issues_charge_guarantors ) { + $template->param( + noissues => 1, + charges_guarantors_guarantees => $guarantors_non_issues_charges + ); + } +} + # if the expiry date is before today ie they have expired if ( $patron->is_expired ) { #borrowercard expired, no issues -- 2.39.5