X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Femail-customer-statement.html;h=43141cfecd7791f99d193eced7f8189232efaf57;hb=5efeb63e2fcbbb864278a86bcc4663d4d533eb32;hp=65660f1be4a4f8c4f3c4eca7ecee24cf6f64b339;hpb=c112a7e56557acce5a54d3b57e4cdbab7c43ecc5;p=freeside.git diff --git a/httemplate/misc/email-customer-statement.html b/httemplate/misc/email-customer-statement.html index 65660f1be..43141cfec 100644 --- a/httemplate/misc/email-customer-statement.html +++ b/httemplate/misc/email-customer-statement.html @@ -5,13 +5,17 @@ 'no_search_fields' => [ 'start_date', 'end_date' ], 'alternate_form' => $alternate_form, 'post_search_hook' => $post_search_hook, + 'acl' => $acl, + 'process_url' => 'process/email-customer-statement.html', ) %> <%init> +my $acl = 'Resend invoices'; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View invoices'); + unless $FS::CurrentUser::CurrentUser->access_right($acl); my $alternate_form = sub { # this could maaaybe be a separate element, for cleanliness @@ -24,9 +28,9 @@ my $alternate_form = sub { my $label = ucfirst($_); $label =~ s/_/ /; include('/elements/tr-input-date-field.html',{ - 'name' => $_, - 'value' => $cgi->param($_) || '', - 'label' => $label, + 'name' => $_, + 'value' => ( scalar($cgi->param($_)) || '' ), + 'label' => $label, 'noinit' => $noinit++ }); } @@ -52,7 +56,7 @@ my $post_search_hook = sub { # set from/subject/html_body based on date range $cgi->param('from', - $opt{'conf'}->config('invoice_from') + $opt{'conf'}->config('invoice_from', $cust_main->agentnum) ); # shortcut for common text @@ -62,23 +66,19 @@ my $post_search_hook = sub { ($cgi->param('end_date') ? ' through ' : '') . $cgi->param('end_date'); - $cgi->param('subject', - $opt{'conf'}->config('company_name') . - ' statement for ' . - $summary_text - ); + my $company_name = $opt{'conf'}->config('company_name', $cust_main->agentnum); + + my $subject = "$company_name statement for $summary_text"; + + $cgi->param('subject', $subject); $cgi->param('html_body', - '

' . - $opt{'conf'}->config('company_name') . - ' statement of charges and payments for ' . - $summary_text . - "

" . + "

$subject

". include('/elements/customer-statement.html', 'history' => [ $cust_main->payment_history( map { - $_ => parse_datetime($cgi->param($_)) + $_ => parse_datetime(scalar($cgi->param($_))) } qw( start_date end_date ), ),