Browse Source

Bug 26133: Remove GetMarcHosts

We removed the single occurrence of this subroutine in the previous
patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Jonathan Druart 4 years ago
parent
commit
88ecaa54cd
  1. 48
      C4/Biblio.pm
  2. 8
      t/Biblio.t

48
C4/Biblio.pm

@ -38,7 +38,6 @@ BEGIN {
GetMarcSubjects GetMarcSubjects
GetMarcAuthors GetMarcAuthors
GetMarcSeries GetMarcSeries
GetMarcHosts
GetMarcUrls GetMarcUrls
GetUsedMarcStructure GetUsedMarcStructure
GetXmlBiblio GetXmlBiblio
@ -1861,53 +1860,6 @@ sub GetMarcSeries {
return \@marcseries; return \@marcseries;
} #end getMARCseriess } #end getMARCseriess
=head2 GetMarcHosts
$marchostsarray = GetMarcHosts($record,$marcflavour);
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array.
=cut
sub GetMarcHosts {
my ( $record, $marcflavour ) = @_;
if (!$record) {
carp 'GetMarcHosts called on undefined record';
return;
}
my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf);
$marcflavour ||="MARC21";
if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) {
$tag = "773";
$title_subf = "t";
$bibnumber_subf ="0";
$itemnumber_subf='9';
}
elsif ($marcflavour eq "UNIMARC") {
$tag = "461";
$title_subf = "t";
$bibnumber_subf ="0";
$itemnumber_subf='9';
};
my @marchosts;
foreach my $field ( $record->field($tag)) {
my @fields_loop;
my $hostbiblionumber = $field->subfield("$bibnumber_subf");
my $hosttitle = $field->subfield($title_subf);
my $hostitemnumber=$field->subfield($itemnumber_subf);
push @fields_loop, { hostbiblionumber => $hostbiblionumber, hosttitle => $hosttitle, hostitemnumber => $hostitemnumber};
push @marchosts, { MARCHOSTS_FIELDS_LOOP => \@fields_loop };
}
my $marchostsarray = \@marchosts;
return $marchostsarray;
}
=head2 UpsertMarcSubfield =head2 UpsertMarcSubfield
my $record = C4::Biblio::UpsertMarcSubfield($MARC::Record, $fieldTag, $subfieldCode, $subfieldContent); my $record = C4::Biblio::UpsertMarcSubfield($MARC::Record, $fieldTag, $subfieldCode, $subfieldContent);

8
t/Biblio.t

@ -21,7 +21,7 @@ use Test::More;
use Test::MockModule; use Test::MockModule;
use Test::Warn; use Test::Warn;
plan tests => 43; plan tests => 41;
use_ok('C4::Biblio'); use_ok('C4::Biblio');
@ -117,12 +117,6 @@ warning_is { $ret = GetMarcSeries() }
ok( !defined $ret, 'GetMarcSeries returns undef if not passed rec'); ok( !defined $ret, 'GetMarcSeries returns undef if not passed rec');
warning_is { $ret = GetMarcHosts() }
{ carped => 'GetMarcHosts called on undefined record'},
"GetMarcHosts returns carped warning on undef record";
ok( !defined $ret, 'GetMarcHosts returns undef if not passed rec');
my $hash_ref; my $hash_ref;
warning_is { $hash_ref = TransformMarcToKoha( undef) } warning_is { $hash_ref = TransformMarcToKoha( undef) }

Loading…
Cancel
Save