From 01fc41ca593ee030a77c2462acda0dc59dfe7ec0 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 Signed-off-by: Katrin Fischer Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/pos/pay.tt | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 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..4d35b60ff7 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. @@ -258,7 +258,6 @@ var paid = $('#paid')[0]; moneyFormat(paid); $('#collected').rules( "add", { min: Number(paid.value) }); - $("#payForm").valid() change.innerHTML = zero_formatted; $(':input[name="change"]').val(zero_formatted); } else { @@ -372,11 +371,19 @@ $('#payForm').submit(); }); - $( "#payForm" ).validate({ + $('#payForm').validate({ rules: { - paid: { required: true }, + paid: { + required: true + }, collected: { required: true + }, + payment_type: { + required: true + }, + registerid: { + required: true } } }); @@ -403,17 +410,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.39.5