X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fexport.pl;h=72b18c4756734df4f092928757f6593b690745cc;hb=ad1182411220d74cd13ea5cd1525b71cf7fef981;hp=1f1eebeb1fcabb6857fe3c6bfa2ff0c0036c7ad8;hpb=8dad1582c100017f8ad3e331c9a9b9cc9ed4e4d6;p=koha.git diff --git a/tools/export.pl b/tools/export.pl index 1f1eebeb1f..72b18c4756 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -21,7 +21,6 @@ use CGI qw ( -utf8 ); use MARC::File::XML; use List::MoreUtils qw(uniq); use C4::Auth; -use C4::Koha; # GetItemTypes use C4::Output; use Koha::Authority::Types; @@ -30,6 +29,7 @@ use Koha::CsvProfiles; 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; @@ -74,7 +74,7 @@ if ( $op eq 'export' ) { 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 = ''; @@ -200,12 +200,6 @@ if ( $op eq "export" ) { ); 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, @@ -272,15 +266,7 @@ if ( $op eq "export" ) { 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'] } ); @@ -311,10 +297,10 @@ else { $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, );