diff options
author | Mark Wells <mark@freeside.biz> | 2013-05-29 13:15:22 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-05-29 13:15:22 -0700 |
commit | ea32f987f9c72ad6990bfa326af2935f79bf580c (patch) | |
tree | 727de18b686cbe93c571b85d3e5b6ea7132819c5 /rt/lib | |
parent | ac272d7302249e13fbf07084087ae642059d63a0 (diff) |
display date custom fields as real dates, #23121
Diffstat (limited to 'rt/lib')
-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; |