Bug 24489 - Prevent user from paying/writing off 0
Summary: Prevent user from paying/writing off 0
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 14825
  Show dependency treegraph
 
Reported: 2020-01-23 12:56 UTC by Nick Clemens (kidclamp)
Modified: 2021-02-04 13:01 UTC (History)
4 users (show)

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


Attachments
Bug 24489: Don't allow payment of 0 (1.64 KB, patch)
2020-01-23 13:01 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 24489: Don't allow payment of 0 (1.70 KB, patch)
2020-02-05 14:15 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2020-01-23 12:56:30 UTC
On paycollect.pl we call 'moneyFormat' on the 'paid' and 'collected' amounts - this changes fractions of a cent to 0, however, we allow for submission of the 0

When paying 0 we redirect to the page, but lose some inputs so writing off selected, attempting to pay less than a cent, we get redirected to 'Pay fines'

We should check the form before submission and prevent submission of 0
Comment 1 Nick Clemens (kidclamp) 2020-01-23 13:01:45 UTC
Created attachment 97815 [details] [review]
Bug 24489: Don't allow payment of 0

To test:
1 - Put a fine on a patron
2 - Go to Accounting->Make a payment on the patrons record
3 - Select the fine and click 'Write off selected'
4 - Enter '.0001' into Writeoff amount and hit confirm
5 - You are redirected to make a payment with no error and are no longer writing off selected
6 - Apply patch
7 - Attempt to pay less than a cent
8 -  You are warned that you must pay more than 0
Comment 2 Martin Renvoize (ashimema) 2020-02-05 14:15:39 UTC
Created attachment 98492 [details] [review]
Bug 24489: Don't allow payment of 0

To test:
1 - Put a fine on a patron
2 - Go to Accounting->Make a payment on the patrons record
3 - Select the fine and click 'Write off selected'
4 - Enter '.0001' into Writeoff amount and hit confirm
5 - You are redirected to make a payment with no error and are no longer writing off selected
6 - Apply patch
7 - Attempt to pay less than a cent
8 -  You are warned that you must pay more than 0

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize (ashimema) 2020-02-05 14:16:12 UTC
Thanks for jumping on this Nick.. :)

Signing off
Comment 4 Nick Clemens (kidclamp) 2020-02-05 14:56:16 UTC
This patch does highlight some issues - it is possible to create fines of partial cents. With this patch those fines cannot be written off, or at least the partial cents cannot.
Comment 5 Martin Renvoize (ashimema) 2020-04-23 08:07:11 UTC
(In reply to Nick Clemens from comment #4)
> This patch does highlight some issues - it is possible to create fines of
> partial cents. With this patch those fines cannot be written off, or at
> least the partial cents cannot.

Can you clarify how fines can end up as partial cents.. I've lost track of where/how this can happen :(