Bugzilla – Attachment 193013 Details for
Bug 41838
Fix automatic tab selection on MARC subfield edit pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41838: Fix automatic tab selection on MARC subfield edit pages
Bug-41838-Fix-automatic-tab-selection-on-MARC-subf.patch (text/plain), 8.46 KB, created by
Owen Leonard
on 2026-02-12 14:48:09 UTC
(
hide
)
Description:
Bug 41838: Fix automatic tab selection on MARC subfield edit pages
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2026-02-12 14:48:09 UTC
Size:
8.46 KB
patch
obsolete
>From 483f08426e9ba1cc542cd4d4f8e6237a5673ba49 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 12 Feb 2026 09:34:45 -0500 >Subject: [PATCH] Bug 41838: Fix automatic tab selection on MARC subfield edit > pages > >This patch fixes automatic tab selection on MARC subfield edit pages for >both authority and bibliographic records. The patch also removes some >unused markup and JS associated with old ways of handling tabs. > >To test, apply the patch and go to Administration -> Authority types. > >- Click the "Actions" button for one of the authority types and select > "MARC structure" >- Pick a tag which has multiple subfields, e.g. 020 and click Actions -> > Subfields. >- Click one of the subfield links (not the first one). On the subfield > edit page the corresponding tab should be selected when the page > loads. >- Go back and click the "Edit" button and confirm that this also > selects the correct tab. >- Go to Administration -> MARC bibliographic framework -> MARC > structure -> View subfields and perform the same tests. > >Sponsored-by: Athens County Public Libraries >--- > .../modules/admin/auth_subfields_structure.tt | 8 +-- > .../modules/admin/marc_subfields_structure.tt | 6 +-- > .../prog/js/marc_subfields_structure.js | 52 +++++++++---------- > 3 files changed, 33 insertions(+), 33 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >index 18a88a77bd6..3ffb773e4be 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/auth_subfields_structure.tt >@@ -361,7 +361,9 @@ > [% FOREACH loo IN loop %] > <tr> > <td> >- <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% subfieldanchor | uri %]field">[% loo.tagsubfield | html %]</a> >+ <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&authtypecode=[% authtypecode | uri %]&tagsubfield=[% loo.tagsubfield | uri %]" >+ >[% loo.tagsubfield | html %]</a >+ > > </td> > <td> > [% IF loo.tab == -1 %] >@@ -401,9 +403,7 @@ > [% END %] > </td> > <td class="actions"> >- <a >- href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% loo.tagsubfield | uri %]field" >- class="btn btn-default btn-xs" >+ <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&authtypecode=[% authtypecode | uri %]" class="btn btn-default btn-xs" > ><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a > > > <a >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >index ea4a5907ae7..039d5096d27 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt >@@ -375,7 +375,7 @@ > [% FOREACH loo IN loop %] > <tr> > <td >- ><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&frameworkcode=[% frameworkcode | uri %]#sub[% loo.tagsubfield | uri %]field" >+ ><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&frameworkcode=[% frameworkcode | uri %]&tagsubfield=[% loo.tagsubfield | uri %]" > >[% loo.tagsubfield | html %]</a > ></td > > >@@ -405,7 +405,7 @@ > </td> > <td class="actions"> > <a >- href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&frameworkcode=[% frameworkcode | uri %]#sub[% loo.tagsubfield | uri %]field" >+ href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&tagfield=[% loo.tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&frameworkcode=[% frameworkcode | uri %]" > class="btn btn-default btn-xs" > ><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a > > >@@ -439,7 +439,7 @@ > [% Asset.js( "lib/sortable/Sortable.min.js" ) | $raw %] > [% Asset.js("js/admin-menu.js") | $raw %] > <script> >- var tagsubfield = "[% tagsubfield | html %]"; >+ const tagsubfield = [% IF tagsubfield %]"[% tagsubfield | html %]"[% ELSE %]null[% END %]; > </script> > [% Asset.js("js/marc_subfields_structure.js") | $raw %] > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >index 3cf5d8053c8..783e21ca6ca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/marc_subfields_structure.js >@@ -1,29 +1,31 @@ >-/* global tagsubfield selectBsTabByHash */ >+/* global tagsubfield */ > $(document).ready(function () { >- if (tagsubfield && tagsubfield == "@") { >- $("#subfieldtabs a[href='#AT_panel']").tab("show"); >- } else if (tagsubfield && tagsubfield != "@") { >- $("#subfieldtabs a[href='#" + tagsubfield + "_panel'").tab("show"); >- } else { >- $("#subfieldtabs a:first").tab("show"); >- } >+ if ($("#subfieldtabs").length > 0) { >+ if (tagsubfield && tagsubfield == "@") { >+ $("#subfieldtabs a[href='#AT_panel']").tab("show"); >+ } else if (tagsubfield && tagsubfield != "@") { >+ $(`#subfieldtabs a[href='#${tagsubfield}_panel']`).tab("show"); >+ } else { >+ $("#subfieldtabs a:first").tab("show"); >+ } > >- var subfields_list = $("#subfieldtabs > ul"); >- var sortable_subfields = new Sortable(subfields_list[0], { >- onEnd: function (e) { >- var old_index = e.oldIndex; >- var new_index = e.newIndex; >- if (old_index < new_index) new_index++; >- var subfield_code = e.item.id.replace(/^tab_subfield_/, ""); >- var content = $("#" + subfield_code + "_panel"); >- var panels = $("#subfieldtabs .tab-pane"); >- if (new_index < $(panels).size()) { >- $(content).insertBefore(panels[new_index]); >- } else { >- $(content).insertAfter(panels[new_index - 1]); >- } >- }, >- }); >+ var subfields_list = $("#subfieldtabs > ul"); >+ var sortable_subfields = new Sortable(subfields_list[0], { >+ onEnd: function (e) { >+ var old_index = e.oldIndex; >+ var new_index = e.newIndex; >+ if (old_index < new_index) new_index++; >+ var subfield_code = e.item.id.replace(/^tab_subfield_/, ""); >+ var content = $("#" + subfield_code + "_panel"); >+ var panels = $("#subfieldtabs .tab-pane"); >+ if (new_index < $(panels).size()) { >+ $(content).insertBefore(panels[new_index]); >+ } else { >+ $(content).insertAfter(panels[new_index - 1]); >+ } >+ }, >+ }); >+ } > > $("input[id^='hidden_']").click(setHiddenValue); > $("input[id^='hidden-']").each(function () { >@@ -33,8 +35,6 @@ $(document).ready(function () { > order: [], > paging: false, > }); >- >- selectBsTabByHash("subfieldtabs"); > }); > > /* Function to enable/disable hidden values checkboxes when Flag is (de)selected */ >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41838
: 193013