From 06a85a88bfdb0d3fc79ee055eb8327658dfe63ab Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 8 Mar 2010 10:57:06 +0000 Subject: proper use of date_format config for international date formats, RT#7009 --- httemplate/view/cust_main/payment_history.html | 9 +++++---- httemplate/view/cust_main/payment_history/credit.html | 8 +++++--- httemplate/view/cust_main/payment_history/payment.html | 8 +++++--- httemplate/view/cust_main/payment_history/voided_payment.html | 4 +++- 4 files changed, 18 insertions(+), 11 deletions(-) (limited to 'httemplate/view/cust_main') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 56a2c4dde..0dc4c41d5 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -205,11 +205,11 @@ - <% time2str("%D",$date) %> + <% time2str($date_format, $date) %> - Starting balance on <% time2str("%D",$date) %> + Starting balance on <% time2str($date_format, $date) %> (show prior history) @@ -297,7 +297,7 @@ % } - <% time2str("%D",$item->{'date'}) %> + <% time2str($date_format, $item->{'date'}) %> % if ( $target && $target{$target} == 1 ) { @@ -355,6 +355,7 @@ my( $cust_main ) = @_; my $custnum = $cust_main->custnum; my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; my $curuser = $FS::CurrentUser::CurrentUser; @@ -376,7 +377,7 @@ my @history = (); my %opt = ( ( map { $_ => scalar($conf->config($_)) } - qw( card_refund-days ) + qw( card_refund-days date_format ) ), ( map { $_ => $conf->exists($_) } qw( deleteinvoices deletepayments deleterefunds pkg-balances ) diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index 88bbe9bd9..75038cc56 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -4,6 +4,8 @@ by <% $cust_credit->otaker %><% "$reason$desc$apply$delete$unapply" %> my( $cust_credit, %opt ) = @_; +my $date_format = $opt{'date_format'} || '%m/%d/%Y'; + my $conf = new FS::Conf; my $curuser = $FS::CurrentUser::CurrentUser; @@ -64,7 +66,7 @@ if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 1 && $cust_credit->credited == 0 ) { #applied to one refund - $desc .= ' refunded on '. time2str("%D", $cust_credit_refund[0]->_date); + $desc .= ' refunded on '. time2str($date_format, $cust_credit_refund[0]->_date); } else { #complicated $desc .= '
'; @@ -75,11 +77,11 @@ if ( scalar(@cust_credit_bill) == 0 '$'. $app->amount. ' '. $app->applied_to_invoice. '
'; - #' on '. time2str("%D", $app->_date). + #' on '. time2str($date_format, $app->_date). } elsif ( $app->isa('FS::cust_credit_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on '. time2str("%D", $app->_date). + ' refunded on '. time2str($date_format, $app->_date). '
'; } else { die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index bcfa808db..6ec9fdb96 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -4,6 +4,8 @@ my( $cust_pay, %opt ) = @_; +my $date_format = $opt{'date_format'} || '%m/%d/%Y'; + my $conf = new FS::Conf; my $curuser = $FS::CurrentUser::CurrentUser; @@ -87,7 +89,7 @@ if ( scalar(@cust_bill_pay) == 0 && scalar(@cust_pay_refund) == 1 && $cust_pay->unapplied == 0 ) { #applied to one refund - $desc .= ' refunded on '. time2str("%D", $cust_pay_refund[0]->_date); + $desc .= ' refunded on '. time2str($date_format, $cust_pay_refund[0]->_date); } else { #complicated $desc .= '
'; @@ -98,11 +100,11 @@ if ( scalar(@cust_bill_pay) == 0 '$'. $app->amount. ' '. $app->applied_to_invoice. '
'; - #' on '. time2str("%D", $cust_bill_pay->_date). + #' on '. time2str($date_format, $cust_bill_pay->_date). } elsif ( $app->isa('FS::cust_pay_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on '. time2str("%D", $app->_date). + ' refunded on '. time2str($date_format, $app->_date). '
'; } else { die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 610372721..be68ff091 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -1,10 +1,12 @@ Payment <% $info %> -voided <% time2str("%D", $cust_pay_void->void_date) %> +voided <% time2str($date_format, $cust_pay_void->void_date) %> by <% $cust_pay_void->otaker %><% $unvoid %> <%init> my( $cust_pay_void, %opt ) = @_; +my $date_format = $opt{'date_format'} || '%m/%d/%Y'; + my $curuser = $FS::CurrentUser::CurrentUser; my $payby = $cust_pay_void->payby; -- cgit v1.2.1