Bug 28051

Summary: On upgrade to 19.11, per-item Writeoff got confused with Lost
Product: Koha Reporter: Pongtawat <pongtawat>
Component: Fines and feesAssignee: Bugs List <koha-bugs>
Status: RESOLVED WONTFIX QA Contact: Testopia <testopia>
Severity: normal    
Priority: P3    
Version: 19.11   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22563
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:

Description Pongtawat 2021-03-30 10:31:39 UTC
During upgrade to 19.11, database upgrade script introduced by Bug #22563 (convert "lost" handling) also handle case of normal per-item writeoff like those writeoff generated from lost. So, all patron with normal per-item writeoff will now see additional account line of 'LOST' type. 

This is due to the following code in updatedatabase.pl:

    # Find and correct pathalogical cases of L having been converted to W
    $sth = $dbh->prepare( "SELECT accountlines_id, issue_id, borrowernumber, itemnumber, amount, manager_id FROM accountlines WHERE accounttype = 'W' AND itemnumber IS NOT NULL" );
...

Step to reproduce:

1. Start with Koha 18.05.
2. Create overdue fine on item X for patron A, amount=100.
3. Per-item write-off amount=50 on item X for patron A. This will create 'W' line in accountlines with amount=50 and item=X
4. Upgrade to Koha 19.11 or later (in our case 20.05)
5. Patron A now has an additional 'LOST' with amount=50 and item=X in their accountlines.

This additional 'LOST' line is incorrect in this case.

Also, I notice that this per-item writeoff is in debit side (red). I don't know if this is correct or not, but shouldn't writeoff be on credit side?
Comment 1 Katrin Fischer 2023-07-01 07:03:33 UTC
These versions are too old now to provide a fix, marking WONTFIX. But as I can't test there is a possibility it was fixed elsewhere.