Browse Source

Bug 31154: Avoid unecessary loop

We don't need to loop over the subfield and enter this block if there is
no record.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
22.11.x
Jonathan Druart 2 years ago
committed by Tomas Cohen Arazi
parent
commit
b582f7d495
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 5
      Koha/UI/Form/Builder/Item.pm

5
Koha/UI/Form/Builder/Item.pm

@ -152,7 +152,8 @@ sub generate_subfield_form {
&& !$value
&& $subfield->{kohafield}
&& $subfield->{kohafield} eq 'items.itemcallnumber'
&& $pref_itemcallnumber )
&& $pref_itemcallnumber
&& $marc_record )
{
foreach
my $pref_itemcallnumber_part ( split( /,/, $pref_itemcallnumber ) )
@ -162,7 +163,7 @@ sub generate_subfield_form {
my $CNsubfields =
substr( $pref_itemcallnumber_part, 3 ); # Any and all subfields
$CNsubfields = undef if $CNsubfields eq '';
my $temp2 = $marc_record ? $marc_record->field($CNtag) : undef;
my $temp2 = $marc_record->field($CNtag);
next unless $temp2;
$value = $temp2->as_string( $CNsubfields, ' ' );

Loading…
Cancel
Save