Bug 27967 - Modals on the borrower account page don't validate minimum values
Summary: Modals on the borrower account page don't validate minimum values
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Tomás Cohen Arazi (tcohen)
URL:
Keywords:
Depends on:
Blocks: 24300
  Show dependency treegraph
 
Reported: 2021-03-16 16:36 UTC by Martin Renvoize (ashimema)
Modified: 2022-12-12 21:24 UTC (History)
4 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:
21.05.00
Circulation function:


Attachments
Bug 27967: Add min attribute to borraccount modals (2.19 KB, patch)
2021-03-16 16:46 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27967: Add min attribute to borraccount modals (2.24 KB, patch)
2021-03-17 17:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27967: Add min attribute to borraccount modals (2.29 KB, patch)
2021-03-17 17:43 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2021-03-16 16:36:35 UTC
Whilst working on bug 24300 we noticed that most of the modal forms don't add any form of validation for minimum values.. so although we ensure we don't go over a maximum, we're not ensuring we have the right 'sign'.
Comment 1 Martin Renvoize (ashimema) 2021-03-16 16:46:32 UTC
Created attachment 118339 [details] [review]
Bug 27967: Add min attribute to borraccount modals

This patch adds a min attribute to the form fields of the borrower
account page modals to prevent negative values being entered
inappropriately.

Test plan
1/ Trigger the refund modal from the borrower account page.
2/ Attempt to enter a negative value for the amount to refund and note
with the patch applied you face a validation error (without the patch,
upon submission of a negative value you will be faced with a server side
error)
3/ Trigger the discount modal from the borrower account page.
4/ Attempt to enter a negative value for the amount to discount and note
with the patch applied you face a validation error (without the patch,
upon submission of a negative value you will be faced with a server side
error)
5/ Signoff
Comment 2 Owen Leonard 2021-03-17 17:27:26 UTC
Created attachment 118426 [details] [review]
Bug 27967: Add min attribute to borraccount modals

This patch adds a min attribute to the form fields of the borrower
account page modals to prevent negative values being entered
inappropriately.

Test plan
1/ Trigger the refund modal from the borrower account page.
2/ Attempt to enter a negative value for the amount to refund and note
with the patch applied you face a validation error (without the patch,
upon submission of a negative value you will be faced with a server side
error)
3/ Trigger the discount modal from the borrower account page.
4/ Attempt to enter a negative value for the amount to discount and note
with the patch applied you face a validation error (without the patch,
upon submission of a negative value you will be faced with a server side
error)
5/ Signoff

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Tomás Cohen Arazi (tcohen) 2021-03-17 17:43:10 UTC
Created attachment 118428 [details] [review]
Bug 27967: Add min attribute to borraccount modals

This patch adds a min attribute to the form fields of the borrower
account page modals to prevent negative values being entered
inappropriately.

Test plan
1/ Trigger the refund modal from the borrower account page.
2/ Attempt to enter a negative value for the amount to refund and note
with the patch applied you face a validation error (without the patch,
upon submission of a negative value you will be faced with a server side
error)
3/ Trigger the discount modal from the borrower account page.
4/ Attempt to enter a negative value for the amount to discount and note
with the patch applied you face a validation error (without the patch,
upon submission of a negative value you will be faced with a server side
error)
5/ Signoff

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Jonathan Druart 2021-03-18 14:07:03 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 5 Fridolin Somers 2021-03-22 09:52:48 UTC
Enhancement not pushed to 20.11.x