From 4161e315b01364bd1e7f67a0dbdc9f152a1ca2e8 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 23 Jun 2021 22:03:09 +0000 Subject: [PATCH] Bug 28196: make sure URL hash is appended last TO test: 1 Do a search within the staff client 2 Click on any results and go to the detail page 3 Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnumber=117#edititem&searchid=scs_1619109565224' 4 Apply patch 5 Do steps 1 & 2 again Click the edit button on any item in that record, it should take you to a URL like this: '/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=55&itemnum ber=117&searchid=scs_1619109565224#edititem' 6. If they URL hash is last the anchor should work and you'll be placed on the h2 element with and ID of edititem --- koha-tmpl/intranet-tmpl/js/browser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js index 19d707376e..c5666ac170 100644 --- a/koha-tmpl/intranet-tmpl/js/browser.js +++ b/koha-tmpl/intranet-tmpl/js/browser.js @@ -105,7 +105,8 @@ KOHA.browser = function (searchid, biblionumber) { }); $('a[href*="biblionumber="]').not('a[target="_blank"]').click(function (ev) { ev.preventDefault(); - window.location = $(this).attr('href') + '&searchid=' + me.searchid; + var url = new URL($(this).attr('href'), window.location.origin); + window.location = url.pathname + url.search + 'searchid=' + me.searchid + url.hash; }); $('form[name="f"]').append(''); } -- 2.11.0