X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fbill_batch.pm;h=854a90a6c4581a9da7dc5f24a6fec95bfbd42158;hb=3cbdd85a96348a287623e3b97c937c7749e99392;hp=fb41e0e6b18f9bca38332f879729daad2bc6f5f0;hpb=32072dbf59a054529f5304574c0f56f9567d14d0;p=freeside.git diff --git a/FS/FS/bill_batch.pm b/FS/FS/bill_batch.pm index fb41e0e6b..854a90a6c 100644 --- a/FS/FS/bill_batch.pm +++ b/FS/FS/bill_batch.pm @@ -61,6 +61,9 @@ sub print_pdf { my @invoices = sort { $a->invnum <=> $b->invnum } $self->cust_bill_batch; return "No invoices in batch ".$self->batchnum.'.' if !@invoices; + my $conf = FS::Conf->new; + my $duplex = $conf->exists('invoice_print_pdf-duplex'); + my $pdf_out; my $num = 0; foreach my $invoice (@invoices) { @@ -73,6 +76,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++; @@ -122,13 +132,11 @@ Returns the agent (see L) for this invoice batch. =cut -use Storable 'thaw'; use Data::Dumper; -use MIME::Base64; sub process_print_pdf { my $job = shift; - my $param = thaw(decode_base64(shift)); + my $param = shift; warn Dumper($param) if $DEBUG; die "no batchnum specified!\n" if ! exists($param->{batchnum}); my $batch = FS::bill_batch->by_key($param->{batchnum});