Bug 20285 - Lost item refund won't always pay down lost item fee first
Summary: Lost item refund won't always pay down lost item fee first
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Kyle M Hall
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-23 13:43 UTC by Kyle M Hall
Modified: 2018-09-06 09:52 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20286: Unit Test (1.03 KB, patch)
2018-02-23 13:49 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 20285: Lost item refund won't always pay down lost item fee first (1.45 KB, patch)
2018-02-23 13:49 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 20285: Lost item refund won't always pay down lost item fee first (1.56 KB, patch)
2018-06-08 19:47 UTC, Maryse Simard
Details | Diff | Splinter Review
Bug 20285: Unit Test (1.05 KB, patch)
2018-06-14 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20285: Lost item refund won't always pay down lost item fee first (1.64 KB, patch)
2018-06-14 14:59 UTC, Jonathan Druart
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 2018-02-23 13:43:47 UTC
Due to a simple typo, the accountline passed to Koha::Account::pay from _FixAccountForLostAndReturned is not used. That means that the credit for the lost item fee may be applied to other fees before it is used on the lost fee itself.
Comment 1 Kyle M Hall 2018-02-23 13:49:01 UTC
Created attachment 72122 [details] [review]
Bug 20286: Unit Test
Comment 2 Kyle M Hall 2018-02-23 13:49:08 UTC
Created attachment 72123 [details] [review]
Bug 20285: Lost item refund won't always pay down lost item fee first

Due to a simple typo, the accountline passed to Koha::Account::pay from _FixAccountForLostAndReturned is not used. That means that the credit for the lost item fee may be applied to other fees before it is used on the lost fee itself.

Test Plan:
1) Find a patron with existing fines
2) Ensure your settings will charge patrons for lost items
3) Check out an item to a patron with existing fees that need paid
4) Mark the item lost, charging the lost item fee
5) Return the item
6) Note the fee was refunded, but it paid down earlier fines first,
   and not the lost item fee first
7) Apply this patch set
8) Repeat steps 1 - 5
9) Note the lost item fee is the first fee to be paid off by the lost
   item fee refund
Comment 3 Maryse Simard 2018-06-08 19:47:11 UTC
Created attachment 75936 [details] [review]
Bug 20285: Lost item refund won't always pay down lost item fee first

Due to a simple typo, the accountline passed to Koha::Account::pay from _FixAccountForLostAndReturned is not used. That means that the credit for the lost item fee may be applied to other fees before it is used on the lost fee itself.

Test Plan:
1) Find a patron with existing fines
2) Ensure your settings will charge patrons for lost items
3) Check out an item to a patron with existing fees that need paid
4) Mark the item lost, charging the lost item fee
5) Return the item
6) Note the fee was refunded, but it paid down earlier fines first,
   and not the lost item fee first
7) Apply this patch set
8) Repeat steps 1 - 5
9) Note the lost item fee is the first fee to be paid off by the lost
   item fee refund

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and it works as expected.
Comment 4 Jonathan Druart 2018-06-14 14:52:48 UTC
Is this really minor?
Comment 5 Jonathan Druart 2018-06-14 14:57:01 UTC
Caused by bug 14826? Is this bug present in 17.11?
Comment 6 Jonathan Druart 2018-06-14 14:59:07 UTC
Created attachment 76060 [details] [review]
Bug 20285: Unit Test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2018-06-14 14:59:11 UTC
Created attachment 76061 [details] [review]
Bug 20285: Lost item refund won't always pay down lost item fee first

Due to a simple typo, the accountline passed to Koha::Account::pay from _FixAccountForLostAndReturned is not used. That means that the credit for the lost item fee may be applied to other fees before it is used on the lost fee itself.

Test Plan:
1) Find a patron with existing fines
2) Ensure your settings will charge patrons for lost items
3) Check out an item to a patron with existing fees that need paid
4) Mark the item lost, charging the lost item fee
5) Return the item
6) Note the fee was refunded, but it paid down earlier fines first,
   and not the lost item fee first
7) Apply this patch set
8) Repeat steps 1 - 5
9) Note the lost item fee is the first fee to be paid off by the lost
   item fee refund

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Followed the test plan and it works as expected.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Nick Clemens 2018-06-15 10:44:16 UTC
Awesome work all!

Pushed to master for 18.11
Comment 9 Martin Renvoize 2018-06-15 12:13:49 UTC
Pushed to 18.05.x for 18.05.01
Comment 10 Fridolin SOMERS 2018-06-18 07:03:00 UTC
Pushed to 17.11.x for 17.11.07