Bug 16255 - When exemptfine, removes the first fine found
Summary: When exemptfine, removes the first fine found
Status: RESOLVED DUPLICATE of bug 14390
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: 3.18
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-13 19:17 UTC by René Salas
Modified: 2016-04-13 23:31 UTC (History)
3 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 René Salas 2016-04-13 19:17:57 UTC
If one item has more than one "FU" or "O" fine for user, returns the first/old one and not the latest one.

Solved by adding to the _FixOverduesOnReturn, 

from this: 

"SELECT * FROM accountlines WHERE (borrowernumber = ?) AND (itemnumber = ?) AND (accounttype='FU' OR accounttype='O')"

to this:

"SELECT * FROM accountlines WHERE (borrowernumber = ?) AND (itemnumber = ?) AND (accounttype='FU' OR accounttype='O') ORDER BY timestamp DESC"
Comment 1 Katrin Fischer 2016-04-13 21:48:23 UTC
Can you please add a test plan on how to reproduce this issue? 
What does O translate to?
Comment 2 René Salas 2016-04-13 22:32:02 UTC
According to https://wiki.koha-community.org/wiki/Hard_Coded_Values O is for Overdue.

Test plan

1.- Let one issue overdue and return it normally, this should record a fine for the overdue.
2.- Issue the item again letting the loan overdue and get a different fine  from the previous one.
3.- Return the issue with the exempt fine selected though returns.pl
4.- Note that the oldest fine was FFOR and not the one related to the actual loan.
5.- Apply the change proposed.
5.- Repeat steps 1-3 
6.- Now the FFOR apply for the more recent (accountlines_id) loan.
Comment 3 Katrin Fischer 2016-04-13 22:34:27 UTC
Hm, I am not sure if O is set by the system currently, but that's not the problem here. I think there should be no 2 FU at the same time, it's a known bug - see bug 14390.
Comment 4 René Salas 2016-04-13 23:31:02 UTC

*** This bug has been marked as a duplicate of bug 14390 ***