Lines 1496-1509
sub GetMarcItem {
Link Here
|
1496 |
return Item2Marc($itemrecord,$biblionumber); |
1496 |
return Item2Marc($itemrecord,$biblionumber); |
1497 |
|
1497 |
|
1498 |
} |
1498 |
} |
|
|
1499 |
|
1500 |
=head2 GetMarcItems |
1501 |
|
1502 |
my @items_marc = GetMarcItems($biblionumber, \@hiddenitemnumbers); |
1503 |
|
1504 |
Returns array of MARC::Records of the items for the biblio passed in parameter. |
1505 |
|
1506 |
=cut |
1507 |
|
1508 |
sub GetMarcItems { |
1509 |
my ( $biblionumber, $hiddenitems, $itemtag ) = @_; |
1510 |
my $params; |
1511 |
$params->{biblionumber} = $biblionumber; |
1512 |
$params->{itemnumber} = {'not in' => @$hiddenitems} if defined $hiddenitems && scalar @$hiddenitems; |
1513 |
my $items = Koha::Items->search($params ); |
1514 |
return unless $items; |
1515 |
|
1516 |
# Tack on 'items.' prefix to column names so that C4::Biblio::TransformKohaToMarc will work. |
1517 |
# Also, don't emit a subfield if the underlying field is blank. |
1518 |
|
1519 |
my $framework = Koha::Biblios->find( $biblionumber)->frameworkcode(); |
1520 |
my @marc_items; |
1521 |
while ( my $this_item = $items->next() ){ |
1522 |
push @marc_items, Item2Marc($this_item->unblessed,$biblionumber,$framework)->field($itemtag); |
1523 |
} |
1524 |
return \@marc_items; |
1525 |
} |
1526 |
|
1499 |
sub Item2Marc { |
1527 |
sub Item2Marc { |
1500 |
my ($itemrecord,$biblionumber)=@_; |
1528 |
my ($itemrecord,$biblionumber, $frameworkcode)=@_; |
1501 |
my $mungeditem = { |
1529 |
my $mungeditem = { |
1502 |
map { |
1530 |
map { |
1503 |
defined($itemrecord->{$_}) && $itemrecord->{$_} ne '' ? ("items.$_" => $itemrecord->{$_}) : () |
1531 |
defined($itemrecord->{$_}) && $itemrecord->{$_} ne '' ? ("items.$_" => $itemrecord->{$_}) : () |
1504 |
} keys %{ $itemrecord } |
1532 |
} keys %{ $itemrecord } |
1505 |
}; |
1533 |
}; |
1506 |
my $framework = C4::Biblio::GetFrameworkCode( $biblionumber ); |
1534 |
my $framework = $frameworkcode // C4::Biblio::GetFrameworkCode( $biblionumber ); |
1507 |
my $itemmarc = C4::Biblio::TransformKohaToMarc( |
1535 |
my $itemmarc = C4::Biblio::TransformKohaToMarc( |
1508 |
$mungeditem, { no_split => 1}, |
1536 |
$mungeditem, { no_split => 1}, |
1509 |
); |
1537 |
); |
1510 |
- |
|
|