use MARC::File::XML;
use List::MoreUtils qw(uniq);
use C4::Auth;
-use C4::Koha; # GetItemTypes
use C4::Output;
use Koha::Authority::Types;
use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Exporter::Record;
+use Koha::ItemTypes;
use Koha::Libraries;
my $query = new CGI;
my $filename = $query->param('id_list_file');
if ( $filename ) {
my $mimetype = $query->uploadInfo($filename)->{'Content-Type'};
- my @valid_mimetypes = qw( application/octet-stream text/csv text/plain );
+ my @valid_mimetypes = qw( application/octet-stream text/csv text/plain application/vnd.ms-excel );
unless ( grep { /^$mimetype$/ } @valid_mimetypes ) {
push @messages, { type => 'alert', code => 'invalid_mimetype' };
$op = '';
);
my $csv_profile_id = $query->param('csv_profile_id');
- unless ( $csv_profile_id ) {
- # FIXME export_format.profile should be a unique key
- my $default_csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') });
- $csv_profile_id = $default_csv_profiles->count ? $default_csv_profiles->next->export_format_id : undef;
- }
-
Koha::Exporter::Record::export(
{ record_type => $record_type,
record_ids => \@record_ids,
else {
- my $itemtypes = GetItemTypes;
- my @itemtypesloop;
- foreach my $thisitemtype ( sort keys %$itemtypes ) {
- my %row = (
- value => $thisitemtype,
- description => $itemtypes->{$thisitemtype}->{translated_description},
- );
- push @itemtypesloop, \%row;
- }
+ my $itemtypes = Koha::ItemTypes->search_with_localization;
my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypecode'] } );
$template->param(
libraries => $libraries,
- itemtypeloop => \@itemtypesloop,
+ itemtypes => $itemtypes,
authority_types => $authority_types,
export_remove_fields => C4::Context->preference("ExportRemoveFields"),
- csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ],
+ csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc', used_for => 'export_records' }) ],
messages => \@messages,
);