@@ -, +, @@ checkouts table least one item 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 3, but also the item linked at step 4 with its biblio record --- .../prog/en/includes/checkouts-table.inc | 1 + tools/export.pl | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc @@ -71,6 +71,7 @@ [% END %] [% END %] + --- a/tools/export.pl +++ a/tools/export.pl @@ -197,6 +197,24 @@ 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('ItemsBundle'); + foreach my $record_id (@record_ids) { + my $item_bundle = $items_bundle_rs->find({ biblionumber => $record_id }); + if ($item_bundle) { + foreach my $items_bundle_item ($item_bundle->items_bundle_items) { + my $biblionumber = $items_bundle_item->itemnumber->get_column('biblionumber'); + my $itemnumber = $items_bundle_item->get_column('itemnumber'); + push @record_ids, $biblionumber; + push @itemnumbers, $itemnumber; + } + } + } + @record_ids = uniq @record_ids; + } + print CGI->new->header( -type => 'application/octet-stream', -charset => 'utf-8', --