[freeside-commits] branch FREESIDE_3_BRANCH updated. a0f5ae295297e1b17ab89640346fc06cfb1e5892

Mark Wells mark at 420.am
Sat Aug 9 17:40:52 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  a0f5ae295297e1b17ab89640346fc06cfb1e5892 (commit)
       via  5db92cf346acf4205aa96f58843a0a1d065f3988 (commit)
      from  b4dd79750936de7aa6998cea77f9091cdbd67392 (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 a0f5ae295297e1b17ab89640346fc06cfb1e5892
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Aug 9 17:39:27 2014 -0700

    two-sided printing of invoice batches, #29927

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 35b88ea..3d7ffe7 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1527,6 +1527,13 @@ and customer address. Include units.',
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'invoice_print_pdf-duplex',
+    'section'     => 'invoicing',
+    'description' => 'Insert blank pages so that spooled invoices are each an even number of pages.  Use this for double-sided printing.',
+    'type'        => 'checkbox',
+  },
+
   { 
     'key'         => 'invoice_default_terms',
     'section'     => 'invoicing',
diff --git a/FS/FS/bill_batch.pm b/FS/FS/bill_batch.pm
index 1a46db0..239341c 100644
--- a/FS/FS/bill_batch.pm
+++ b/FS/FS/bill_batch.pm
@@ -65,6 +65,8 @@ sub print_pdf {
                  qsearch('cust_bill_batch', { batchnum => $self->batchnum });
   return "No invoices in batch ".$self->batchnum.'.' if !@invoices;
 
+  my $duplex = FS::Conf->exists('invoice_print_pdf-duplex');
+
   my $pdf_out;
   my $num = 0;
   foreach my $invoice (@invoices) {
@@ -77,6 +79,13 @@ sub print_pdf {
     else {
       $pdf_out = CAM::PDF->new($part);
     }
+    if ( $duplex ) {
+      my $n = $pdf_out->numPages;
+      if ( $n % 2 == 1 ) {
+        # then insert a blank page so we end on an even number
+        $pdf_out->duplicatePage($n, 1);
+      }
+    }
     if($job) {
       # update progressbar
       $num++;
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 7f1290f..31422f0 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -1565,6 +1565,8 @@ sub fax_invoice {
 Place this invoice into the open batch (see C<FS::bill_batch>).  If there 
 isn't an open batch, one will be created.
 
+HASHREF may contain any options to be passed to C<print_pdf>.
+
 =cut
 
 sub batch_invoice {

commit 5db92cf346acf4205aa96f58843a0a1d065f3988
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Aug 8 15:55:37 2014 -0700

    silence warning

diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index cd14165..fce7a14 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -368,7 +368,7 @@ to inspect other field.
 sub is_tollfree {
   my $self = shift;
   my $field = scalar(@_) ? shift : 'dst';
-  my $country = $conf->config('tollfree-country');
+  my $country = $conf->config('tollfree-country') || '';
   if ( $country eq 'AU' ) { 
     ( $self->$field() =~ /^(\+?61)?1800/ ) ? 1 : 0;
   } elsif ( $country eq 'NZ' ) { 

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

Summary of changes:
 FS/FS/Conf.pm       |    7 +++++++
 FS/FS/bill_batch.pm |    9 +++++++++
 FS/FS/cdr.pm        |    2 +-
 FS/FS/cust_bill.pm  |    2 ++
 4 files changed, 19 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list