@@ -, +, @@ checkouts table choose export format 'MARC with items', check "Export items bundle contents" and click on "Export" button The exported file should contain the biblio and item created at step 2, but also the biblio and items that are part of the bundle --- Koha/Exporter/Record.pm | 2 +- .../prog/en/includes/checkouts-table.inc | 1 + tools/export.pl | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) --- a/Koha/Exporter/Record.pm +++ a/Koha/Exporter/Record.pm @@ -132,7 +132,7 @@ sub _get_biblio_for_export { record => $record, embed_items => 1, biblionumber => $biblionumber, - item_numbers => $itemnumbers, + itemnumbers => $itemnumbers, } ); if ($only_export_items_for_branches && @$only_export_items_for_branches) { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -77,6 +77,7 @@ [% END %] [% END %] + --- a/tools/export.pl +++ a/tools/export.pl @@ -196,6 +196,22 @@ if ( $op eq "export" ) { @record_ids = grep $record_ids{$_}, @filter_record_ids; } + my $export_items_bundle_contents = $query->param('export_items_bundle_contents'); + if ($export_items_bundle_contents and $record_type eq 'bibs') { + my $schema = Koha::Database->new->schema; + my $items_bundle_rs = $schema->resultset('ItemBundle'); + foreach my $itemnumber (@itemnumbers) { + my @item_bundle_items = $items_bundle_rs->search({ host => $itemnumber }); + foreach my $item_bundle_item (@item_bundle_items) { + my $biblionumber = $item_bundle_item->item->get_column('biblionumber'); + my $itemnumber = $item_bundle_item->get_column('item'); + push @record_ids, $biblionumber; + push @itemnumbers, $itemnumber; + } + } + @record_ids = uniq @record_ids; + } + print CGI->new->header( -type => 'application/octet-stream', -charset => 'utf-8', --