From: Ivan Kohler Date: Sun, 10 Aug 2014 02:38:12 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=d883a843dcfce64caeddd2a4abb0982c16a17199;hp=a8121357fa4c5215c19b17e2ed79ced4a7d9fa0b Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 8f4d05b3c..616a06c90 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 fb41e0e6b..d4f2aec29 100644 --- a/FS/FS/bill_batch.pm +++ b/FS/FS/bill_batch.pm @@ -61,6 +61,8 @@ sub print_pdf { my @invoices = sort { $a->invnum <=> $b->invnum } $self->cust_bill_batch; 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) { @@ -73,6 +75,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/cdr.pm b/FS/FS/cdr.pm index cd1416533..fce7a14ca 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' ) { diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 676f218c7..1b9b34792 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1507,6 +1507,8 @@ sub fax_invoice { Place this invoice into the open batch (see C). If there isn't an open batch, one will be created. +HASHREF may contain any options to be passed to C. + =cut sub batch_invoice {