[Koha-bugs] [Bug 22331] Lost items that are written off gives credit when returned
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Feb 15 17:49:06 CET 2019
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22331
Nick Clemens <nick at bywatersolutions.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nick at bywatersolutions.com
--- Comment #1 from Nick Clemens <nick at bywatersolutions.com> ---
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.
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list