From 35e811d3acedcfb53fa07a62e09e720f674266ec Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Tue, 14 May 2024 11:08:19 +0000 Subject: [PATCH] Bug 24424: Advanced editor - interface hangs as "Loading" when given an invalid bib number The Advanced Editor hangs with "Loading, please wait" message when given an invalid bib number, e.g. /cgi-bin/koha/cataloguing/editor.pl#catalog/55555 This is because in the bug 16424, when changes had been made to koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js (Bug 16424: Add framework support to advanced MARC editor), the .fail callback method of the outer .get (in the KohaBackend.GetRecord function called from cateditor-ui.inc) had been (perhaps by mistake?) removed. So, in case of failure, the situation is not handled properly. The proposal is to restore the outer .fail. As a result, the openRecord( 'new/', editor, finishCb ); will be called (a standard way of resolving failed openRecord action (cf. the bottom of cateditor-ui.inc). Test plan: ========== 0. Be sure your browser does not cache JavaScript for this test. 1. Enable EnableAdvancedCatalogingEditor in the system preferences. 2. Try to open in the advanced editor an unexisting record, e.g. http://your_ktd:8081/cgi-bin/koha/cataloguing/editor.pl#catalog/55555 Koha should hang with a message "Loading, please wait". 3. Apply the patch, restart_all. 4. In a new browser window, repeat p. 2 (remember not to cache JS). 5. The editor should open with a new empty record. Sponsored-by: Ignatianum University in Cracow Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer (cherry picked from commit 4d344fd3ab6fa988a9b3e79e683c8217f0705d2c) Signed-off-by: Fridolin Somers --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js index 5410f77563..4083657601 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js @@ -128,6 +128,8 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin } ).fail( function( data ) { callback( { error: _('Could not fetch frameworkcode for record') } ); } ); + } ).fail( function( data ) { + callback( { error: data } ) } ); }, -- 2.39.5