From 327f14a31de5af8e283a35f6352aafda16b2eb8f Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Fri, 6 Apr 2018 14:59:28 +0000
Subject: [PATCH] Bug 20122: Explicitly set path to fix emptying cart
 functionality

This is caused by bib_list not being deleted.
The path was not explicitly set.
This patch adds path=/ explicitly to ensure it
does get deleted.

TEST PLAN
---------
1) search for 'the' in OPAC
2) add several items to cart.
3) look at your cart.
4) empty and close the cart, select all->remove
   -- either way window closes and it looks empty.
5) refresh the page
   -- cart comes back.
   -- in chromium inspecting the page, specifically
      the "Application" area, bib_list is shown as
      a cookie still.
6) apply patch
7) restart_all and empty cache forcing JS reload
8) repeat steps 1-5
   -- this time cart stays empty.
   -- and the bib_list cookie is gone

Signed-off-by: Roch D'Amour <roch.damour@inlibro.com> using firefox 59.0.2

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 koha-tmpl/opac-tmpl/bootstrap/js/basket.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js
index cd8d43931a..9eb66309ab 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js
+++ b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js
@@ -57,9 +57,9 @@ function delCookie(name) {
     var exp = new Date();
     exp.setTime(exp.getTime()-1);
     if(parent.opener){
-        parent.opener.document.cookie = name + "=null; expires=" + exp.toGMTString();
+        parent.opener.document.cookie = name + "=null; path=/; expires=" + exp.toGMTString();
     } else {
-        document.cookie = name + "=null; expires=" + exp.toGMTString();
+        document.cookie = name + "=null; path=/; expires=" + exp.toGMTString();
     }
 }
 
-- 
2.14.1