X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fbill_batch.pm;h=827c102da155fd64a31ae75331e999801c7dcbb3;hb=18af4f3316291938fa8f0a74e083209f62eac4fa;hp=d4f2aec294401c5ec2276abb00f1d53606ea48ed;hpb=a620ce3b904e9a9ba1da9c990f63f7a94acb785c;p=freeside.git diff --git a/FS/FS/bill_batch.pm b/FS/FS/bill_batch.pm index d4f2aec29..827c102da 100644 --- a/FS/FS/bill_batch.pm +++ b/FS/FS/bill_batch.pm @@ -58,21 +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 $duplex = FS::Conf->exists('invoice_print_pdf-duplex'); + 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 ) { @@ -82,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; } } @@ -131,13 +134,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});