add some debug tracing to invoice generation, RT#11452
authorivan <ivan>
Sat, 5 Feb 2011 02:38:37 +0000 (02:38 +0000)
committerivan <ivan>
Sat, 5 Feb 2011 02:38:37 +0000 (02:38 +0000)
FS/FS/cust_bill.pm

index 49d9128..b992a65 100644 (file)
@@ -2217,6 +2217,9 @@ sub print_generic {
                      'template' => [ '{', '}' ],
                    );
 
                      '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";
   #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);
   } 
 
     @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},
   );
 
   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";
 
   $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};
 
                            );
   my $embolden_function = $embolden_functions{$format};
 
+  warn "$me generating template variables\n"
+    if $DEBUG > 1;
 
   # generate template variables
   my $returnaddress;
 
   # 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 = (
   my $agentnum = $self->cust_main->agentnum;
 
   my %invoice_data = (
@@ -2528,7 +2542,9 @@ sub print_generic {
   }
   $invoice_data{'summarypage'} = $summarypage;
 
   }
   $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);
   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;
 
   $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),
   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 = {
     foreach my $line_item ( $self->_items_previous ) {
 
       my $detail = {
@@ -2703,6 +2725,9 @@ sub print_generic {
   }
  
   if ( $conf->exists('svc_phone-did-summary') ) {
   }
  
   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, 
       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) {
 
 
   foreach my $section (@sections, @$late_sections) {
 
+    warn "$me adding $section section\n"
+      if $DEBUG > 1;
+
     # begin some normalization
     $section->{'subtotal'} = $section->{'amount'}
       if $multisection
     # begin some normalization
     $section->{'subtotal'} = $section->{'amount'}
       if $multisection
@@ -2798,6 +2826,9 @@ sub print_generic {
     unshift @sections, $previous_section if $pr_total;
   }
 
     unshift @sections, $previous_section if $pr_total;
   }
 
+  warn "$me adding taxes\n"
+    if $DEBUG > 1;
+
   foreach my $tax ( $self->_items_tax ) {
 
     $taxtotal += $tax->{'amount'};
   foreach my $tax ( $self->_items_tax ) {
 
     $taxtotal += $tax->{'amount'};