From dfd38e4d9f2307e3e8be1172f98fa856e8550b61 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 19 Oct 2023 09:17:57 -1000 Subject: [PATCH] Bug 35110: Authorities editor with JS error when only one tab Exactly like Bug 34251 for biblios : When using the an authorities framework with all fields in the same tab, there is thrown a JS error in selectTab( "#tab0XX_panel" ); This is because no nav tabs are build in authorities/authorities.tt as BIG_LOOP has a length(size) of 1 Test plan : 1) Edit an authority framework, for example 'Meeting Name', to set all sufields in tab 0 You may use SQL : UPDATE auth_subfield_structure SET tab=0 WHERE authtypecode='MEETI_NAME' Don't forget to restart memcached 2) Go to 'Authorities' 3) Click on 'New authority' then 'Meeting Name' 4) Check you don't see any JavaScript error 5) Check you can save Signed-off-by: David Nind Signed-off-by: Katrin Fischer Bug 35110: (follow-up) Fix comment in addbiblio.tt Change comment in addbiblio.tt since any biblio framework may use only one tab. Also fixes indenting using 4 spaces. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi Edit: squashed because follow-up fixes code introduced by the same author. Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 32e301df15d2eb73d43cb4cdbbb4b5b45bd3e784) Signed-off-by: Fridolin Somers (cherry picked from commit 748ea28983d1407686e42cd29c4cfedf821bf1bb) Signed-off-by: Matt Blenkinsop --- .../intranet-tmpl/prog/en/modules/authorities/authorities.tt | 4 ++++ .../intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 295fb77e68..8624f5110c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -84,6 +84,10 @@ }); function selectTab( tablink ){ + /* return if no tabs displayed (BIG_LOOP.size <= 1) */ + if ($(".toolbar-tabs-container .nav-tabs li").length === 0){ + return; + } let a = $("a[href='" + tablink + "']"); $(".toolbar-tabs-container .nav-tabs li").removeClass("selected"); a.tab("show").parent().addClass("selected"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index f58826c1fc..76cbac6922 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -191,9 +191,9 @@ }); function selectTab( tablink ){ - /* return if no tabs displayed (fast add framework) */ + /* return if no tabs displayed (BIG_LOOP.size <= 1) */ if ($(".toolbar-tabs-container .nav-tabs li").length === 0){ - return; + return; } let a = $("a[href='" + tablink + "']"); $(".toolbar-tabs-container .nav-tabs li").removeClass("selected"); -- 2.39.5