[freeside-commits] branch FREESIDE_4_BRANCH updated. e4f07ef831954aab40e8f5d97d3361ee34aaf2c5
Mark Wells
mark at 420.am
Mon Aug 17 22:23:16 PDT 2015
The branch, FREESIDE_4_BRANCH has been updated
via e4f07ef831954aab40e8f5d97d3361ee34aaf2c5 (commit)
from 4c6c74a8b4fbff04f99e37b4dfb91d757a158c2c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e4f07ef831954aab40e8f5d97d3361ee34aaf2c5
Author: Mark Wells <mark at freeside.biz>
Date: Mon Aug 17 22:22:02 2015 -0700
display dates as real dates in Excel export, #23121, update for current RT
diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm
index c9bff6f..ea3a498 100644
--- a/rt/lib/RT/Interface/Web_Vendor.pm
+++ b/rt/lib/RT/Interface/Web_Vendor.pm
@@ -423,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 );
diff --git a/rt/share/html/Elements/ShowCustomFieldDate b/rt/share/html/Elements/ShowCustomFieldDate
index 92ab767..1536935 100644
--- a/rt/share/html/Elements/ShowCustomFieldDate
+++ b/rt/share/html/Elements/ShowCustomFieldDate
@@ -49,7 +49,11 @@
my $content = $Object->Content;
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
$DateObj->Set( Format => 'unknown', Value => $content, Timezone => 'utc' );
- $content = $DateObj->AsString(Time => 0, Timezone => 'utc');
+ if ($m->notes('FormatDate')) {
+ $content = $m->notes('FormatDate')->($DateObj);
+ } else {
+ $content = $DateObj->AsString(Time => 0, Timezone => 'utc');
+ }
</%INIT>
<%$content|n%>
<%ARGS>
diff --git a/rt/share/html/Elements/ShowCustomFieldDateTime b/rt/share/html/Elements/ShowCustomFieldDateTime
index 2ba873a..e179d6a 100644
--- a/rt/share/html/Elements/ShowCustomFieldDateTime
+++ b/rt/share/html/Elements/ShowCustomFieldDateTime
@@ -49,7 +49,11 @@
my $content = $Object->Content;
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
$DateObj->Set( Format => 'ISO', Value => $content );
- $content = $DateObj->AsString;
+ if ($m->notes('FormatDate')) {
+ $content = $m->notes('FormatDate')->($DateObj);
+ } else {
+ $content = $DateObj->AsString;
+ }
</%INIT>
<%$content|n%>
<%ARGS>
diff --git a/rt/share/html/Search/Elements/ResultsStructuredView b/rt/share/html/Search/Elements/ResultsStructuredView
index 0e9457c..5b9db4e 100644
--- a/rt/share/html/Search/Elements/ResultsStructuredView
+++ b/rt/share/html/Search/Elements/ResultsStructuredView
@@ -54,7 +54,6 @@ $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>
@@ -146,7 +145,6 @@ while ( my $Ticket = $Tickets->Next()) {
push @out, ProcessColumnMapValue(
$ColumnMap->{$col}{'value'},
Arguments => [ $Ticket, $row ],
- FormatDate => $FormatDate,
);
} #foreach $subcol
$value = join('', '<span>', @out, '</span>');
diff --git a/rt/share/html/Search/Results.xls b/rt/share/html/Search/Results.xls
index 8b94e22..d9d8356 100644
--- a/rt/share/html/Search/Results.xls
+++ b/rt/share/html/Search/Results.xls
@@ -118,11 +118,11 @@ my $WriteRow = sub {
$row++;
};
-my $FormatDate = sub {
+$m->notes('FormatDate', sub {
my $DateObj = shift;
return '' if $DateObj->Unix == 0;
return time2str('%Y-%m-%dT%H:%M', $DateObj->Unix);
-};
+});
# Write everything to the worksheet
$m->comp('Elements/ResultsStructuredView',
@@ -132,7 +132,6 @@ $m->comp('Elements/ResultsStructuredView',
Format => $Format,
WriteHeader => $WriteHeader,
WriteRow => $WriteRow,
- FormatDate => $FormatDate,
);
# Set column widths
-----------------------------------------------------------------------
Summary of changes:
rt/lib/RT/Interface/Web_Vendor.pm | 5 +++--
rt/share/html/Elements/ShowCustomFieldDate | 6 +++++-
rt/share/html/Elements/ShowCustomFieldDateTime | 6 +++++-
rt/share/html/Search/Elements/ResultsStructuredView | 2 --
rt/share/html/Search/Results.xls | 5 ++---
5 files changed, 15 insertions(+), 9 deletions(-)
More information about the freeside-commits
mailing list