From 4d16cddd7cf495f58f509a930377fdf977876647 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 16 Dec 2020 19:26:11 +0000 Subject: [PATCH] Bug 27256: Update click handler for point of sale This patch updates the click handler to bind to the table element in the DOM as aposed to the individual buttons by their classes. We then use the event propogation and filter on the button class to catch the clicks we want. Test plan 1/ Add 22 debit_types that can be sold to the system (or reduce the datatable paging size) 2/ Confirm that items on the second page of results cannot be added for sale on the point of sale page. 3/ Apply the patch 4/ Confirm items from the second table page can now be added correctly 5/ Clicking add when navigating to such an item should leave the items table unmodified. 6/ Clicking aa when the table was filtered should reset the filters bringing the table back to the first page 7/ Signoff Signed-off-by: Owen Leonard Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart (cherry picked from commit 68047132a4888db6eb5169e1cd3ceac49aa84b3b) Signed-off-by: Fridolin Somers (cherry picked from commit f0b4ebc2bf74c408102c19bb7c2a85279762f691) Signed-off-by: Andrew Fuerste-Henry --- koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 02f159cfc9..1b8ce42854 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -341,10 +341,12 @@ "paginationType": "full", })); - $(".add_button").on("click", function(e) { + $("#invoices").on("click", ".add_button", function(e) { e.preventDefault(); fnClickAddRow(sale_table, $( this ).data('invoiceCode'), $( this ).data('invoiceTitle'), $( this ).data('invoicePrice') ); - items_table.fnFilter( '' ); + if($('#invoices_filter').find('input[type=search]').val() !== ''){ + items_table.fnFilter( '' ); + } }); // Change calculation and modal -- 2.39.5