From: ivan Date: Sat, 5 Feb 2011 02:38:37 +0000 (+0000) Subject: add some debug tracing to invoice generation, RT#11452 X-Git-Tag: freeside_2_3_0~653 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=c079fb7da9ff7647611754608378151259b6e2d1 add some debug tracing to invoice generation, RT#11452 --- diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 49d9128bd..b992a656b 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2217,6 +2217,9 @@ sub print_generic { 'template' => [ '{', '}' ], ); + warn "$me print_generic creating template\n" + if $DEBUG > 1; + #create the template my $template = $params{template} ? $params{template} : $self->_agent_template; my $templatefile = "invoice_$format"; @@ -2234,12 +2237,18 @@ sub print_generic { @invoice_template = _translate_old_latex_format(@invoice_template); } + warn "$me print_generic creating T:T object\n" + if $DEBUG > 1; + my $text_template = new Text::Template( TYPE => 'ARRAY', SOURCE => \@invoice_template, DELIMITERS => $delimiters{$format}, ); + warn "$me print_generic compiling T:T object\n" + if $DEBUG > 1; + $text_template->compile() or die "Can't compile $templatefile: $Text::Template::ERROR\n"; @@ -2353,6 +2362,8 @@ sub print_generic { ); my $embolden_function = $embolden_functions{$format}; + warn "$me generating template variables\n" + if $DEBUG > 1; # generate template variables my $returnaddress; @@ -2406,6 +2417,9 @@ sub print_generic { } + warn "$me generating invoice data\n" + if $DEBUG > 1; + my $agentnum = $self->cust_main->agentnum; my %invoice_data = ( @@ -2528,7 +2542,9 @@ sub print_generic { } $invoice_data{'summarypage'} = $summarypage; - #do variable substitution in notes, footer, smallfooter + warn "$me substituting variables in notes, footer, smallfooter\n" + if $DEBUG > 1; + foreach my $include (qw( notes footer smallfooter coupon )) { my $inc_file = $conf->key_orbase("invoice_${format}$include", $template); @@ -2599,6 +2615,9 @@ sub print_generic { $invoice_data{'buf'} = \@buf; $invoice_data{'sections'} = \@sections; + warn "$me generating sections\n" + if $DEBUG > 1; + my $previous_section = { 'description' => 'Previous Charges', 'subtotal' => $other_money_char. sprintf('%.2f', $pr_total), @@ -2669,6 +2688,9 @@ sub print_generic { ) { + warn "$me adding previous balances\n" + if $DEBUG > 1; + foreach my $line_item ( $self->_items_previous ) { my $detail = { @@ -2703,6 +2725,9 @@ sub print_generic { } if ( $conf->exists('svc_phone-did-summary') ) { + warn "$me adding DID summary\n" + if $DEBUG > 1; + my ($didsummary,$minutes) = $self->_did_summary; my $didsummary_desc = 'DID Activity Summary (Past 30 days)'; push @detail_items, @@ -2714,6 +2739,9 @@ sub print_generic { foreach my $section (@sections, @$late_sections) { + warn "$me adding $section section\n" + if $DEBUG > 1; + # begin some normalization $section->{'subtotal'} = $section->{'amount'} if $multisection @@ -2798,6 +2826,9 @@ sub print_generic { unshift @sections, $previous_section if $pr_total; } + warn "$me adding taxes\n" + if $DEBUG > 1; + foreach my $tax ( $self->_items_tax ) { $taxtotal += $tax->{'amount'};