[freeside-commits] branch FREESIDE_4_BRANCH updated. b9a83820479b1d68ddf753a0758084d385298816

Ivan ivan at 420.am
Sun Sep 25 10:56:26 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  b9a83820479b1d68ddf753a0758084d385298816 (commit)
      from  680f24e1d4faa1b72f5051e8109810a5f3f4d2ad (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b9a83820479b1d68ddf753a0758084d385298816
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun Sep 25 10:56:25 2016 -0700

    hard things in programming: variable naming

diff --git a/FS/FS/bill_batch.pm b/FS/FS/bill_batch.pm
index 854a90a..827c102 100644
--- a/FS/FS/bill_batch.pm
+++ b/FS/FS/bill_batch.pm
@@ -58,22 +58,24 @@ sub print_pdf {
   my $self = shift;
   my $job = shift;
   $job->update_statustext(0) if $job;
-  my @invoices = sort { $a->invnum <=> $b->invnum } $self->cust_bill_batch;
-  return "No invoices in batch ".$self->batchnum.'.' if !@invoices;
+  my @cust_bill_batch = sort { $a->invnum <=> $b->invnum }
+                          $self->cust_bill_batch;
+  return "No invoices in batch ".$self->batchnum.'.' if !@cust_bill_batch;
 
   my $conf = FS::Conf->new;
   my $duplex = $conf->exists('invoice_print_pdf-duplex');
 
   my $pdf_out;
   my $num = 0;
-  foreach my $invoice (@invoices) {
-    my $part = $invoice->cust_bill->print_pdf({$invoice->options});
-    die 'Failed creating PDF from invoice '.$invoice->invnum.'\n' if !$part;
+  foreach my $cust_bill_batch (@cust_bill_batch) {
+    my $part =
+      $cust_bill_batch->cust_bill->print_pdf({$cust_bill_batch->options});
+    die 'Failed creating PDF from invoice '.$cust_bill_batch->invnum.'\n'
+      if !$part;
 
     if($pdf_out) {
       $pdf_out->appendPDF(CAM::PDF->new($part));
-    }
-    else {
+    } else {
       $pdf_out = CAM::PDF->new($part);
     }
     if ( $duplex ) {
@@ -83,10 +85,10 @@ sub print_pdf {
         $pdf_out->duplicatePage($n, 1);
       }
     }
-    if($job) {
+    if ($job) {
       # update progressbar
       $num++;
-      my $error = $job->update_statustext(int(100 * $num/scalar(@invoices)));
+      my $error = $job->update_statustext(int(100 * $num/scalar(@cust_bill_batch)));
       die $error if $error;
     }
   }

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/bill_batch.pm |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)




More information about the freeside-commits mailing list