X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FTemplate_Mixin.pm;h=2479ef68b272f21fe283a5a5d191589e6d2d0c7b;hb=470878235c5f61ca7acc6ef618943071ca9736b5;hp=fce1a3ffe1b9ad3a0de4c3db6506200f67bb2663;hpb=7e02bdd1d34068129b9f63970f59e9f6562a105a;p=freeside.git diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index fce1a3ffe..2479ef68b 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -697,6 +697,10 @@ sub print_generic { # XXX should be an FS::cust_bill method to set the defaults, instead # of checking the type here + # info from customer's last invoice before this one, for some + # summary formats + $invoice_data{'last_bill'} = {}; + my $last_bill = $self->previous_bill; if ( $last_bill ) { @@ -757,9 +761,7 @@ sub print_generic { # ($pr_total is used elsewhere but not as $previous_balance) $invoice_data{'previous_balance'} = sprintf("%.2f", $pr_total); - $invoice_data{'last_bill'} = { - '_date' => $last_bill->_date, #unformatted - }; + $invoice_data{'last_bill'}{'_date'} = $last_bill->_date; #unformatted my (@payments, @credits); # for formats that itemize previous payments foreach my $cust_pay ( qsearch('cust_pay', { @@ -801,11 +803,7 @@ sub print_generic { $invoice_data{'previous_payments'} = []; $invoice_data{'previous_credits'} = []; } - - # info from customer's last invoice before this one, for some - # summary formats - $invoice_data{'last_bill'} = {}; - + if ( $conf->exists('invoice_usesummary', $agentnum) ) { $invoice_data{'summarypage'} = $summarypage = 1; } @@ -1370,7 +1368,7 @@ sub print_generic { # credits my $credittotal = 0; foreach my $credit ( - $self->_items_credits( 'template' => $template, 'trim_len' => 50 ) + $self->_items_credits( 'template' => $template, 'trim_len' => 40 ) ) { my $total; @@ -3009,7 +3007,7 @@ sub _items_cust_bill_pkg { my $multisection = defined($category) || defined($locationnum); my $discount_show_always = 0; - my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 50; + my $maxlength = $conf->config('cust_bill-latex_lineitem_maxlength') || 40; my $cust_main = $self->cust_main;#for per-agent cust_bill-line_item-ate_style @@ -3026,7 +3024,10 @@ sub _items_cust_bill_pkg { }) || $cust_main; $default_locationnum = $h_cust_main->ship_locationnum; } elsif ( $self->prospectnum ) { - $default_locationnum = $self->prospect_main->cust_location->locationnum; + my $cust_location = qsearchs('cust_location', + { prospectnum => $self->prospectnum, + disabled => '' }); + $default_locationnum = $cust_location->locationnum if $cust_location; } my @b = (); # accumulator for the line item hashes that we'll return