Bug 25526 - Using Write Off Selected will not allow for a different amount to be written off
Summary: Using Write Off Selected will not allow for a different amount to be written off
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Martin Renvoize
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-18 11:49 UTC by Kelly McElligott
Modified: 2021-06-14 21:31 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00. 20.05.01, 19.11.07, 19.05.12


Attachments
Bug 25526: Allow write off selected of less than or equal to amount (1.53 KB, patch)
2020-06-02 22:31 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 25526: Allow write off selected of less than or equal to amount (1.59 KB, patch)
2020-06-03 15:07 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25526: [ALTERNATIVE] Equality matching is case sensative (2.36 KB, patch)
2020-06-08 09:39 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 25526: Equality matching is case sensative (2.34 KB, patch)
2020-06-08 09:51 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 25526: Equality matching is case sensative (2.41 KB, patch)
2020-06-08 11:16 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 25526: Equality matching is case sensative (2.45 KB, patch)
2020-06-14 11:38 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 Kelly McElligott 2020-05-18 11:49:19 UTC
Using the Write Off Selected option in the Accounting Module, a user can not choose to write off a specific amount. If a user chooses to Write Off under the Actions button, then a specific amount can be written off as opposed to the full line item's amount. However, if the "Write Off Selected" is chosen a specific amount can not be typed in, Koha gives an error.


1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3.  Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value greater than or equal to 2.00." The $2.00 is the amount that is attempted to write off (the amount less than the amount owed).
Comment 1 Katrin Fischer 2020-05-22 11:31:32 UTC
Hi Kelly,

I can confirm the bug in master too - you have the form field to change the value, but you are not able to submit:

 You must collect a value greater than or equal to 2.00. 

Where 2.00 is the value I entered for write-off, not the total fine on the account. Updated severity a bit as I think we should fix this urgently.
Comment 2 Lucas Gass 2020-06-02 22:31:58 UTC
Created attachment 105507 [details] [review]
Bug 25526: Allow write off selected of less than or equal to amount

TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3.  Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value greater than or equal to 2.00." The $2.00 is the amount that is attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to pay an amount less than the amount owed.
7. You should be able to pay it off.
8. Try paying an amount more than owed, you should still get an error. You shouldn't be able to write off more than the amount.
9. Make sure 'Pay selected' still works as it should.
Comment 3 ByWater Sandboxes 2020-06-03 15:07:19 UTC
Created attachment 105528 [details] [review]
Bug 25526: Allow write off selected of less than or equal to amount

TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3.  Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value greater than or equal to 2.00." The $2.00 is the amount that is attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to pay an amount less than the amount owed.
7. You should be able to pay it off.
8. Try paying an amount more than owed, you should still get an error. You shouldn't be able to write off more than the amount.
9. Make sure 'Pay selected' still works as it should.

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Comment 4 Martin Renvoize 2020-06-08 09:35:26 UTC
The proposed patch circumvents the serverside under-collection protection.

To test:
1/ Disable javascript in the browser (in chrome you can do this via the developer tool > settings > disable Javascript)
2/ Attempt to pay part of a fine... enter an amount less than the 'amount being paid' into the 'amount tendered' box
3/ Without the patch, you would be faced with an undercollection error message (the yellow error box mentioned above)
4/ With the patch, you will not face any errors and the full payment amount will have been recorded against the accountable, not the lower amount you actually collected from the patron.

Failing QA - Correct patch to follow.
Comment 5 Martin Renvoize 2020-06-08 09:39:34 UTC
Created attachment 105625 [details] [review]
Bug 25526: [ALTERNATIVE] Equality matching is case sensative

TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3. Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value
   greater than or equal to 2.00." The $2.00 is the amount that is
   attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to writeoff an amount less than the amount owed.
7. You should be able to write it off.
8. Try paying an amount more than owed, you should still get an
   error. You shouldn't be able to write off more than the amount.
9. Follow the above steps via 'Pay selected' as aposed to 'Writeoff
   selected'.
10. You should not be able to 'Tender' less than the amount you have
    'Paid'.
11. Disable Javascript and run through all the above steps. You should
    still be blocked where relevant.
Comment 6 Martin Renvoize 2020-06-08 09:51:36 UTC
Created attachment 105627 [details] [review]
Bug 25526: Equality matching is case sensative

TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3. Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value
   greater than or equal to 2.00." The $2.00 is the amount that is
   attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to writeoff an amount less than the amount owed.
7. You should be able to write it off.
8. Try paying an amount more than owed, you should still get an
   error. You shouldn't be able to write off more than the amount.
9. Follow the above steps via 'Pay selected' as aposed to 'Writeoff
   selected'.
10. You should not be able to 'Tender' less than the amount you have
    'Paid'.
11. Disable Javascript and run through all the above steps. You should
    still be blocked where relevant.
Comment 7 Martin Renvoize 2020-06-08 09:54:28 UTC
Bonus points.. the updated patch also fixes a related error.

Test Plan
1/ Check the write-off permissions for the same scenarios and you will find the prior to this patch, they were not properly adhered to at the serverside
Comment 8 Kyle M Hall 2020-06-08 11:16:44 UTC
Created attachment 105637 [details] [review]
Bug 25526: Equality matching is case sensative

TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3. Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value
   greater than or equal to 2.00." The $2.00 is the amount that is
   attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to writeoff an amount less than the amount owed.
7. You should be able to write it off.
8. Try paying an amount more than owed, you should still get an
   error. You shouldn't be able to write off more than the amount.
9. Follow the above steps via 'Pay selected' as aposed to 'Writeoff
   selected'.
10. You should not be able to 'Tender' less than the amount you have
    'Paid'.
11. Disable Javascript and run through all the above steps. You should
    still be blocked where relevant.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Katrin Fischer 2020-06-14 11:33:50 UTC
This works and fixes the bug, but the whole 'change calculation' still feels kludgy to me. I have filed bug 25746 with a suggestion to improve things (again).
Comment 10 Katrin Fischer 2020-06-14 11:38:57 UTC
Created attachment 105856 [details] [review]
Bug 25526: Equality matching is case sensative

TEST PLAN:
1. Have a fine on a Patron's account.
2. Choose the "Write off Selected" button
3. Enter an amount less than the amount owed by the patron.
4. Koha will give a yellow box with a note "You must collect a value
   greater than or equal to 2.00." The $2.00 is the amount that is
   attempted to write off (the amount less than the amount owed).
5. Apply patch
6. Again try to writeoff an amount less than the amount owed.
7. You should be able to write it off.
8. Try paying an amount more than owed, you should still get an
   error. You shouldn't be able to write off more than the amount.
9. Follow the above steps via 'Pay selected' as aposed to 'Writeoff
   selected'.
10. You should not be able to 'Tender' less than the amount you have
    'Paid'.
11. Disable Javascript and run through all the above steps. You should
    still be blocked where relevant.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Jonathan Druart 2020-06-15 10:00:02 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 12 Lucas Gass 2020-06-17 21:28:15 UTC
backported to 20.05.x for 20.05.01
Comment 13 Aleisha Amohia 2020-06-18 01:53:32 UTC
backported to 19.11.x for 19.11.07
Comment 14 Victor Grousset/tuxayo 2020-06-19 03:36:57 UTC
Backported to 19.05.x branch for 19.05.12