diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2015-06-25 00:51:02 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2015-06-25 00:51:02 -0500 |
commit | 3b46d452696901ff2dec41125f68c689ecffd5b9 (patch) | |
tree | ffd388c4526f859f44bae630a1cbc7c7680c85be /FS | |
parent | 458f6fc84389aa3d4679380bb15aad74bdec0cb3 (diff) |
RT#34078: Payment History Report / Statement [refactor to not use msg_template]
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 27 | ||||
-rw-r--r-- | FS/FS/cust_main_Mixin.pm | 11 | ||||
-rw-r--r-- | FS/FS/msg_template.pm | 37 | ||||
-rw-r--r-- | FS/FS/msg_template/InitialData.pm | 9 |
5 files changed, 5 insertions, 86 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 29d993e94..238622bbd 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2657,13 +2657,6 @@ and customer address. Include units.', }, { - 'key' => 'payment_history_msgnum', - 'section' => 'notification', - 'description' => 'Template to use for sending payment history to customer', - %msg_template_options, - }, - - { 'key' => 'payby', 'section' => 'billing', 'description' => 'Available payment types.', diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b7efa180f..f2c2b4ab4 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -4146,7 +4146,7 @@ I<conf> - 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 { @@ -4268,31 +4268,6 @@ sub payment_history { return @out; } -=item payment_history_text - -Accepts the same options as L</payment_history> 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 diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm index 83ca3a27c..bdad511fa 100644 --- a/FS/FS/cust_main_Mixin.pm +++ b/FS/FS/cust_main_Mixin.pm @@ -394,11 +394,6 @@ HTML body Text body -=item sub_param - -Optional list of parameter hashrefs to be passed -along to L<FS::msg_template/prepare>. - =back Returns an error message, or false for success. @@ -475,8 +470,6 @@ sub email_search_result { 'cust_main' => $cust_main, 'object' => $obj, ); - $message{'sub_param'} = $param->{'sub_param'} - if $param->{'sub_param'}; } else { my @to = $cust_main->invoicing_list_emailonly; @@ -554,9 +547,7 @@ sub process_email_search_result { $param->{'search'} = thaw(decode_base64($param->{'search'})) or die "process_email_search_result requires search params.\n"; - $param->{'sub_param'} = thaw(decode_base64($param->{'sub_param'})) - or die "process_email_search_result error decoding sub_param\n" - if $param->{'sub_param'}; + # $param->{'payby'} = [ split(/\0/, $param->{'payby'}) ] # unless ref($param->{'payby'}); diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index fe8cbebb3..c52b6336e 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -269,19 +269,7 @@ invoicing_list addresses. Multiple addresses may be comma-separated. =item substitutions -A hash reference of additional string substitutions - -=item sub_param - -A hash reference, keys are the names of existing substitutions, -values are an addition parameter object to pass to the subroutine -for that substitution, e.g. - - 'sub_param' => { - 'payment_history' => { - 'start_date' => 1434764295, - }, - }, +A hash reference of additional substitutions =back @@ -339,10 +327,7 @@ sub prepare { } elsif( ref($name) eq 'ARRAY' ) { # [ foo => sub { ... } ] - my @subparam = (); - push(@subparam, $opt{'sub_param'}->{$name->[0]}) - if $opt{'sub_param'} && $opt{'sub_param'}->{$name->[0]}; - $hash{$prefix.($name->[0])} = $name->[1]->($obj,@subparam); + $hash{$prefix.($name->[0])} = $name->[1]->($obj); } else { warn "bad msg_template substitution: '$name'\n"; @@ -355,10 +340,7 @@ sub prepare { $hash{$_} = $opt{substitutions}->{$_} foreach keys %{$opt{substitutions}}; } - foreach my $key (keys %hash) { - next if $self->no_encode($key); - $hash{$key} = encode_entities($_ || ''); - }; + $_ = encode_entities($_ || '') foreach values(%hash); ### # clean up template @@ -527,13 +509,6 @@ my $usage_warning = sub { #my $conf = new FS::Conf; -# for substitutions that handle their own encoding -sub no_encode { - my $self = shift; - my $field = shift; - return ($field eq 'payment_history'); -} - #return contexts and fill-in values # If you add anything, be sure to add a description in # httemplate/edit/msg_template.html. @@ -592,12 +567,6 @@ sub substitutions { [ selfservice_server_base_url => sub { $conf->config('selfservice_server-base_url') #, shift->agentnum) } ], - [ payment_history => sub { - my $cust_main = shift; - my $param = shift || {}; - #html works, see no_encode method - return '<PRE>' . encode_entities($cust_main->payment_history_text($param)) . '</PRE>'; - } ], ], # next_bill_date 'cust_pkg' => [qw( diff --git a/FS/FS/msg_template/InitialData.pm b/FS/FS/msg_template/InitialData.pm index 87c407c35..a4e27fdc9 100644 --- a/FS/FS/msg_template/InitialData.pm +++ b/FS/FS/msg_template/InitialData.pm @@ -21,15 +21,6 @@ If you did not request this password reset, you may safely ignore and delete thi END ], }, - { msgname => 'payment_history_template', - mime_type => 'text/html', - _conf => 'payment_history_msgnum', - _insert_args => [ subject => '{ $company_name } payment history', - body => <<'END', -{ $payment_history } -END - ], - }, ]; } |