Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0
Summary: Returns via backdating or SIP2 can create new fines with an amount outstandin...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor
Assignee: Kyle M Hall (khall)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-16 14:15 UTC by Kyle M Hall (khall)
Modified: 2015-12-03 22:02 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 13841 - Unit Test (1.89 KB, patch)
2015-03-16 14:18 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0 (3.41 KB, patch)
2015-03-16 14:18 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 13841 - Unit Test (1.94 KB, patch)
2015-03-17 18:49 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0 (3.46 KB, patch)
2015-03-17 18:49 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
[PASSED QA] Bug 13841 - Unit Test (2.00 KB, patch)
2015-03-22 19:14 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0 (3.64 KB, patch)
2015-03-22 19:14 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall (khall) 2015-03-16 14:15:21 UTC
Due to the way AddReturn and UpdateFine work, if you pass in a return date to AddReturn, and that item has a calculated fine of 0, Koha will insert the 0 amount fine into accountlines. 

This is good behavior when we want to update an existing fine, but bad behavior if there was no fine to begin with!
Comment 1 Kyle M Hall (khall) 2015-03-16 14:18:31 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall (khall) 2015-03-16 14:18:38 UTC Comment hidden (obsolete)
Comment 3 Biblibre Sandboxes 2015-03-17 18:49:11 UTC
Patch tested with a sandbox, by Jen DeMuth <jdemuth@roseville.ca.us>
Comment 4 Biblibre Sandboxes 2015-03-17 18:49:35 UTC Comment hidden (obsolete)
Comment 5 Biblibre Sandboxes 2015-03-17 18:49:38 UTC Comment hidden (obsolete)
Comment 6 Kyle M Hall (khall) 2015-03-19 13:24:51 UTC
I should note you can also test this by backdating a return to an hour before the current time. This will trigger the behavior and is more easily testable in a sandbox!
Comment 7 Katrin Fischer 2015-03-22 19:14:27 UTC
Created attachment 37085 [details] [review]
[PASSED QA] Bug 13841 - Unit Test

Signed-off-by: Jen DeMuth <jdemuth@roseville.ca.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Katrin Fischer 2015-03-22 19:14:46 UTC
Created attachment 37086 [details] [review]
[PASSED QA] Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0

Due to the way AddReturn and UpdateFine work, if you pass in a return
date to AddReturn, and that item has a calculated fine of 0, Koha will
insert the 0 amount fine into accountlines.

This is good behavior when we want to update an existing fine, but bad
behavior if there was no fine to begin with!

Test Plan:
1) Apply the unit test patch
2) prove t/db_dependent/Circulation.t
3) Note the test fails
4) Apply this patch
5) prove t/db_dependent/Circulation.t
6) Note the test passes

Signed-off-by: Jen DeMuth <jdemuth@roseville.ca.us>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Confirmed the problem in the staff interface and that the patch
fixes it. Also tested that fines still get calculated.
Comment 9 Tomás Cohen Arazi (tcohen) 2015-03-31 14:40:02 UTC
Patches pushed to master.

Nice one Kyle!
Comment 10 Chris Cormack 2015-04-06 08:25:42 UTC
Pushed to 3.18.x will be in 3.18.6