From 9cc9db0753645b3461a355b6a7a2669cccab2b6e 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. Signed-off-by: Katrin Fischer Editing an already arrived serial issue with an attached item resulted in an error. After applying the patch it's fixed. --- 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 b3a95b898c..f2ebca7ebc 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 1107db9e15..80255291a6 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 -- 2.39.5