From fc2ff1dd6a19bb7021e6a77763412ee790fde305 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 19 Dec 2019 19:05:36 +0000 Subject: [PATCH] Bug 9156: (follow-up) Simplify code The MARC::Field as_string method can join multiple subfield using a delimiter, this simplifies the code here Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Joy Nelson --- cataloguing/additem.pl | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl index 38fb34bc3c..babf6d3d4c 100755 --- a/cataloguing/additem.pl +++ b/cataloguing/additem.pl @@ -156,18 +156,10 @@ sub generate_subfield_form { if (!$value && $subfieldlib->{kohafield} eq 'items.itemcallnumber' && $pref_itemcallnumber) { my $CNtag = substr( $pref_itemcallnumber, 0, 3 ); # 3-digit tag number my $CNsubfields = substr( $pref_itemcallnumber, 3 ); # Any and all subfields - my @subfields = ( $CNsubfields =~ m/./g ); # Split into single-character elements my $temp2 = $temp->field($CNtag); if ($temp2) { - my @selectedsubfields; - foreach my $subfieldcode( @subfields ){ - push @selectedsubfields, $temp2->subfield( $subfieldcode ); - } - $value = join( ' ', @selectedsubfields ); - - #remove any trailing space incase one subfield is used - $value =~ s/^\s+|\s+$//g; + $value = $temp2->as_string( $CNsubfields, ' ' ); } } -- 2.39.5