[freeside-commits] freeside/FS/FS cust_bill.pm, 1.162,
1.163 cust_pay.pm, 1.49, 1.50
Ivan,,,
ivan at wavetail.420.am
Tue Feb 6 16:46:31 PST 2007
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv22895/FS/FS
Modified Files:
cust_bill.pm cust_pay.pm
Log Message:
only use new statements as payment receipts if the conf file is created
Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cust_pay.pm 31 Jan 2007 04:30:49 -0000 1.49
+++ cust_pay.pm 7 Feb 2007 00:46:28 -0000 1.50
@@ -192,8 +192,14 @@
if ( $conf->exists('payment_receipt_email')
&& grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list
) {
+
+ $cust_bill ||= ($cust_main->cust_bill)[-1]; #rather inefficient though?
+
my $error;
- if ( exists($options{ 'manual' }) && $options{ 'manual' } ) {
+ if ( ( exists($options{'manual'}) && $options{'manual'} )
+ || ! $conf->exists('invoice_html_statement')
+ || ! $cust_bill
+ ) {
my $receipt_template = new Text::Template (
TYPE => 'ARRAY',
@@ -226,21 +232,20 @@
'balance' => $cust_main->balance,
} ) ],
);
- }else{
- unless($cust_bill){
- $cust_bill = ($cust_main->cust_bill)[-1];
- }
- if ($cust_bill) {
- my $queue = new FS::queue {
- 'paynum' => $self->paynum,
- 'job' => 'FS::cust_bill::queueable_send',
- };
- $error = $queue->insert(
- 'invnum' => $cust_bill->invnum,
- 'template' => 'statement',
- );
- }
+
+ } else {
+
+ my $queue = new FS::queue {
+ 'paynum' => $self->paynum,
+ 'job' => 'FS::cust_bill::queueable_email',
+ };
+ $error = $queue->insert(
+ 'invnum' => $cust_bill->invnum,
+ 'template' => 'statement',
+ );
+
}
+
if ( $error ) {
warn "can't send payment receipt/statement: $error";
}
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -d -r1.162 -r1.163
--- cust_bill.pm 1 Feb 2007 01:57:12 -0000 1.162
+++ cust_bill.pm 7 Feb 2007 00:46:28 -0000 1.163
@@ -735,9 +735,13 @@
my $self = qsearchs('cust_bill', { 'invnum' => $opt{invnum} } )
or die "invalid invoice number: " . $opt{invnum};
- my $error = $self->send($opt{template}, $opt{agentnum}, $opt{invoice_from});
+ my @args = ( $opt{template}, $opt{agentnum} );
+ push @args, $opt{invoice_from}
+ if exists($opt{invoice_from}) && $opt{invoice_from};
+ my $error = $self->send( @args );
die $error if $error;
+
}
sub send {
@@ -778,6 +782,21 @@
=cut
+sub queueable_email {
+ my %opt = @_;
+
+ my $self = qsearchs('cust_bill', { 'invnum' => $opt{invnum} } )
+ or die "invalid invoice number: " . $opt{invnum};
+
+ my @args = ( $opt{template} );
+ push @args, $opt{invoice_from}
+ if exists($opt{invoice_from}) && $opt{invoice_from};
+
+ my $error = $self->email( @args );
+ die $error if $error;
+
+}
+
sub email {
my $self = shift;
my $template = scalar(@_) ? shift : '';
More information about the freeside-commits
mailing list