From d0e23e7b3d8e08060d9a284f7d2257af0c5939b3 Mon Sep 17 00:00:00 2001 From: Baptiste Wojtkowski Date: Wed, 4 Sep 2024 14:45:20 +0200 Subject: [PATCH] Bug 14250: (follow-up) Refacto the algorithm for discharge messages TEST PLAN: 1 - In the intranet add fines to a client and ensure they have no checkout 2 - Set syspref useDischarge to 'Allow' 3 - On client profile click on "Discharge", see it is possible 4 - On the opac, go to the tab "Ask for discharge", see it is possible 5 - Apply patch 6 - Click on the button "Ask for discharge" -> it will not be possible and you will be propperly messaged 7 - Return to the tab "Ask for a discharge", there will be no button anymore 8 - On the intranet page, there will be no button anymore 9 - Check out a book 10 - Repeat 7 and 8 and see the message include issue with checkout 11 - Remove fine and repeat 7 & 8 Note: removing the useless has_checkout and has_debt Signed-off-by: Sukhmandeep Benipal --- .../bootstrap/en/modules/opac-discharge.tt | 16 +++------------- opac/opac-discharge.pl | 5 ----- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-discharge.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-discharge.tt index 3a3f381218..f657a4e6dc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-discharge.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-discharge.tt @@ -44,24 +44,14 @@ Get your discharge [% ELSIF pending %]

Your discharge will be available on this page within a few days.

- [% ELSIF failure %] -

You cannot be discharged because you have checked out items. Please return your checked out items before asking for a discharge.

- [% ELSIF not messages %]

What is a discharge?

This document certifies that you have returned all borrowed items. It is sometimes asked during a file transfer from a school to another. The discharge is sent by us to your school. You will also find it available on your reader account.

Warning: This request is only valid if you are in good standing with the library. Once the application is made, you can not borrow library materials.

[% UNLESS can_be_discharged %] + [% IF failure %] +

There was an error during the discharge process

+ [% END %]
You cannot be discharged because:
    [% IF discharge_problems.checkouts %] diff --git a/opac/opac-discharge.pl b/opac/opac-discharge.pl index 54fc526dfc..34fcaea4e2 100755 --- a/opac/opac-discharge.pl +++ b/opac/opac-discharge.pl @@ -49,13 +49,10 @@ my ( $can_be_discharged, $discharge_problems ) = Koha::Patron::Discharge::can_be_discharged( { borrowernumber => $loggedinuser } ); my $patron = Koha::Patrons->find($loggedinuser); my $has_pending_checkouts = $patron->checkouts->count; -my $has_debt = ( $patron->account->outstanding_debits->total_outstanding > 0 ); $template->param( can_be_discharged => $can_be_discharged, discharge_problems => $discharge_problems, - has_checkouts => $has_pending_checkouts, - has_debt => $has_debt, ); my $pending = Koha::Patron::Discharge::count( @@ -82,8 +79,6 @@ if ( $op eq 'cud-request' ) { $template->param( success => 1 ); } else { $template->param( failure => 1 ); - $template->param( has_issues => $has_pending_checkouts ); - $template->param( has_debt => $has_debt ); } } elsif ( $op eq 'get' ) { unless ($available) { -- 2.34.1