[freeside-commits] freeside/FS/FS cdr.pm,1.57,1.58
Ivan,,,
ivan at wavetail.420.am
Mon Jun 7 23:58:44 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv18368
Modified Files:
cdr.pm
Log Message:
respect date_format w/CDRs
Index: cdr.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cdr.pm,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -w -d -r1.57 -r1.58
--- cdr.pm 4 May 2010 22:25:44 -0000 1.57
+++ cdr.pm 8 Jun 2010 06:58:42 -0000 1.58
@@ -526,6 +526,15 @@
},
);
+my %export_formats = ();
+sub export_formats {
+ #my $self = shift;
+
+ return %export_formats if keys %export_formats;
+
+ my $conf = new FS::Conf;
+ my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
my $duration_sub = sub {
my($cdr, %opt) = @_;
if ( $opt{minutes} ) {
@@ -537,9 +546,9 @@
}
};
-my %export_formats = (
+ %export_formats = (
'simple' => [
- sub { time2str('%D', shift->calldate_unix ) }, #DATE
+ sub { time2str($date_format, shift->calldate_unix ) }, #DATE
sub { time2str('%r', shift->calldate_unix ) }, #TIME
'userfield', #USER
'dst', #NUMBER_DIALED
@@ -548,7 +557,7 @@
sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, #PRICE
],
'simple2' => [
- sub { time2str('%D', shift->calldate_unix ) }, #DATE
+ sub { time2str($date_format, shift->calldate_unix ) }, #DATE
sub { time2str('%r', shift->calldate_unix ) }, #TIME
#'userfield', #USER
'src', #called from
@@ -560,7 +569,7 @@
'default' => [
#DATE
- sub { time2str('%D', shift->calldate_unix ) },
+ sub { time2str($date_format, shift->calldate_unix ) },
# #time2str("%Y %b %d - %r", $cdr->calldate_unix ),
#TIME
@@ -588,11 +597,15 @@
@{ $export_formats{'default'} }[2..5],
];
+ %export_formats
+}
+
sub downstream_csv {
my( $self, %opt ) = @_;
my $format = $opt{'format'};
- return "Unknown format $format" unless exists $export_formats{$format};
+ my %formats = $self->export_formats;
+ return "Unknown format $format" unless exists $formats{$format};
#my $conf = new FS::Conf;
#$opt{'money_char'} ||= $conf->config('money_char') || '$';
@@ -606,7 +619,7 @@
map {
ref($_) ? &{$_}($self, %opt) : $self->$_();
}
- @{ $export_formats{$format} };
+ @{ $formats{$format} };
my $status = $csv->combine(@columns);
die "FS::CDR: error combining ". $csv->error_input(). "into downstream CSV"
More information about the freeside-commits
mailing list