From 2a3d80e775c3b5d15aae1ca079d6d256cf8b46a8 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Wed, 22 Feb 2012 16:58:36 +0100 Subject: [PATCH] Bug 6875 follow-up for Items/Biblio de-nesting the sub _find_value is used only in PrepareItemRecord sub, that has been moved to Items package This patch moves the _find_value in Items as well. --- C4/Biblio.pm | 39 --------------------------------------- C4/Items.pm | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index b3a95b8..f2ebca7 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -2876,45 +2876,6 @@ sub _AddBiblioNoZebra { return %result; } -=head2 _find_value - - ($indicators, $value) = _find_value($tag, $subfield, $record,$encoding); - -Find the given $subfield in the given $tag in the given -MARC::Record $record. If the subfield is found, returns -the (indicators, value) pair; otherwise, (undef, undef) is -returned. - -PROPOSITION : -Such a function is used in addbiblio AND additem and serial-edit and maybe could be used in Authorities. -I suggest we export it from this module. - -=cut - -sub _find_value { - my ( $tagfield, $insubfield, $record, $encoding ) = @_; - my @result; - my $indicator; - if ( $tagfield < 10 ) { - if ( $record->field($tagfield) ) { - push @result, $record->field($tagfield)->data(); - } else { - push @result, ""; - } - } else { - foreach my $field ( $record->field($tagfield) ) { - my @subfields = $field->subfields(); - foreach my $subfield (@subfields) { - if ( @$subfield[0] eq $insubfield ) { - push @result, @$subfield[1]; - $indicator = $field->indicator(1) . $field->indicator(2); - } - } - } - } - return ( $indicator, @result ); -} - =head2 _koha_marc_update_bib_ids diff --git a/C4/Items.pm b/C4/Items.pm index 1107db9..8025529 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2491,6 +2491,45 @@ sub GetItemHolds { } =head1 OTHER FUNCTIONS +=head2 _find_value + + ($indicators, $value) = _find_value($tag, $subfield, $record,$encoding); + +Find the given $subfield in the given $tag in the given +MARC::Record $record. If the subfield is found, returns +the (indicators, value) pair; otherwise, (undef, undef) is +returned. + +PROPOSITION : +Such a function is used in addbiblio AND additem and serial-edit and maybe could be used in Authorities. +I suggest we export it from this module. + +=cut + +sub _find_value { + my ( $tagfield, $insubfield, $record, $encoding ) = @_; + my @result; + my $indicator; + if ( $tagfield < 10 ) { + if ( $record->field($tagfield) ) { + push @result, $record->field($tagfield)->data(); + } else { + push @result, ""; + } + } else { + foreach my $field ( $record->field($tagfield) ) { + my @subfields = $field->subfields(); + foreach my $subfield (@subfields) { + if ( @$subfield[0] eq $insubfield ) { + push @result, @$subfield[1]; + $indicator = $field->indicator(1) . $field->indicator(2); + } + } + } + } + return ( $indicator, @result ); +} + =head2 PrepareItemrecordDisplay -- 1.7.5.4