Bug 14250 - Can generate discharge for patrons with fines
Summary: Can generate discharge for patrons with fines
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: nikkom
QA Contact: Testopia
URL:
Keywords:
: 25986 (view as bug list)
Depends on: 8007
Blocks:
  Show dependency treegraph
 
Reported: 2015-05-21 16:47 UTC by Nicole C. Engard
Modified: 2023-05-24 14:34 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicole C. Engard 2015-05-21 16:47:46 UTC
I can generate a discharge for a patron with fines - shouldn't the patron have no checkouts and no fines?
Comment 1 Jamsheer N P 2017-12-08 05:24:47 UTC
Generating discharge to a patron having unpaid fine is a serious problem.
Comment 2 Jamsheer N P 2017-12-08 05:25:28 UTC
Generating discharge to a patron having unpaid fine is a serious problem.
Comment 3 Katrin Fischer 2020-07-15 05:25:23 UTC
*** Bug 25986 has been marked as a duplicate of this bug. ***
Comment 4 Jonathan Druart 2022-04-08 08:56:14 UTC
I have not tested but this fix should be as simple as:

diff --git a/Koha/Patron/Discharge.pm b/Koha/Patron/Discharge.pm
index 76e04e8533a..b9ebc7653af 100644
--- a/Koha/Patron/Discharge.pm
+++ b/Koha/Patron/Discharge.pm
@@ -39,7 +39,12 @@ sub can_be_discharged {
     return unless $patron;
 
     my $has_pending_checkouts = $patron->checkouts->count;
-    return $has_pending_checkouts ? 0 : 1;
+    return 0 if $has_pending_checkouts;
+
+    my $has_debt = $patron->account->outstanding_debits->total_outstanding
+    return 0 if $has_debt;
+
+    return 1;
 }
 
 sub is_discharged {
Comment 5 Caroline Cyr La Rose 2023-05-24 14:34:00 UTC
Still valid in master (22.12.00.048)