X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fcust_main.pm;h=f55c3493c7b0ac7e555e9a46a89f02e400a0d9a4;hb=0ed195595b5c7ea404c8848d9d1881ada4214489;hp=b7efa180ff3b590d66ebc4880cd183d9685f7b52;hpb=c6ef5a3a043c4fafa2f8d21028609f1b9b70eb47;p=freeside.git diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b7efa180f..f55c3493c 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -32,7 +32,7 @@ use Locale::Country; use FS::UID qw( dbh driver_name ); use FS::Record qw( qsearchs qsearch dbdef regexp_sql ); use FS::Cursor; -use FS::Misc qw( generate_email send_email generate_ps do_print ); +use FS::Misc qw( generate_email send_email generate_ps do_print money_pretty ); use FS::Msgcat qw(gettext); use FS::CurrentUser; use FS::TicketSystem; @@ -4146,7 +4146,7 @@ I - optional already-loaded FS::Conf object. =cut # Caution: this gets used by FS::ClientAPI::MyAccount::billing_history, -# and also payment_history_text, which should both be kept customer-friendly. +# and also for sending customer statements, which should both be kept customer-friendly. # If you add anything that shouldn't be passed on through the API or exposed # to customers, add a new option to include it, don't include it by default sub payment_history { @@ -4175,7 +4175,7 @@ sub payment_history { 'amount' => sprintf('%.2f', $_->setup + $_->recur ), 'charged' => sprintf('%.2f', $_->setup + $_->recur ), 'date' => $cust_bill->_date, - 'date_pretty' => time2str('%m/%d/%Y', $cust_bill->_date ), + 'date_pretty' => $self->time2str_local('short', $cust_bill->_date ), } foreach $cust_bill->cust_bill_pkg; @@ -4189,7 +4189,7 @@ sub payment_history { 'amount' => sprintf('%.2f', $_->charged ), 'charged' => sprintf('%.2f', $_->charged ), 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_bill; @@ -4201,7 +4201,7 @@ sub payment_history { 'amount' => sprintf('%.2f', 0 - $_->paid ), 'paid' => sprintf('%.2f', $_->paid ), 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_pay; @@ -4211,7 +4211,7 @@ sub payment_history { 'amount' => sprintf('%.2f', 0 -$_->amount ), 'credit' => sprintf('%.2f', $_->amount ), 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_credit; @@ -4221,7 +4221,7 @@ sub payment_history { 'amount' => $_->refund, 'refund' => $_->refund, 'date' => $_->_date, - 'date_pretty' => time2str('%m/%d/%Y', $_->_date ), + 'date_pretty' => $self->time2str_local('short', $_->_date ), } foreach $self->cust_refund; @@ -4241,8 +4241,7 @@ sub payment_history { } $$item{'balance'} = sprintf("%.2f",$balance); foreach my $key ( qw(amount balance) ) { - $$item{$key.'_pretty'} = $$item{$key}; - $$item{$key.'_pretty'} =~ s/^(-?)/$1$money_char/; + $$item{$key.'_pretty'} = money_pretty($$item{$key}); } push(@out,$item); } @@ -4254,6 +4253,8 @@ sub payment_history { 'description' => 'Previous balance', 'amount' => sprintf("%.2f",$previous), 'balance' => sprintf("%.2f",$previous), + 'date' => $$opt{'start_date'}, + 'date_pretty' => $self->time2str_local('short', $$opt{'start_date'} ), }; #false laziness with above foreach my $key ( qw(amount balance) ) { @@ -4268,31 +4269,6 @@ sub payment_history { return @out; } -=item payment_history_text - -Accepts the same options as L and returns those -results as a string table with fixed-width columns, max width 80 char. - -=cut - -sub payment_history_text { - my $self = shift; - my $opt = ref($_[0]) ? $_[0] : { @_ }; - my $out = sprintf("%-12s",'Date'); - $out .= sprintf("%11s",'Amount') . ' '; - $out .= sprintf("%11s",'Balance') . ' '; - $out .= 'Description'; #don't need to pad with spaces - $out .= "\n"; - foreach my $item ($self->payment_history($opt)) { - $out .= sprintf("%-10.10s",$$item{'date_pretty'}) . ' '; #12 width - $out .= sprintf("%11.11s",$$item{'amount_pretty'}) . ' '; #13 width - $out .= sprintf("%11.11s",$$item{'balance_pretty'}) . ' '; #13 width - $out .= sprintf("%.42s",$$item{'description'}); #max 42 width - $out .= "\n"; - } - return $out; -} - =back =head1 CLASS METHODS