diff options
Diffstat (limited to 'httemplate/search/cust_bill.html')
-rwxr-xr-x | httemplate/search/cust_bill.html | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index 2108653a8..5e904e114 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -95,7 +95,7 @@ 'cust_bill.*', #( map "cust_main.$_", qw(custnum last first company) ), 'cust_main.custnum as cust_main_custnum', - FS::UI::Web::cust_sql_fields(), + ( map "cust_main.$_", qw(last first company) ), "$owed as owed", ), 'extra_sql' => "$extra_sql $orderby" @@ -106,7 +106,8 @@ my $link = [ "${p}view/cust_bill.cgi?", 'invnum', ]; my $clink = sub { my $cust_bill = shift; - $cust_bill->cust_main_custnum + my $cust_main = $cust_bill->cust_main; + $cust_main ? [ "${p}view/cust_main.cgi?", 'custnum' ] : ''; }; @@ -153,18 +154,32 @@ 'count_query' => $count_query, 'count_addl' => $count_addl, 'redirect' => $link, - 'header' => [ 'Invoice #', - 'Balance', - 'Amount', - 'Date', - FS::UI::Web::cust_header(), - ], + 'header' => + [ 'Invoice #', qw(Balance Amount Date), 'Contact name', + 'Company' ], 'fields' => [ 'invnum', sub { sprintf($money_char.'%.2f', shift->get('owed') ) }, sub { sprintf($money_char.'%.2f', shift->charged ) }, sub { time2str('%b %d %Y', shift->_date ) }, - \&FS::UI::Web::cust_fields, + sub { my $cust_bill = shift; + # my $cust_main = $cust_bill->cust_main; + # $cust_main + # ? $cust_main->get('last'). ', '. $cust_main->first + # : "WARNING: can't find cust_main.custnum ". + # $cust_bill->custnum. ' (cust_bill.invnum '. + # $cust_bill->invnum. ')'; + if ( $cust_bill->cust_main_custnum ) { + FS::cust_main::name($cust_bill); + } else { + "WARNING: can't find cust_main.custnum ". + $cust_bill->custnum. ' (cust_bill.invnum '. + $cust_bill->invnum. ')'; + } + }, + sub { my $cust_main = shift->cust_main; + $cust_main ? $cust_main->company : ''; + }, ], 'align' => 'rrrrll', 'links' => [ @@ -172,7 +187,8 @@ $link, $link, $link, - ( map { $clink } FS::UI::Web::cust_header() ), + $clink, + $clink, ], ) |