From a401f219481b3fc2a69c2ea5006e6e497d66b37b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 1 Nov 2019 18:15:53 +0000 Subject: [PATCH] Bug 23947: Phase out jquery.cookie.js: Authority merge This patch updates the JavaScript which sets cookies during the authority merge process so that it uses the new js-cookie library. To test, apply the patch and perform a search in the authority module which will return multiple results. - Select "Merge" from the Actions menu next to any result. - A message should appear at the top of the page: "Merging with authority: ". - Click "Cancel merge." The message should disappear. - Select a record to merge again. - Select another record. - The page should redirect to the authority merge page. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Joy Nelson <joy@bywatersolutions.com> --- .../intranet-tmpl/prog/en/includes/authorities_js.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc index 7109dc94ca..f2966019cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc @@ -1,29 +1,29 @@ <script> function mergeAuth(authid, summary) { - var alreadySelected = $.cookie('auth_to_merge'); + var alreadySelected = Cookies.get('auth_to_merge'); if (alreadySelected !== undefined) { alreadySelected = JSON.parse(alreadySelected); - $.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 }); + Cookies.remove('auth_to_merge'); var refstring = ""; if (typeof alreadySelected.mergereference !== 'undefined') { refstring = "&mergereference=" + alreadySelected.mergereference; } window.location.href = "/cgi-bin/koha/authorities/merge.pl?authid=" + authid + "&authid=" + alreadySelected.authid + refstring; } else { - $.cookie('auth_to_merge', JSON.stringify({ 'authid': authid, 'summary': summary }), { 'path' : '/' }); + Cookies.set('auth_to_merge', JSON.stringify({ 'authid': authid, 'summary': summary }), { 'path' : '/' }); showMergingInProgress(); } } function showMergingInProgress() { - var alreadySelected = $.cookie('auth_to_merge'); + var alreadySelected = Cookies.get('auth_to_merge'); if (alreadySelected !== undefined) { alreadySelected = JSON.parse(alreadySelected); $('#merge_in_progress').html(_("Merging with authority: ") + "<a href='detail.pl?authid=" + alreadySelected.authid + "'><span class='authorizedheading'>" + alreadySelected.summary + "</span> (" + alreadySelected.authid + ")</a> <a href='#' id='cancel_merge'>" + _("Cancel merge") + "</a>"); $('#cancel_merge').click(function(event) { event.preventDefault(); - $.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 }); + Cookies.remove('auth_to_merge'); $('#merge_in_progress').empty(); }); } else { -- 2.39.5