Bug 6936: Allow multiple itemtypes for bib record export

This patch allows multiple item types to be chosen when exporting
bib records from the Tools module.

Test plan:
0. Apply patch and koha-plack --restart kohadev
1. Go to http://localhost:8081/cgi-bin/koha/tools/export.pl
2. Select "All" for "Item type" and note 435 bibs are exported
3. Select "Books" and note 360 bibs are exported
4. Select "Books" and "Visual Materials" and note 380 bibs are exported

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2022-08-08 02:23:57 +00:00 committed by Tomas Cohen Arazi
parent 368b1462e5
commit 0820dbc14f
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 8 additions and 5 deletions

View File

@ -88,7 +88,7 @@
<li>
<label for="itemtype">Item type: </label>
<select name="itemtype" id="itemtype">
<select name="itemtype" id="itemtype" multiple>
<option value="">-- All --</option>
[% FOREACH itemtype IN itemtypes %]
<option value="[% itemtype.itemtype | html %]">[% itemtype.translated_description | html %]</option>

View File

@ -105,9 +105,12 @@ if ( $op eq "export" ) {
# No need to retrieve the record_ids if we already get them
unless ( @record_ids ) {
if ( $record_type eq 'bibs' ) {
my %it_map = map { $_->itemtype => 1 } Koha::ItemTypes->search->as_list;
my @itemtypes = map { $it_map{$_} ? $_ : () } $query->multi_param('itemtype'); #Validate inputs against map
my $starting_biblionumber = $query->param("StartingBiblionumber");
my $ending_biblionumber = $query->param("EndingBiblionumber");
my $itemtype = $query->param("itemtype");
my $start_callnumber = $query->param("start_callnumber");
my $end_callnumber = $query->param("end_callnumber");
my $start_accession =
@ -148,11 +151,11 @@ if ( $op eq "export" ) {
)
: (),
( @branchcodes ? ( 'items.homebranch' => { in => \@branchcodes } ) : () ),
( $itemtype
( @itemtypes
?
C4::Context->preference('item-level_itypes')
? ( 'items.itype' => $itemtype )
: ( 'me.itemtype' => $itemtype )
? ( 'items.itype' => { in => \@itemtypes } )
: ( 'me.itemtype' => { in => \@itemtypes } )
: ()
),