display dates as real dates in Excel export, #23121, update for current RT
[freeside.git] / rt / lib / RT / Interface / Web_Vendor.pm
index e9c6346..ea3a498 100644 (file)
@@ -284,6 +284,16 @@ sub ProcessTicketBasics {
         }
     }
 
+    # RT core _will_ allow Set transactions that change these 
+    # fields to empty strings, but internally change the values 
+    # to zero.  This is sloppy and causes some problems.
+    foreach my $field (qw(TimeWorked TimeEstimated TimeLeft)) {
+      if (exists $ARGSRef->{$field}) {
+        $ARGSRef->{$field} =~ s/\s//g;
+        $ARGSRef->{$field} ||= 0;
+      }
+    }
+
     my @results = UpdateRecordObject(
         AttributesRef => \@attribs,
         Object        => $TicketObj,
@@ -413,12 +423,13 @@ sub ProcessColumnMapValue {
     my $value = shift;
     my %args = ( Arguments => [],
                  Escape => 1,
-                 FormatDate => \&default_FormatDate,
                  @_ );
 
+    my $FormatDate = $m->notes('FormatDate') || \&default_FormatDate;
+
     if ( ref $value ) {
         if ( ref $value eq 'RT::Date' ) {
-            return $args{FormatDate}->($value);
+            return $FormatDate->($value);
         } elsif ( UNIVERSAL::isa( $value, 'CODE' ) ) {
             my @tmp = $value->( @{ $args{'Arguments'} } );
             return ProcessColumnMapValue( ( @tmp > 1 ? \@tmp : $tmp[0] ), %args );