package FS::bill_batch;
+use base qw(FS::Record);
use strict;
-use vars qw( @ISA $me $DEBUG );
+use vars qw( $me $DEBUG );
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 ]';
-$DEBUG=0;
+$DEBUG = 0;
sub table { 'bill_batch' }
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;
my $pdf_out;
die $error if $error;
}
}
+ $job->update_statustext(100, 'Combining invoices') if $job;
return $pdf_out->toPDF;
}
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
my $batch = FS::bill_batch->by_key($param->{batchnum});
die "batch '$param->{batchnum}' not found!\n" if !$batch;
+ if ( $param->{'close'} ) {
+ my $error = $batch->close;
+ die $error if $error;
+ }
+
my $pdf = $batch->print_pdf($job);
$batch->pdf($pdf);
my $error = $batch->replace;