From 28de44c238790f009c254a5a2126fcb3be918fd4 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 27 Apr 2022 22:53:47 +0000 Subject: [PATCH] Bug 30358: (follow-up) Consider field has multiple subfields of same key To test: 1) Click the clone subfield button to make multiple subfields with the same key, i.e. 500$a$a$a 2) Save the record and confirm that the fields contain the correct data after whitespaces are stripped. Signed-off-by: David Nind --- C4/Biblio.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 7803fbf812b..b11315bfb89 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2758,7 +2758,8 @@ sub ModBiblioMarc { my $value = $subfield->[1]; $value =~ s/[\n\r]+/ /g; $value =~ s/^\s+|\s+$|^\t+|\t+$//g; - $field->update( $key => $value ); + $field->add_subfields( $key => $value ); # add subfield to the end of the subfield list + $field->delete_subfield( pos => 0 ); # delete the subfield at the top of the subfield list } } } -- 2.20.1