https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42466
--- Comment #4 from Jonathan Druart <[email protected]> --- Created attachment 198943 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198943&action=edit Bug 42466: Fix ignored form validation on paycollect When UseCashRegisters is enabled and a change value bigger than 0 exists (the amount tendered is bigger than the amount paid) the form could be submitted without a required cash register. The modal dialog informing of the change value would simply ignore missing other required fields. Also warnings on 'Amount tendered' did not disappear when 'Amount being paid' was set to a higher value and later reset to a lower value than 'Amount tendered'. This patch fixes both issues by moving the modal dialog (confirm change money) to the form validations submit handler and by validating the form on each update of 'Amount tendered' or 'Amount being paid'. Test plan: a) enable UseCashRegisters and create one under /cgi-bin/koha/admin/cash_registers.pl?op=add_form b) create a manual fee (f.e. 10) f.e. via /cgi-bin/koha/members/maninvoice.pl?borrowernumber=16 c) There are several ways to reach the 'Pay an amount toward all charges' form: - Patron -> Accounting -> (Tab) Make a payment - Patron -> Details -> Attention -> Pay all charges d) enter the follwing values - Amount being paid: 7 - Amount tendered: 6 -> a warning will appear : Please enter a value greater than or equal to 7. e) set - Amount being paid: 5 -> The warning remains visible: Please enter a value greater than or equal to 7. f) Click confirm -> Modal which wants you to confirm that there is a change left. g) Click yes. The form will be sent even though the required filed 'Payment type' is not set. h) go to the payments form again. Total amount outstanding should be 5.00 now enter the following so that change is > 0.00 - Amount being paid: 3 - Amount tendered: 4 - Payment type: Cash i) Click confirm -> Modal which wants you to confirm that there is a change left. j) Click yes. You will see an Error trace page As long as 'Change to give' is other than 0.00 you will be able to send the form. Apply patch: l) repeat b) until e) and check that the warning disappears when Amount being paid is lower or equal than Amount tendered m) check that clicking Confirm will not send the form n) check that when Payment type is set to Cash, the Cash register is required to send the form. Signed-off-by: David Nind <[email protected]> Amended-by: Jonathan Druart Tidy Signed-off-by: Jonathan Druart <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
