From 955704b332a638e19faaa5c48212dc965c072e52 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 20 Nov 2019 16:01:56 +0000 Subject: [PATCH] Bug 22359: Improvements to payment collection inputs This patch attempts to clarify the uses of the various input fields on the paycollect screens. It does this by adding validation to the form such that entering a 'collected' value that is lower than the 'paid' value is now forbidden. Signed-off-by: Michal Denar --- .../prog/en/modules/members/paycollect.tt | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index a71eecaf2c..ff074c74d9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -107,11 +107,11 @@
  • - +
  • - +
  • @@ -230,16 +230,16 @@ [% total | format('%.2f') %]
  • - - + +
  • [% IF type == 'writeoff' %] [% ELSE %] - + [% END %] - +
  • @@ -360,6 +360,15 @@ $('#modal_submit').click(function() { forms[0].submit(); }); + + $( "#payindivfine, #woindivfine, #payfine" ).validate({ + rules: { + paid: { required: true }, + collected: { + required: true + } + } + }); }); prevent_default = 1; @@ -433,6 +442,10 @@ var change = $('#change')[0]; change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100; if (change.innerHTML <= 0) { + var paid = $('#paid')[0]; + moneyFormat(paid); + $('#collected').rules( "add", { min: paid.value }); + $( "#payindivfine, #woindivfine, #payfine" ).valid(); change.innerHTML = "0.00"; $('input[name="change_given"]').val('0.00'); } else { -- 2.11.0