Browse Source

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>
22.11.x
David Cook 2 years ago
committed by Tomas Cohen Arazi
parent
commit
0820dbc14f
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt
  2. 11
      tools/export.pl

2
koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt

@ -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>

11
tools/export.pl

@ -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 } )
: ()
),

Loading…
Cancel
Save