projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Thinktel VoIP provisioning, #32084
[freeside.git]
/
FS
/
FS
/
bill_batch.pm
diff --git
a/FS/FS/bill_batch.pm
b/FS/FS/bill_batch.pm
index
1a46db0
..
da6420c
100644
(file)
--- a/
FS/FS/bill_batch.pm
+++ b/
FS/FS/bill_batch.pm
@@
-1,16
+1,13
@@
package FS::bill_batch;
package FS::bill_batch;
+use base qw(FS::Record);
use strict;
use strict;
-use vars qw(
@ISA
$me $DEBUG );
+use vars qw( $me $DEBUG );
use CAM::PDF;
use FS::Conf;
use CAM::PDF;
use FS::Conf;
-use FS::Record qw( qsearch qsearchs dbh );
-use FS::agent;
-use FS::cust_bill_batch;
-@ISA = qw( FS::Record );
$me = '[ FS::bill_batch ]';
$me = '[ FS::bill_batch ]';
-$DEBUG
=
0;
+$DEBUG
=
0;
sub table { 'bill_batch' }
sub table { 'bill_batch' }
@@
-61,10
+58,11
@@
sub print_pdf {
my $self = shift;
my $job = shift;
$job->update_statustext(0) if $job;
my $self = shift;
my $job = shift;
$job->update_statustext(0) if $job;
- my @invoices = sort { $a->invnum <=> $b->invnum }
- qsearch('cust_bill_batch', { batchnum => $self->batchnum });
+ my @invoices = sort { $a->invnum <=> $b->invnum } $self->cust_bill_batch;
return "No invoices in batch ".$self->batchnum.'.' if !@invoices;
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) {
my $pdf_out;
my $num = 0;
foreach my $invoice (@invoices) {
@@
-77,6
+75,13
@@
sub print_pdf {
else {
$pdf_out = CAM::PDF->new($part);
}
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++;
if($job) {
# update progressbar
$num++;
@@
-118,13
+123,6
@@
sub check {
Returns the agent (see L<FS::agent>) for this invoice batch.
Returns the agent (see L<FS::agent>) for this invoice batch.
-=cut
-
-sub agent {
- my $self = shift;
- qsearchs( 'agent', { 'agentnum' => $self->agentnum } );
-}
-
=back
=head1 SUBROUTINES
=back
=head1 SUBROUTINES
@@
-133,13
+131,11
@@
sub agent {
=cut
=cut
-use Storable 'thaw';
use Data::Dumper;
use Data::Dumper;
-use MIME::Base64;
sub process_print_pdf {
my $job = shift;
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});
warn Dumper($param) if $DEBUG;
die "no batchnum specified!\n" if ! exists($param->{batchnum});
my $batch = FS::bill_batch->by_key($param->{batchnum});