From a49806bcba8794aae87f32c664a98cabe35e2a37 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 --- 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 d57f97637f..8da966b6a2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -342,10 +342,12 @@ "aaSorting": [[ 0, "asc" ]], }, items_columns_settings, false); - $(".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.11.0