- foreach my $attr(@attrs) {
- $worksheet->write($ws_row, $ws_col, $row->{"$attr"});
- $ws_col++;
+ foreach my $attr (@attrs) {
+ my $value;
+ if ($attr =~ /(.*)->ISO$/ and $Ticket->$1->Unix <= 0) {
+ $value = '';
+ } else {
+ my $method = '$Ticket->'.$attr.'()';
+ $method =~ s/->ISO\(\)$/->ISO( Timezone => 'user' )/;
+ $value = eval $method;
+ if ($@) {die "Failed to find $attr - ". $@};
+ }
+ push @row, $value;
+ }
+
+ my $values = $Ticket->CustomFieldValues;
+ $values->OrderByCols; # don't sort them
+ while (my $value = $values->Next) {
+ my $pos = $cf_name_to_pos{ $cf_id_to_name{ $value->CustomField } };
+ next unless $pos;
+
+ $row[$pos] = '' unless defined $row[$pos];
+ $row[$pos] .= ', ' if $row[$pos];
+ $row[$pos] .= $value->Content;