15 my $htdocs_path = C4::Context->config('intrahtdocs');
19 # get the printing settings
20 my $template = GetActiveLabelTemplate();
21 my $conf_data = get_label_options();
23 my $batch_id = $cgi->param('batch_id');
24 my $exportname = 'koha_label_' . $batch_id . '.csv';
26 print $cgi->header(-type => 'application/vnd.sun.xml.calc',
28 -attachment => $exportname,
29 -filename => $exportname );
31 my $batch_type = $conf_data->{'type'};
32 my $barcodetype = $conf_data->{'barcodetype'};
33 my $printingtype = $conf_data->{'printingtype'};
35 my @resultsloop = GetLabelItems($batch_id);
36 my $csv = Text::CSV_XS->new();
37 my @str_fields = get_text_fields($conf_data->{'id'}, 'codes' );
38 for my $item (@resultsloop) {
39 my $record = GetMarcBiblio($item->{biblionumber});
40 my @datafields = map { C4::Labels::GetBarcodeData($_->{'code'},$item,$record) } @str_fields ;
42 if($csv->combine(@datafields)) {
43 $csvout = $csv->string();
46 warn "CSV ERROR: " . $csv->error_input;
52 # is that the right way to do this ?