| Summary: | Lost items that are written off gives credit when returned | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Benjamin Daeuber <bdaeuber> |
| Component: | Circulation | Assignee: | Tomás Cohen Arazi (tcohen) <tomascohen> |
| Status: | CLOSED WONTFIX | QA Contact: | Testopia <testopia> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | cslone, gmcharlt, jdemuth, josef.moravec, kyle, martin.renvoize, niamh.walker-headon, nick |
| Version: | 18.05 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21683 | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
|
Description
Benjamin Daeuber
2019-02-14 01:47:17 UTC
The issue appears to be from incorrectly assigned 'accountno' in Koha::Account->pay
88 # We should remove accountno, it is no longer needed
89 my $last = $self->lines->search(
90 {},
91 { order_by => 'accountno' } )->next();
92 my $accountno = $last ? $last->accountno + 1 : 1;
The default order is ASC, so we end up assigning the lowest here
Then in C4::Circulation->_FixAccountForLostAndReturned
2387 # check for charge made for lost book
2388 my $accountlines = Koha::Account::Lines->search(
2389 {
2390 itemnumber => $itemnumber,
2391 accounttype => { -in => [ 'L', 'Rep', 'W' ] },
2392 },
2393 {
2394 order_by => { -desc => [ 'date', 'accountno' ] }
2395 }
2396 );
We order the lines by accountno to get the most recent, however, the numbers are wrong so we don't get the most recent payment or write off.
18.05 is officially end of life at this point and I believe this bug is fixed in more recent versions... certainly, accountno was removed in 19.05, though not backported to 18.11 as far as I'm aware.. at this point, I would suggest we close this bug recommend an upgrade to 19.05 or above. |