From 8c452838fc2d486e236be425577962d6bc257d85 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 21 Dec 2020 16:25:47 +0000 Subject: [PATCH] Bug 27290: Clean up validation It seems we had the validator instantiated twice and we used a mix of validation of required at form element level and in JS instantiator. This patch moves the rules to consistently apply at the instantiation and removes the duplicate lines. To test: 1 - Enable 'useCashRegisters' and 'EnablePointofSale' 2 - Add a cash register 3 - Add a debit type that can be sold 4 - Go to point of sale and sell the item multiple times 5 - Enter 'Amount tendered' less than amount being paid 6 - Click confirm 7 - Transaction is processed as if full funds received 8 - Try with a negative number - goes through again Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize --- .../intranet-tmpl/prog/en/modules/pos/pay.tt | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index efdea82446..d11c8c4416 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -112,7 +112,7 @@
  1. - +
  2. @@ -372,11 +372,16 @@ $('#payForm').submit(); }); - $( "#payForm" ).validate({ + $('#payForm').validate({ rules: { - paid: { required: true }, + paid: { + required: true + }, collected: { required: true + }, + registerid: { + required: true } } }); @@ -403,17 +408,6 @@ } }); - $('#payForm').validate({ - rules: { - collected: { - required: true - }, - registerid: { - required: true - } - } - }); - [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %] $("#printReceipt").click(function() { var win = window.open('/cgi-bin/koha/pos/printreceipt.pl?action=print&accountlines_id=[% payment_id | uri %]&collected=[% collected | uri %]&change=[% change | uri %]', '_blank'); -- 2.20.1