From 61aa4653f3246f8283b2341afd5254ce0f9526e3 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 23 Nov 2021 13:39:57 +0000 Subject: [PATCH] Bug 29511: Sort hash keys This code exists in authorities/authorities.pl and the hash keys are sorted I just do the same here To test: 1 - Find/create a record with 245a 245h populated 2 - Load/reload the record several times and note that fields c and b are ordered randomly 3 - Apply patch 4 - Reload and note c and b are ordered alphabetically 5 - Move subfield h before subfield c 6 - Save and reload 7 - Confirm that existing/filled fields retain order in the MARC record Signed-off-by: Hayley Pelham Signed-off-by: Martin Renvoize --- cataloguing/addbiblio.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 090849da4d..036764417c 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -592,7 +592,7 @@ sub build_tabs { } # now, loop again to add parameter subfield that are not in the MARC::Record - foreach my $subfield ( keys %{ $tagslib->{$tag} } ) + foreach my $subfield ( sort( keys %{ $tagslib->{$tag} } ) ) { next if ( length $subfield != 1 ); next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop ); -- 2.20.1