Bug 24489

Summary: Prevent user from paying/writing off 0
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Fines and feesAssignee: Nick Clemens (kidclamp) <nick>
Status: In Discussion --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: kyle.m.hall, kyle, martin.renvoize, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 14825    
Attachments: Bug 24489: Don't allow payment of 0
Bug 24489: Don't allow payment of 0

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 :(