summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-01-27 02:50:56 -0800
committerMark Wells <mark@freeside.biz>2016-01-27 03:15:46 -0800
commit08e9b7ea8e912dfa70de6d08eb7849d3bd9c68b5 (patch)
treea88983a46248c5b878d2947ef22c2e30f7c67f40
parent85c406c3ceb14f4b6c3f325f498a79a443103c18 (diff)
show customer email on commission credit detail reports, #40033
-rwxr-xr-xhttemplate/search/cust_credit.html44
1 files changed, 35 insertions, 9 deletions
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html
index 7738494db..0ec463f2c 100755
--- a/httemplate/search/cust_credit.html
+++ b/httemplate/search/cust_credit.html
@@ -56,33 +56,59 @@ if ($unapplied) {
push @header, emt('Date'),
emt('By'),
emt('Reason'),
- FS::UI::Web::cust_header(),
;
push @fields, sub { time2str('%b %d %Y', shift->_date ) },
'otaker',
'reason',
- \&FS::UI::Web::cust_fields,
;
-push @sort_fields, '_date', 'otaker', 'reason', FS::UI::Web::cust_sort_fields();
-$align .= 'rll'.FS::UI::Web::cust_aligns();
+push @sort_fields, '_date', 'otaker', 'reason';
+$align .= 'rll';
push @links, '',
'',
'',
- ( map { $_ ne 'Cust. Status' ? $clink : '' }
- FS::UI::Web::cust_header()
- ),
;
push @color, '',
'',
'',
- FS::UI::Web::cust_colors(),
;
push @style, '',
'',
'',
- FS::UI::Web::cust_styles(),
;
+# insert customer email after 'Reason' if this is a commission report
+if ( $cgi->param('commission_salesnum') or $cgi->param('commission_agentnum') ) {
+ my $sub_customer_email = sub {
+ my $cust_credit = shift;
+ return '' unless $cust_credit->eventnum;
+ my $cust_event = FS::cust_event->by_key($cust_credit->eventnum)
+ or return '';
+ my $cust_X = $cust_event->cust_X or return '';
+ my $cust_main = $cust_X->cust_main or return '';
+ my ($email) = $cust_main->invoicing_list_emailonly;
+ return encode_entities("<$email>") if length($email);
+ '';
+ };
+ push @header, '';
+ push @fields, $sub_customer_email;
+ push @sort_fields, '';
+ $align .= 'l';
+ push @links, '';
+ push @color, '';
+ push @style, '';
+}
+
+# cust fields
+push @header, FS::UI::Web::cust_header();
+push @fields, \&FS::UI::Web::cust_fields;
+push @sort_fields, FS::UI::Web::cust_sort_fields;
+$align .= FS::UI::Web::cust_aligns();
+push @links, map { $_ ne 'Cust. Status' ? $clink : '' }
+ FS::UI::Web::cust_header();
+push @color, FS::UI::Web::cust_colors();
+push @style, FS::UI::Web::cust_styles();
+
+
my @search = ();
my $addl_from = '';