diff options
author | Mark Wells <mark@freeside.biz> | 2013-05-29 13:15:04 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-05-29 13:15:04 -0700 |
commit | 1d1caa0fb6e82c033e50f8fd6544775961b827d6 (patch) | |
tree | 24a52bb5e4d1935d5982e049605c64f458e64bdf /rt/lib/RT/Interface | |
parent | 81e56a1e8baf5e0f1522031736bfb392f1f0f5b9 (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 ae7f0899a..fb2b80717 100644 --- a/rt/lib/RT/Interface/Web_Vendor.pm +++ b/rt/lib/RT/Interface/Web_Vendor.pm @@ -553,5 +553,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; |