-foreach my $row (@rows) {
- my $ws_col = 0;
- my @row;
- foreach my $attr(@attrs) {
- Encode::_utf8_off($row->{"$attr"});
- $workbook->updateCell(0, $ws_row, $ws_col, $row->{"$attr"});
- $ws_col++;
- }
- foreach my $id (sort keys %known_cfs) {
- my $val = $row->{'CustomField-'.$id};
- #$val =~ s/(\n|\r)//g;
- Encode::_utf8_off($val);
- $workbook->updateCell(0, $ws_row, $ws_col, $val);
- $ws_col++;
+my $ii = 0;
+while (my $row = $Tickets->Next) {
+ $ws_col = 0;
+ for my $col (@columns) {
+ for (@$col) {
+ my $val = ProcessColumnMapValue($_->{map}, Arguments => [$row, $ii++], Escape => 0);
+ $val = loc($val) if $_->{should_loc};
+ # remove tabs from all field values, they screw up the tsv
+ $val = '' unless defined $val;
+ $val =~ s/(?:\n|\r)//g; $val =~ s{\t}{ }g;
+ $val = $no_html->scrub($val);
+ $val = HTML::Entities::decode_entities($val);
+ Encode::_utf8_off($val);
+ $workbook->updateCell(0, $ws_row, $ws_col, $val);
+ $ws_col++;
+ }