From 1ff666cc4a0eeb9bb4f0f43904dfa54d6b469c45 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 20 May 2014 14:58:32 -0400 Subject: [PATCH] Bug 12295 - Javascript error when merging authorities Attempting to merge authorities results in the following error: Uncaught SyntaxError: Unexpected token u authorities-home.pl:284 showMergingInProgress authorities-home.pl:284 (anonymous function) authorities-home.pl:297 o jquery.js:2 p.fireWith jquery.js:2 e.extend.ready jquery.js:2 c.addEventListener.B This appears to be an improper use of Javascript null vs undefined. A variable can be null and defined at the same time. We should be checking to see if the variable is defined, rather than null. --- .../prog/en/includes/authorities_js.inc | 4 ++-- 1 files changed, 2 insertions(+), 2 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 d1964d1..7844f3d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc @@ -1,6 +1,6 @@ function mergeAuth(authid, summary) { var alreadySelected = $.cookie('auth_to_merge'); - if (alreadySelected !== null) { + if (alreadySelected !== undefined) { alreadySelected = JSON.parse(alreadySelected); $.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 }); var refstring = ""; @@ -16,7 +16,7 @@ function mergeAuth(authid, summary) { function showMergingInProgress() { var alreadySelected = $.cookie('auth_to_merge'); - if (alreadySelected !== null) { + if (alreadySelected !== undefined) { alreadySelected = JSON.parse(alreadySelected); $('#merge_in_progress').html(_("Merging with authority: ") + "" + alreadySelected.summary + " (" + alreadySelected.authid + ") " + _("Cancel merge") + ""); $('#cancel_merge').click(function(event) { -- 1.7.2.5