X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=48315199ab7a64f5fcf36f3d32a210e3b179181f;hb=a7ac7ab3af0dd4f9773aec7c59515fefc8eaedec;hp=a682c595881f3dfbaab321c4698593c73149869e;hpb=789c34c5251f4b831a7cb27bd2a9af700ccf2ced;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index a682c5958..48315199a 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -7,6 +7,7 @@ use vars qw( $xaction $E_NoErr ); use vars qw( $bop_processor $bop_login $bop_password $bop_action @bop_options ); use vars qw( $ach_processor $ach_login $ach_password $ach_action @ach_options ); use vars qw( $invoice_lines @buf ); #yuck +use vars qw( $quiet ); use Date::Format; use Mail::Internet 1.44; use Mail::Header; @@ -627,7 +628,7 @@ for supported processors. sub realtime_ach { my $self = shift; $self->realtime_bop( - 'CHECK', + 'ECHECK', $ach_processor, $ach_login, $ach_password, @@ -646,7 +647,7 @@ for supported processors. =cut -sub realtime_ach { +sub realtime_lec { my $self = shift; $self->realtime_bop( 'LEC', @@ -668,7 +669,7 @@ sub realtime_bop { $address .= ", ". $cust_main->address2 if $cust_main->address2; my($payname, $payfirst, $paylast); - if ( $cust_main->payname && $method ne 'CHECK' ) { + if ( $cust_main->payname && $method ne 'ECHECK' ) { $payname = $cust_main->payname; $payname =~ /^\s*([\w \,\.\-\']*)?\s+([\w\,\.\-\']+)\s*$/ or do { @@ -712,7 +713,7 @@ sub realtime_bop { $content{card_number} = $cust_main->payinfo; $cust_main->paydate =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/; $content{expiration} = "$2/$1"; - } elsif ( $method eq 'CHECK' ) { + } elsif ( $method eq 'ECHECK' ) { my($account_number,$routing_code) = $cust_main->payinfo; ( $content{account_number}, $content{routing_code} ) = split('@', $cust_main->payinfo); @@ -793,9 +794,9 @@ sub realtime_bop { if ( $transaction->is_success() ) { my %method2payby = ( - 'CC' => 'CARD', - 'CHECK' => 'CHEK', - 'LEC' => 'LECB', + 'CC' => 'CARD', + 'ECHECK' => 'CHEK', + 'LEC' => 'LECB', ); my $cust_pay = new FS::cust_pay ( { @@ -823,7 +824,7 @@ sub realtime_bop { my $perror = "$processor error, invnum #". $self->invnum. ': '. $transaction->result_code. ": ". $transaction->error_message; - if ( $conf->exists('emaildecline') + if ( !$quiet && $conf->exists('emaildecline') && grep { $_ ne 'POST' } $cust_main->invoicing_list ) { my @templ = $conf->config('declinetemplate'); @@ -1032,9 +1033,9 @@ sub print_text { or die "cannot load config file $templatefile"; $invoice_lines = 0; my $wasfunc = 0; - foreach ( grep /invoice_lines\(\d+\)/, @invoice_template ) { #kludgy - /invoice_lines\((\d+)\)/; - $invoice_lines += $1; + foreach ( grep /invoice_lines\(\d*\)/, @invoice_template ) { #kludgy + /invoice_lines\((\d*)\)/; + $invoice_lines += $1 || scalar(@buf); $wasfunc=1; } die "no invoice_lines() functions in template?" unless $wasfunc; @@ -1092,16 +1093,14 @@ sub print_text { # ); #and subroutine for the template - sub FS::cust_bill::_template::invoice_lines { - my $lines = shift or return @buf; + my $lines = shift || scalar(@buf); map { scalar(@buf) ? shift @buf : [ '', '' ]; } ( 1 .. $lines ); } - #and fill it in $FS::cust_bill::_template::page = 1; my $lines; @@ -1121,7 +1120,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.52 2002-11-19 09:51:58 ivan Exp $ +$Id: cust_bill.pm,v 1.58 2002-12-23 14:22:48 steve Exp $ =head1 BUGS