Lines 63-69
sub _get_biblio_for_export {
Link Here
|
63 |
my $biblionumber = $params->{biblionumber}; |
63 |
my $biblionumber = $params->{biblionumber}; |
64 |
my $itemnumbers = $params->{itemnumbers}; |
64 |
my $itemnumbers = $params->{itemnumbers}; |
65 |
my $export_items = $params->{export_items} // 1; |
65 |
my $export_items = $params->{export_items} // 1; |
66 |
my $only_export_items_for_branch = $params->{only_export_items_for_branch}; |
66 |
my $only_export_items_for_branches = $params->{only_export_items_for_branches}; |
67 |
|
67 |
|
68 |
my $record = eval { C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); }; |
68 |
my $record = eval { C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); }; |
69 |
|
69 |
|
Lines 71-82
sub _get_biblio_for_export {
Link Here
|
71 |
|
71 |
|
72 |
if ($export_items) { |
72 |
if ($export_items) { |
73 |
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, $itemnumbers ); |
73 |
C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, $itemnumbers ); |
74 |
if ($only_export_items_for_branch) { |
74 |
if ($only_export_items_for_branches && @$only_export_items_for_branches) { |
|
|
75 |
my %export_items_for_branches = map { $_ => 1 } @$only_export_items_for_branches; |
75 |
my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' ); # Should be GetFrameworkCode( $biblionumber )? |
76 |
my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' ); # Should be GetFrameworkCode( $biblionumber )? |
76 |
|
77 |
|
77 |
for my $itemfield ( $record->field($homebranchfield) ) { |
78 |
for my $itemfield ( $record->field($homebranchfield) ) { |
78 |
my $homebranch = $itemfield->subfield($homebranchsubfield); |
79 |
my $homebranch = $itemfield->subfield($homebranchsubfield); |
79 |
if ( $only_export_items_for_branch ne $homebranch ) { |
80 |
unless ( $export_items_for_branches{$homebranch} ) { |
80 |
$record->delete_field($itemfield); |
81 |
$record->delete_field($itemfield); |
81 |
} |
82 |
} |
82 |
} |
83 |
} |