From 12f3e8ce5c2b190e954667d4c1fe83467325eec7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 2 Oct 2018 17:34:44 -0300 Subject: [PATCH] Bug 21479: Fix remove from cart - OPAC This bug affects all stable releases and seems to have been there for a long time. To recreate: - Launch a search at the OPAC - Add 2 elements to the cart - Remove one => Cart is empty Note that it does not exist on the staff interface The code in opac-bottom is only for the detail page, where biblionumber is defined, but the event binding was done on the result search page as they have the same selector (.cartRemove) On the results page, the biblionumber is not defined and triggers the deletion of all the items as a result. Using a more specific selector (this solution is already used for "add to shelf") fixes the problem Test plan: Add and remove elements to/from your cart On both search and detail view Signed-off-by: Mark Tompsett --- koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index ab7eb2c..7ea1c3b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -188,11 +188,11 @@ $.widget.bridge('uitooltip', $.ui.tooltip); Dopop('opac-addbybiblionumber.pl?biblionumber=[% biblionumber | html %]'); return false; }); - $(".addrecord").on("click",function(){ + $("#ulactioncontainer > ul > li > a.addrecord").on("click",function(){ addRecord('[% biblionumber | html %]'); return false; }); - $(".cartRemove").on("click",function(){ + $("#ulactioncontainer > ul > li > a.cartRemove").on("click",function(){ delSingleRecord('[% biblionumber | html %]'); return false; }); -- 2.1.4