From 4dfa5e01096d4c859e7463f6ffb7a46d68f1f663 Mon Sep 17 00:00:00 2001 From: Marion Durand Date: Fri, 8 Oct 2021 16:58:36 +0200 Subject: [PATCH] Bug 25387: The order of authority subfield is not sent over to bibliographic record When creating an authority record there is the possibility to reorder the subfield. However this order is not sent back to the bibliographic records when using this authority in a bibliographic record. This patch make the order of subfield be sent back to bibliographic record when the autority is used. Field that are fill are sent to the begining of the bibliographic record in the same order as in the authority record. Test plan: 1- Find or create an authority record and reorder some subfield 2- Use this authority in a bibliographic record 3- Observe that the order of the subfield is not transferred from the authority record to the bibliographic record 4- Apply the patch 5- Repeat step 1 and 2 again 6- Observe that the order of the subfield is now transferred from the authority record to the bibliographic record https://bugs.koha-community.org/show_bug.cgi?id=22666 --- .../authorities/blinddetail-biblio-search.tt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt index 6a10d7d45d..ee27c4c886 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tt @@ -110,7 +110,32 @@ i++; }); } + + function ReOrderSubField(){ + var isFirst=1; + var subfield_start = $(field_start).children('ul')[0]; + var first = subfield_start.firstElementChild; + + [% FOREACH SUBFIELD IN SUBFIELD_LOOP %] + // grab all subfields + var subfield_name = "[% To.json(tag_number) | $raw %][% To.json(SUBFIELD.marc_subfield) | $raw %]" + var re = new RegExp('^subfield' + subfield_name,'g'); + var subfields = $(subfield_start).children('li').filter( function() {return this.id.match(re); }); + for (var i=0; i