Bug 12596

Summary: Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: CirculationAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: critical    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle.m.hall, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 18292    
Attachments: Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Bug 12596 - Unit Test
Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
Bug 12596 - Unit Test
Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!
[PASSED QA] Bug 12596 - Unit Test
[PASSED QA] Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!

Description Kyle M Hall (khall) 2014-07-17 14:56:32 UTC
When using the backdating of returns feature, an item that is not overdue is treated as being as many days overdue as it is *not* overdue. This is due to the fact that _get_chargeable_units appears to return the difference between the return date and the due date without consideration the return date being earlier than the due date.
Comment 1 Kyle M Hall (khall) 2014-07-17 14:57:26 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall (khall) 2014-07-17 15:10:52 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall (khall) 2014-07-17 16:20:05 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall (khall) 2014-07-17 16:20:18 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2014-07-17 16:23:59 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2014-07-21 21:44:32 UTC Comment hidden (obsolete)
Comment 7 Chris Cormack 2014-07-21 21:44:47 UTC Comment hidden (obsolete)
Comment 8 Katrin Fischer 2014-07-24 21:16:02 UTC
Created attachment 30049 [details] [review]
[PASSED QA] Bug 12596 - Unit Test

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 9 Katrin Fischer 2014-07-24 21:16:31 UTC
Created attachment 30050 [details] [review]
[PASSED QA] Bug 12596 - Backdating returns with SpecifiyReturnDate causes fines for items not overdue!

When using the backdating of returns feature, an item that is not
overdue is treated as being as many days overdue as it is *not* overdue.
This is due to the fact that _get_chargeable_units appears to return the
difference between the return date and the due date without
consideration the return date being earlier than the due date.

Test Plan:
1) Apply the unit test patch
2) prove t/db_dependent/Circulation.t
3) Note the failure
4) Apply the second patch
5) prove t/db_dependent/Circulation.t
6) Note there are no failures

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Fixes some badly named variables also

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
In order to test this, you need to activate SpecifyReturnDate.
I confirmed the problem and verified that the bug fixes it
by running the tests, but also by testing in staff.
Comment 10 Tomás Cohen Arazi (tcohen) 2014-07-25 15:02:36 UTC
Patches pushed to master.

Thanks Kyle!
Comment 11 Galen Charlton 2014-08-26 22:39:57 UTC
Pushed to 3.16.x for inclusion in 3.16.3.
Comment 12 Fridolin Somers 2014-12-29 18:01:37 UTC
Pushed to 3.14.x, will be in 3.14.13