[freeside-commits] freeside/rt/share/html/Search/Elements ResultsStructuredView, 1.3, 1.4
Mark Wells
mark at wavetail.420.am
Sat Apr 30 13:28:56 PDT 2011
Update of /home/cvs/cvsroot/freeside/rt/share/html/Search/Elements
In directory wavetail.420.am:/tmp/cvs-serv19840/share/html/Search/Elements
Modified Files:
ResultsStructuredView
Log Message:
Excel date formatting, #12659
Index: ResultsStructuredView
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/share/html/Search/Elements/ResultsStructuredView,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- ResultsStructuredView 22 Apr 2011 02:42:25 -0000 1.3
+++ ResultsStructuredView 30 Apr 2011 20:28:54 -0000 1.4
@@ -50,9 +50,11 @@
$OrderBy => 'id'
$Order => 'ASC'
$Format => undef
+
#Callbacks
$WriteHeader => sub { $RT::Logger->error('WriteHeader callback required'); '' }
$WriteRow => sub { $RT::Logger->error('WriteRow callback required'); '' }
+$FormatDate => sub { $_[0]->AsString }
</%ARGS>
<%INIT>
@@ -129,13 +131,24 @@
}
if ( !exists $ColumnMap->{$col}{'value'} ) {
- $ColumnMap->{$col}{'value'} = $m->comp(
+ my $map = {};
+ foreach ('attribute', 'value', 'date') {
+ $map->{$_} = $m->comp(
'/Elements/ColumnMap',
Class => 'RT__Ticket',
Name => $col,
- Attr => 'value',
+ Attr => $_,
);
}
+ # Canonicalize dates
+ if ( defined $map->{'date'} ) {
+ $map->{value} = sub {
+ my $DateObj = $map->{'date'}->(@_) or return undef;
+ $FormatDate->($DateObj);
+ };
+ }
+ $ColumnMap->{$col} = $map;
+ }
push @out, ProcessColumnMapValue(
$ColumnMap->{$col}{'value'},
More information about the freeside-commits
mailing list