From f27fda3b4ff575596433972917cdbbaca892df64 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Tue, 5 Jan 2021 09:30:16 +0100 Subject: [PATCH] Bug 27338: Use current window as fallback, if no opener window available during importing record from Z39.50 Test plan: 1) Apply the patch 2) Confirm there is no regression_ 2a) Go to cataloguing (basic editor) 2b) Click on "New from Z39.50/SRU" or some dropdown variant for particular framework 2c) Perform a search and import a record 2f) Record is imported into editor and search window is closed 3) Open new browser tab/window and go direct to Z39.50 search url: /cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=&frameworkcode=BKS 4) Perform a search and import a record. It should be imported into the current tab/window Signed-off-by: Michal Denar --- koha-tmpl/intranet-tmpl/prog/js/z3950_search.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js b/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js index 39a7af0c0d..6a146a0e88 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js +++ b/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js @@ -1,13 +1,15 @@ /* global __ total_pages */ //z3950_search.js for Authorities, Bib records and Acquisitions module function Import(Breeding, recordid, AuthType, FrameworkCode) { - + target = (window.opener != null) ? window.opener.document : document; if ( AuthType == false ) { - opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding; + target.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding; } else { - opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid; + target.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid; + } + if (window.opener != null) { + window.close(); } - window.close(); return false; } -- 2.11.0