diff options
| author | Mark Wells <mark@freeside.biz> | 2013-05-29 13:15:34 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2013-05-29 13:15:34 -0700 |
| commit | 74c9281d11d7f92e6da3dc00b795e50493c11258 (patch) | |
| tree | 56600e5adb6067832c859d11849bcce4ce587a45 /rt/lib/RT/Interface | |
| parent | 88df244c8078f6db7701ff6deb928e4b7edecf58 (diff) | |
display date custom fields as real dates, #23121
Diffstat (limited to 'rt/lib/RT/Interface')
| -rw-r--r-- | rt/lib/RT/Interface/Web_Vendor.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm index ee8c34b55..6218641a7 100644 --- a/rt/lib/RT/Interface/Web_Vendor.pm +++ b/rt/lib/RT/Interface/Web_Vendor.pm @@ -533,5 +533,32 @@ sub ProcessUpdateMessage { return @results; } +sub default_FormatDate { $_[0]->AsString } + +sub ProcessColumnMapValue { + my $value = shift; + my %args = ( Arguments => [], + Escape => 1, + FormatDate => \&default_FormatDate, + @_ ); + + if ( ref $value ) { + if ( ref $value eq 'RT::Date' ) { + return $args{FormatDate}->($value); + } elsif ( UNIVERSAL::isa( $value, 'CODE' ) ) { + my @tmp = $value->( @{ $args{'Arguments'} } ); + return ProcessColumnMapValue( ( @tmp > 1 ? \@tmp : $tmp[0] ), %args ); + } elsif ( UNIVERSAL::isa( $value, 'ARRAY' ) ) { + return join '', map ProcessColumnMapValue( $_, %args ), @$value; + } elsif ( UNIVERSAL::isa( $value, 'SCALAR' ) ) { + return $$value; + } + } + + return $m->interp->apply_escapes( $value, 'h' ) if $args{'Escape'}; + return $value; +} + + 1; |
