X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=5a9fdd09b9f46c1010e84b4e5990cd8ae95e35d8;hb=0da4c69a66e13410b0eff18966e13170d1306f22;hp=449ab74b99a3cb1360ec823da18bc8348d8f13f0;hpb=e324bf00eaee9bd13702348b777642d7096b88a0;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 449ab74b9..5a9fdd09b 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -8,7 +8,7 @@ use vars qw( $xaction $E_NoErr ); use vars qw( $bop_processor $bop_login $bop_password $bop_action @bop_options ); use vars qw( $invoice_lines @buf ); #yuck use Date::Format; -use Mail::Internet; +use Mail::Internet 1.44; use Mail::Header; use Text::Template; use FS::Record qw( qsearch qsearchs ); @@ -369,9 +369,9 @@ emails or print. See L. sub send { my($self,$template) = @_; - - #my @print_text = $cust_bill->print_text; #( date ) + my @print_text = $self->print_text('', $template); my @invoicing_list = $self->cust_main->invoicing_list; + if ( grep { $_ ne 'POST' } @invoicing_list ) { #email invoice #false laziness w/FS::cust_pay::delete & fs_signup_server && ::realtime_card #$ENV{SMTPHOSTS} = $smtpmachine; @@ -386,7 +386,7 @@ sub send { ] ); my $message = new Mail::Internet ( 'Header' => $header, - 'Body' => [ $self->print_text('', $template) ], #( date) + 'Body' => [ @print_text ], #( date) ); $!=0; $message->smtpsend( Host => $smtpmachine ) @@ -395,11 +395,12 @@ sub send { " to ". join(', ', grep { $_ ne 'POST' } @invoicing_list ). " via server $smtpmachine with SMTP: $!"; - #} elsif ( grep { $_ eq 'POST' } @invoicing_list ) { - } elsif ( ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list ) { + } + + if ( ! @invoicing_list || grep { $_ eq 'POST' } @invoicing_list ) { #postal open(LPR, "|$lpr") or return "Can't open pipe to $lpr: $!"; - print LPR $self->print_text; #( date ) + print LPR @print_text; close LPR or return $! ? "Error closing $lpr: $!" : "Exit status $? from $lpr"; @@ -525,6 +526,7 @@ sub realtime_card { if ( $transaction->is_success() && $action2 ) { my $auth = $transaction->authorization; my $ordernum = $transaction->order_number; + #warn "********* $auth ***********\n"; #warn "********* $ordernum ***********\n"; my $capture = @@ -590,7 +592,7 @@ sub realtime_card { $template->compile() or return "($perror) can't compile template: $Text::Template::ERROR"; - my $error = $transaction->error_message; + my $templ_hash = { error => $transaction->error_message }; #false laziness w/FS::cust_pay::delete & fs_signup_server && ::send $ENV{MAILADDRESS} = $invoice_from; @@ -604,7 +606,7 @@ sub realtime_card { ] ); my $message = new Mail::Internet ( 'Header' => $header, - 'Body' => [ $template->fill_in() ], + 'Body' => [ $template->fill_in(HASH => $templ_hash) ], ); $!=0; $message->smtpsend( Host => $smtpmachine ) @@ -726,8 +728,10 @@ sub batch_card { 'payname' => $cust_main->getfield('payname'), 'amount' => $self->owed, } ); - $cust_pay_batch->insert; + my $error = $cust_pay_batch->insert; + die $error if $error; + ''; } =item print_text [TIME]; @@ -948,7 +952,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.34 2002-05-06 13:36:02 ivan Exp $ +$Id: cust_bill.pm,v 1.38 2002-06-26 02:37:48 ivan Exp $ =head1 BUGS