projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debug
[freeside.git]
/
FS
/
FS
/
cust_bill.pm
diff --git
a/FS/FS/cust_bill.pm
b/FS/FS/cust_bill.pm
index
cb2aa46
..
5a9fdd0
100644
(file)
--- 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 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 );
use Mail::Header;
use Text::Template;
use FS::Record qw( qsearch qsearchs );
@@
-369,9
+369,9
@@
emails or print. See L<FS::cust_main_invoice>.
sub send {
my($self,$template) = @_;
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;
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;
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,
] );
my $message = new Mail::Internet (
'Header' => $header,
- 'Body' => [
$self->print_text('', $template)
], #( date)
+ 'Body' => [
@print_text
], #( date)
);
$!=0;
$message->smtpsend( Host => $smtpmachine )
);
$!=0;
$message->smtpsend( Host => $smtpmachine )
@@
-395,11
+395,12
@@
sub send {
" to ". join(', ', grep { $_ ne 'POST' } @invoicing_list ).
" via server $smtpmachine with SMTP: $!";
" 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: $!";
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";
close LPR
or return $! ? "Error closing $lpr: $!"
: "Exit status $? from $lpr";
@@
-458,7
+459,7
@@
sub realtime_card {
my($payname, $payfirst, $paylast);
if ( $cust_main->payname ) {
$payname = $cust_main->payname;
my($payname, $payfirst, $paylast);
if ( $cust_main->payname ) {
$payname = $cust_main->payname;
- $payname =~ /^\s*([\w \,\.\-\']*)?\s+([\w\,\.\-\']+)$/
+ $payname =~ /^\s*([\w \,\.\-\']*)?\s+([\w\,\.\-\']+)
\s*
$/
or do {
#$dbh->rollback if $oldAutoCommit;
return "Illegal payname $payname";
or do {
#$dbh->rollback if $oldAutoCommit;
return "Illegal payname $payname";
@@
-466,7
+467,7
@@
sub realtime_card {
($payfirst, $paylast) = ($1, $2);
} else {
$payfirst = $cust_main->getfield('first');
($payfirst, $paylast) = ($1, $2);
} else {
$payfirst = $cust_main->getfield('first');
- $paylast = $cust_main->getfield('
fir
st');
+ $paylast = $cust_main->getfield('
la
st');
$payname = "$payfirst $paylast";
}
$payname = "$payfirst $paylast";
}
@@
-483,7
+484,10
@@
sub realtime_card {
if ( $conf->exists('business-onlinepayment-description') ) {
my $dtempl = $conf->config('business-onlinepayment-description');
if ( $conf->exists('business-onlinepayment-description') ) {
my $dtempl = $conf->config('business-onlinepayment-description');
- my $agent = $self->cust_main->agent->agent;
+ my $agent_obj = $cust_main->agent
+ or die "can't retreive agent for $cust_main (agentnum ".
+ $cust_main->agentnum. ")";
+ my $agent = $agent_obj->agent;
my $pkgs = join(', ',
map { $_->cust_pkg->part_pkg->pkg }
grep { $_->pkgnum } $self->cust_bill_pkg
my $pkgs = join(', ',
map { $_->cust_pkg->part_pkg->pkg }
grep { $_->pkgnum } $self->cust_bill_pkg
@@
-515,12
+519,14
@@
sub realtime_card {
'expiration' => $exp,
'referer' => 'http://cleanwhisker.420.am/',
'email' => $email,
'expiration' => $exp,
'referer' => 'http://cleanwhisker.420.am/',
'email' => $email,
+ 'phone' => $cust_main->daytime || $cust_main->night,
);
$transaction->submit();
if ( $transaction->is_success() && $action2 ) {
my $auth = $transaction->authorization;
my $ordernum = $transaction->order_number;
);
$transaction->submit();
if ( $transaction->is_success() && $action2 ) {
my $auth = $transaction->authorization;
my $ordernum = $transaction->order_number;
+
#warn "********* $auth ***********\n";
#warn "********* $ordernum ***********\n";
my $capture =
#warn "********* $auth ***********\n";
#warn "********* $ordernum ***********\n";
my $capture =
@@
-582,11
+588,11
@@
sub realtime_card {
my $template = new Text::Template (
TYPE => 'ARRAY',
SOURCE => [ map "$_\n", @templ ],
my $template = new Text::Template (
TYPE => 'ARRAY',
SOURCE => [ map "$_\n", @templ ],
- ) or
die
"($perror) can't create template: $Text::Template::ERROR";
+ ) or
return
"($perror) can't create template: $Text::Template::ERROR";
$template->compile()
$template->compile()
- or
die
"($perror) can't compile template: $Text::Template::ERROR";
+ 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;
#false laziness w/FS::cust_pay::delete & fs_signup_server && ::send
$ENV{MAILADDRESS} = $invoice_from;
@@
-600,12
+606,12
@@
sub realtime_card {
] );
my $message = new Mail::Internet (
'Header' => $header,
] );
my $message = new Mail::Internet (
'Header' => $header,
- 'Body' => [ $template->fill_in() ],
+ 'Body' => [ $template->fill_in(
HASH => $templ_hash
) ],
);
$!=0;
$message->smtpsend( Host => $smtpmachine )
or $message->smtpsend( Host => $smtpmachine, Debug => 1 )
);
$!=0;
$message->smtpsend( Host => $smtpmachine )
or $message->smtpsend( Host => $smtpmachine, Debug => 1 )
- or
die
"($perror) (customer # ". $self->custnum.
+ or
return
"($perror) (customer # ". $self->custnum.
") can't send card decline email to ".
join(', ', grep { $_ ne 'POST' } $cust_main->invoicing_list ).
" via server $smtpmachine with SMTP: $!";
") can't send card decline email to ".
join(', ', grep { $_ ne 'POST' } $cust_main->invoicing_list ).
" via server $smtpmachine with SMTP: $!";
@@
-722,8
+728,10
@@
sub batch_card {
'payname' => $cust_main->getfield('payname'),
'amount' => $self->owed,
} );
'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];
}
=item print_text [TIME];
@@
-944,7
+952,7
@@
sub print_text {
=head1 VERSION
=head1 VERSION
-$Id: cust_bill.pm,v 1.
28 2002-04-16 09:38:19
ivan Exp $
+$Id: cust_bill.pm,v 1.
38 2002-06-26 02:37:48
ivan Exp $
=head1 BUGS
=head1 BUGS