From ee09b9f289ad3cd36a6734f9317ec878ac8cf709 Mon Sep 17 00:00:00 2001 From: Shi Yao Wang Date: Thu, 12 Oct 2023 15:51:55 -0400 Subject: [PATCH] Bug 34668: remove binding/unbinding event for one submit event --- .../prog/en/modules/circ/circulation.tt | 37 +++++-------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 45932a0de6..c9522f1b66 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -666,11 +666,7 @@ - [% IF waiting_holds_barcodes %] - - [% ELSE %] - - [% END %] +
@@ -966,29 +962,16 @@ [% FOREACH b IN waiting_holds_barcodes %] waiting_holds_barcodes.push("[% b | html %]"); [% END %] - $('#barcode').on('keyup', function() { - $('#mainform .btn-primary').off('click'); - $('#barcode').off('keypress'); - if ( waiting_holds_barcodes.includes($('#barcode').val().trim()) ) { - $('#mainform .btn-primary').on('click',function() { - $('#mainform').submit(); - }); - - $('#barcode').on('keypress', function(e) { - if (e.which == 13) { - $('#mainform').submit(); - } - }); - } else { - $('#mainform .btn-primary').on('click',function() { + $('#mainform').on('submit', function() { + if (waiting_holds_barcodes) { + if ( waiting_holds_barcodes.includes($('#barcode').val().trim()) ) { + return true; + } else { $('#circ-warnwaitingholds-modal').modal(); - }); - - $('#barcode').on('keypress', function(e) { - if (e.which == 13) { - $('#circ-warnwaitingholds-modal').modal(); - } - }); + return false; + } + } else { + return true; } }); [% END %] -- 2.34.1