Bug 20122 - Empty and close link on cart page not working
Summary: Empty and close link on cart page not working
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: M. Tompsett
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-01 15:50 UTC by Mark G
Modified: 2018-05-22 10:59 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20122: Empty lists keep coming back (2.18 KB, patch)
2018-04-06 16:12 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20122: Empty lists keep coming back (1.70 KB, patch)
2018-04-06 16:14 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20122: Empty lists keep coming back (1.67 KB, patch)
2018-04-06 16:15 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 20122: Empty lists keep coming back (1.75 KB, patch)
2018-04-06 21:21 UTC, Roch D'Amour
Details | Diff | Splinter Review
Bug 20122: Explicitly set path to fix emptying cart functionality (1.84 KB, patch)
2018-04-07 10:05 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mark G 2018-02-01 15:50:17 UTC
Clicking the 'Empty cart and close' link when viewing the contents of a cart at /cgi-bin/koha/opac-basket.pl does not work.

There are javascript security errors because the page opens in a new window but scripts in /opac-tmpl/bootstrap/js/basket.js such as updateBasket try to access and change values in the parent window (referred to as top.opener) - this is blocked by the browser.
Comment 1 Jonathan Druart 2018-02-05 15:22:34 UTC
Which version of Koha?

Which browser?

Works for me on master with Firefox 58.0.1
Comment 2 Mark G 2018-02-06 13:56:41 UTC
Sorry, thought I'd mentioned the Koha version!

It's Koha 17.05.08, browsers tested are:

Chrome 63.0.3239.132
Safari 11.0.2
Edge 40.15063.674.0
Comment 3 Jonathan Druart 2018-02-28 18:13:19 UTC
Work for me on v17.05.08 and chromium 64.0.3282.119
Comment 4 Owen Leonard 2018-03-16 12:50:29 UTC
I've tested this in multiple browsers in master and on 17.05.09 and cannot reproduce the problem.
Comment 5 Kyle M Hall 2018-04-04 18:39:50 UTC
I was able to reproduce on master. It appears that the empty link works until you reload the page, then the items come back. Furthermore the remove items button doesn't work if *all* items are selected, but does if only some of the cart items are selected.
Comment 6 M. Tompsett 2018-04-06 16:02:55 UTC
(In reply to Kyle M Hall from comment #5)
> I was able to reproduce on master. It appears that the empty link works
> until you reload the page, then the items come back. Furthermore the remove
> items button doesn't work if *all* items are selected, but does if only some
> of the cart items are selected.

All because bib_list cookie is not properly deleted.
Comment 7 M. Tompsett 2018-04-06 16:12:02 UTC
Created attachment 73788 [details] [review]
Bug 20122: Empty lists keep coming back

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
9) run koha qa test tools.

NOTE: Shout out to Owen Leonard for this version.
Comment 8 M. Tompsett 2018-04-06 16:14:08 UTC
Created attachment 73789 [details] [review]
Bug 20122: Empty lists keep coming back

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
9) run koha qa test tools.
Comment 9 M. Tompsett 2018-04-06 16:15:32 UTC
Created attachment 73790 [details] [review]
Bug 20122: Empty lists keep coming back

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
Comment 10 Roch D'Amour 2018-04-06 21:21:04 UTC
Created attachment 73803 [details] [review]
Bug 20122: Empty lists keep coming back

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
Comment 11 Katrin Fischer 2018-04-07 10:05:17 UTC
Created attachment 73828 [details] [review]
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>
Comment 12 Katrin Fischer 2018-04-07 10:06:22 UTC
Hi Mark, please remember that the patch subject line should describe the patch!
Comment 13 Owen Leonard 2018-04-08 12:40:13 UTC
I had assigned this bug to myself, and told you that I had a fix ready. I'm not sure why you duplicated my effort.
Comment 14 Jonathan Druart 2018-04-09 19:16:29 UTC
Pushed to master for 18.05, thanks to everybody involved!
Comment 15 Nick Clemens 2018-05-14 21:13:38 UTC
Pushed to stable for 17.11.06

Awesome work all!
Comment 16 Fridolin SOMERS 2018-05-22 10:59:05 UTC
Pushed to 17.05.x for v17.05.12