X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_credit.html;h=2241f02e368057bbff59549a50954a409723d8b2;hb=8eb6542c022ac84b125416f3fb0828b278ba600a;hp=fb6ef834b725ea17f2eda610893ea0ad3c77af89;hpb=eedfe58ba50912dbfb490aa47930bbc0ab9e3ac9;p=freeside.git diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html index fb6ef834b..2241f02e3 100755 --- a/httemplate/search/cust_credit.html +++ b/httemplate/search/cust_credit.html @@ -56,33 +56,57 @@ 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'; -$align .= 'rll'.FS::UI::Web::cust_aligns(), +$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; + my $cust_event = $cust_credit->cust_event 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 = ''; @@ -97,11 +121,20 @@ if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) { $title = $agent->agent. " $title"; } +if ( $cgi->param('credbatch') =~ /^([\w\-\/\.\:]+)$/ ) { + push @search, "cust_credit.credbatch = '$1'"; +} + # commission_salesnum if ( $cgi->param('commission_salesnum') =~ /^(\d+)$/ ) { push @search, "commission_salesnum = $1"; } +# commission agentnum +if ( $cgi->param('commission_agentnum') =~ /^(\d+)$/ ) { + push @search, "commission_agentnum = $1"; +} + # commission_classnum if ( grep { $_ eq 'commission_classnum' } $cgi->param ) { $cgi->param('commission_classnum') =~ /^(\d*)$/ or die 'guru meditation #13';