| Summary: | Make writeoff_debts.pl use amountoutstanding, not amount | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Magnus Enger <magnus> |
| Component: | Command-line Utilities | Assignee: | Martin Renvoize (ashimema) <martin.renvoize> |
| Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
| Severity: | major | ||
| Priority: | P5 - low | CC: | fridolin.somers, jonathan.druart, kyle, martin.renvoize, robin |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
21.11.00,21.05.05
|
|
| Circulation function: | |||
| Bug Depends on: | 27049 | ||
| Bug Blocks: | 28995 | ||
| Attachments: |
Bug 28994: Fix logical errors with amount vs amoutoutstanding
Bug 28994: Fix logical errors with amount vs amoutoutstanding |
||
Created attachment 127461 [details] [review] Bug 28994: Fix logical errors with amount vs amoutoutstanding The writeoff debts script contained an error whereby we could writeoff more than the current outstanding debt of a charge. This patch corrects that mistake by passing amountoutstanding in place of amount in the writeoff and offset creation lines. Magnus is completely right here.. my mistake :(. I've just implemented the patch he suggested so I'll give him credit and then do a fast QA on it as I feel it's actually a pretty big bug that needs resolving. Created attachment 127462 [details] [review] Bug 28994: Fix logical errors with amount vs amoutoutstanding The writeoff debts script contained an error whereby we could writeoff more than the current outstanding debt of a charge. This patch corrects that mistake by passing amountoutstanding in place of amount in the writeoff and offset creation lines. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Pushed to master for 21.11, thanks to everybody involved! Pushed to 21.05.x for 21.05.05 |
This script uses "amount" to write off debts, when it should be using "amountoutstanding": # A 'writeoff' is a 'credit' my $writeoff = Koha::Account::Line->new( { date => \'NOW()', amount => 0 - $line->amount, <== HERE credit_type_code => 'WRITEOFF', status => 'ADDED', amountoutstanding => 0 - $line->amount, <== HERE manager_id => undef, borrowernumber => $line->borrowernumber, interface => 'intranet', branchcode => undef, } )->store(); my $writeoff_offset = Koha::Account::Offset->new( { credit_id => $writeoff->accountlines_id, type => 'WRITEOFF', amount => $line->amount <== HERE } )->store(); Patch coming.