From 331af91c48413cfc9a345104d3cc6858774b2cec 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 Signed-off-by: Katrin Fischer Signed-off-by: Fridolin Somers --- 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.39.5