diff options
-rw-r--r-- | FS/FS/Conf.pm | 10 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 51 | ||||
-rw-r--r-- | FS/FS/cust_pay.pm | 6 | ||||
-rw-r--r-- | FS/FS/cust_pay_void.pm | 6 | ||||
-rw-r--r-- | FS/FS/cust_refund.pm | 6 | ||||
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 5 | ||||
-rw-r--r-- | httemplate/edit/cust_main/billing.html | 54 | ||||
-rwxr-xr-x | httemplate/edit/cust_pay.cgi | 46 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main.cgi | 3 | ||||
-rwxr-xr-x | httemplate/search/cust_pay.cgi | 43 | ||||
-rw-r--r-- | httemplate/search/report_cust_pay.html | 6 | ||||
-rwxr-xr-x | httemplate/view/cust_bill.cgi | 40 | ||||
-rw-r--r-- | httemplate/view/cust_main/payment_history.html | 56 |
13 files changed, 285 insertions, 47 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 7ba0f35be..4edcb99c7 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1294,11 +1294,19 @@ httemplate/docs/config.html }, { + 'key' => 'payby', + 'section' => 'billing', + 'description' => 'Available payment types.', + 'type' => 'selectmultiple', + 'select_enum' => [ qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP) ], + }, + + { 'key' => 'payby-default', 'section' => 'UI', 'description' => 'Default payment type. HIDE disables display of billing information and sets customers to BILL.', 'type' => 'select', - 'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL COMP HIDE) ], + 'select_enum' => [ '', qw(CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP HIDE) ], }, { diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index b85dff4a5..d131af974 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -360,6 +360,7 @@ sub insert { my $prepay_identifier = ''; my( $amount, $seconds ) = ( 0, 0 ); + my $payby = ''; if ( $self->payby eq 'PREPAY' ) { $self->payby('BILL'); @@ -373,6 +374,14 @@ sub insert { return $error; } + $payby = 'PREP' if $amount; + + } elsif ( $self->payby =~ /^(CASH|WEST)$/ ) { + + $payby = $1; + $self->payby('BILL'); + $amount = $self->paid; + } my $error = $self->SUPER::insert; @@ -405,13 +414,15 @@ sub insert { } if ( $amount ) { - $error = $self->insert_cust_pay_prepay($amount, $prepay_identifier); + $error = $self->insert_cust_pay($payby, $amount, $prepay_identifier); if ( $error ) { $dbh->rollback if $oldAutoCommit; - return "inserting prepayment (transaction rolled back): $error"; + return "inserting payment (transaction rolled back): $error"; } } + + unless ( $import || $skip_fuzzyfiles ) { $error = $self->queue_fuzzyfiles_update; if ( $error ) { @@ -691,14 +702,42 @@ If there is an error, returns the error, otherwise returns false. =cut sub insert_cust_pay_prepay { - my( $self, $amount ) = splice(@_, 0, 2); + shift->insert_cust_pay('PREP', @_); +} + +=item insert_cust_pay_cash AMOUNT [ PAYINFO ] + +Inserts a cash payment in the specified amount for this customer. An optional +second argument can specify the payment identifier for tracking purposes. +If there is an error, returns the error, otherwise returns false. + +=cut + +sub insert_cust_pay_cash { + shift->insert_cust_pay('CASH', @_); +} + +=item insert_cust_pay_prepay AMOUNT [ PAYINFO ] + +Inserts a Western Union payment in the specified amount for this customer. An +optional second argument can specify the prepayment identifier for tracking +purposes. If there is an error, returns the error, otherwise returns false. + +=cut + +sub insert_cust_pay_west { + shift->insert_cust_pay('WEST', @_); +} + +sub insert_cust_pay { + my( $self, $payby, $amount ) = splice(@_, 0, 3); my $payinfo = scalar(@_) ? shift : ''; my $cust_pay = new FS::cust_pay { 'custnum' => $self->custnum, 'paid' => sprintf('%.2f', $amount), #'_date' => #date the prepaid card was purchased??? - 'payby' => 'PREP', + 'payby' => $payby, 'payinfo' => $payinfo, }; $cust_pay->insert; @@ -1105,7 +1144,7 @@ sub check { } } - $self->payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP|PREPAY)$/ + $self->payby =~ /^(CARD|DCRD|CHEK|DCHK|LECB|BILL|COMP|PREPAY|CASH|WEST)$/ or return "Illegal payby: ". $self->payby; $error = $self->ut_numbern('paystart_month') @@ -1242,7 +1281,7 @@ sub check { if ( $self->paydate eq '' || $self->paydate eq '-' ) { return "Expriation date required" - unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB)$/; + unless $self->payby =~ /^(BILL|PREPAY|CHEK|LECB|CASH|WEST)$/; $self->paydate(''); } else { my( $m, $y ); diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index a7d69901f..3772473bc 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -61,7 +61,8 @@ currently supported: L<Time::Local> and L<Date::Parse> for conversion functions. =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH), -`LECB' (phone bill billing), `BILL' (billing), or `COMP' (free) +`LECB' (phone bill billing), `BILL' (billing), `PREP` (prepaid card), +`CASH' (cash), `WEST' (Western Union) or `COMP' (free) =item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively @@ -373,7 +374,8 @@ sub check { $self->_date(time) unless $self->_date; - $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP)$/ or return "Illegal payby"; + $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP|CASH|WEST)$/ + or return "Illegal payby"; $self->payby($1); #false laziness with cust_refund::check diff --git a/FS/FS/cust_pay_void.pm b/FS/FS/cust_pay_void.pm index 7267929c8..6437163ad 100644 --- a/FS/FS/cust_pay_void.pm +++ b/FS/FS/cust_pay_void.pm @@ -47,7 +47,8 @@ are currently supported: L<Time::Local> and L<Date::Parse> for conversion functions. =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH), -`LECB' (phone bill billing), `BILL' (billing), or `COMP' (free) +`LECB' (phone bill billing), `BILL' (billing), `CASH' (cash), +`WEST' (Western Union) or `COMP' (free) =item payinfo - card number, check #, or comp issuer (4-8 lowercase alphanumerics; think username), respectively @@ -128,7 +129,8 @@ sub check { $self->void_date(time) unless $self->void_date; - $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby"; + $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|PREP|CASH|WEST)$/ + or return "Illegal payby"; $self->payby($1); #false laziness with cust_refund::check diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm index 106ccd3c3..48cc7cc7a 100644 --- a/FS/FS/cust_refund.pm +++ b/FS/FS/cust_refund.pm @@ -51,7 +51,8 @@ inherits from FS::Record. The following fields are currently supported: L<Time::Local> and L<Date::Parse> for conversion functions. =item payby - `CARD' (credit cards), `CHEK' (electronic check/ACH), -`LECB' (Phone bill billing), `BILL' (billing), or `COMP' (free) +`LECB' (Phone bill billing), `BILL' (billing), `CASH' (cash), +`WEST' (Western Union), or `COMP' (free) =item payinfo - card number, P.O.#, or comp issuer (4-8 lowercase alphanumerics; think username) @@ -211,7 +212,8 @@ sub check { unless $self->crednum || qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); - $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP)$/ or return "Illegal payby"; + $self->payby =~ /^(CARD|CHEK|LECB|BILL|COMP|CASH|WEST)$/ + or return "Illegal payby"; $self->payby($1); #false laziness with cust_pay::check diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index bfd396881..e10c85f01 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -35,6 +35,7 @@ if ( $cgi->param('error') ) { $popnum = $cgi->param('popnum'); @invoicing_list = split( /\s*,\s*/, $cgi->param('invoicing_list') ); $same = $cgi->param('same'); + $cust_main->setfield('paid' => $cgi->param('paid')) if $cgi->param('paid'); } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; @@ -261,7 +262,8 @@ function bottomfixup(what) { 'payinfo', 'payinfo1', 'payinfo2', 'payname', 'exp_month', 'exp_year', 'paycvv', 'paystart_month', 'paystart_year', 'payissue', - 'payip' + 'payip', + 'paid' ); var billing_bottomvars = new Array( @@ -340,6 +342,7 @@ function copyelement(from, to) { 'payname', 'exp_month', 'exp_year', 'paycvv', 'paystart_month', 'paystart_year', 'payissue', 'payip', + 'paid', 'tax', 'invoicing_list', 'invoicing_list_POST', 'invoicing_list_FAX' diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 17b1b0cc9..caac3a956 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -4,6 +4,11 @@ my( $cust_main ) = @_; my $conf = new FS::Conf; my $payby_default = $conf->config('payby-default'); +my @payby = $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless grep /\w/, @payby; + if ( $payby_default eq 'HIDE' ) { $cust_main->payby('BILL') unless $cust_main->payby; @@ -294,15 +299,60 @@ if ( $payby_default eq 'HIDE' ) { '</TABLE>', + 'CASH' => + + '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. + + qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. + qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!. + + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + + '</TABLE>', + + 'WEST' => + + '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'. + + qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!. + qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!. + + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + '<TR><TD> </TD></TR>'. + + '</TABLE>', + ); - tie my %options, 'Tie::IxHash', + + my %allopt = ( 'CARD' => 'Credit card', 'CHEK' => 'Electronic check', 'LECB' => 'Phone bill billing', 'BILL' => 'Billing', + 'CASH' => 'Cash', # initial payment, then billing', + 'WEST' => 'Western Union', # initial payment, then billing', 'COMP' => 'Complimentary', - ; + ); + if ( $cust_main->custnum ) { #don't offer CASH and WEST initial payment types + # when editing customer + delete $allopt{$_} for qw(CASH WEST); + } + + tie my %options, 'Tie::IxHash', + map { $_ => $allopt{$_} } + grep { exists $allopt{$_} } + @payby; + my %payby2option = ( ( map { $_ => $_ } keys %options ), 'DCRD' => 'CARD', diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index c0a679b03..b2f3f55ff 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,8 +1,13 @@ -<!-- mason kludge --> <% my $conf = new FS::Conf; +my %payby = ( + 'BILL' => 'Check', + 'CASH' => 'Cash', + 'WEST' => 'Western Union', +); + my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date); if ( $cgi->param('error') ) { $link = $cgi->param('link'); @@ -12,31 +17,29 @@ if ( $cgi->param('error') ) { $payinfo = $cgi->param('payinfo'); $quickpay = $cgi->param('quickpay'); $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; -} elsif ($cgi->keywords) { - my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $link = 'invnum'; - $linknum = $1; - $paid = ''; - $payby = 'BILL'; - $payinfo = ""; - $quickpay = ''; - $_date = time; -} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { +} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { $link = 'custnum'; $linknum = $1; $paid = ''; - $payby = 'BILL'; + $payby = $cgi->param('payby') || 'BILL'; $payinfo = ''; $quickpay = $cgi->param('quickpay'); $_date = time; +} elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) { + $link = 'invnum'; + $linknum = $1; + $paid = ''; + $payby = $cgi->param('payby') || 'BILL'; + $payinfo = ""; + $quickpay = ''; + $_date = time; } else { die "illegal query ". $cgi->keywords; } my $paybatch = "webui-$_date-$$-". rand() * 2**32; -my $title = 'Post payment'; +my $title = 'Post '. $payby{$payby}. ' payment'; $title .= " against Invoice #$linknum" if $link eq 'invnum'; %> @@ -97,13 +100,18 @@ Payment <TR> <TD ALIGN="right">Amount</TD> <TD BGCOLOR="#ffffff" ALIGN="right"><%= $money_char %></TD> - <TD><INPUT TYPE="text" NAME="paid" VALUE="<%= $paid %>" SIZE=8 MAXLENGTH=8></TD> -</TR> -<TR> - <TD ALIGN="right">Check #</TD> - <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<%= $payinfo %>" SIZE=10></TD> + <TD><INPUT TYPE="text" NAME="paid" VALUE="<%= $paid %>" SIZE=8 MAXLENGTH=8> by <B><%= $payby{$payby} %></B></TD> </TR> +<% if ( $payby eq 'BILL' ) { %> + + <TR> + <TD ALIGN="right">Check #</TD> + <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<%= $payinfo %>" SIZE=10></TD> + </TR> + +<% } %> + <TR> <% if ( $link eq 'custnum' ) { %> <TD ALIGN="right">Auto-apply<BR>to invoices</TD> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 85dbb9775..d77aa2fdd 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -55,6 +55,9 @@ if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { ); } +$new->setfield('paid', $cgi->param('paid') ) + if $cgi->param('paid'); + #perhaps this stuff should go to cust_main.pm my $cust_pkg = ''; my $svc_acct = ''; diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index 89da7426a..2106a649a 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -16,14 +16,27 @@ } if ( $cgi->param('payby') ) { - $cgi->param('payby') =~ /^(CARD|CHEK|BILL)(-(VisaMC|Amex|Discover))?$/ - or die "illegal payby ". $cgi->param('payby'); + $cgi->param('payby') =~ + /^(CARD|CHEK|BILL|PREP|CASH|WEST)(-(VisaMC|Amex|Discover|Maestro))?$/ + or die "illegal payby ". $cgi->param('payby'); push @search, "cust_pay.payby = '$1'"; if ( $3 ) { if ( $3 eq 'VisaMC' ) { #avoid posix regexes for portability push @search, - " ( substring(cust_pay.payinfo from 1 for 1) = '4' ". + " ( ( substring(cust_pay.payinfo from 1 for 1) = '4' ". + " AND substring(cust_pay.payinfo from 1 for 4) != '4936' ". + " AND substring(cust_pay.payinfo from 1 for 6) ". + " NOT SIMILAR TO '49030[2-9]' ". + " AND substring(cust_pay.payinfo from 1 for 6) ". + " NOT SIMILAR TO '49033[5-9]' ". + " AND substring(cust_pay.payinfo from 1 for 6) ". + " NOT SIMILAR TO '49110[1-2]' ". + " AND substring(cust_pay.payinfo from 1 for 6) ". + " NOT SIMILAR TO '49117[4-9]' ". + " AND substring(cust_pay.payinfo from 1 for 6) ". + " NOT SIMILAR TO '49118[1-2]' ". + " )". " OR substring(cust_pay.payinfo from 1 for 2) = '51' ". " OR substring(cust_pay.payinfo from 1 for 2) = '52' ". " OR substring(cust_pay.payinfo from 1 for 2) = '53' ". @@ -38,7 +51,25 @@ " ) "; } elsif ( $3 eq 'Discover' ) { push @search, - " substring(cust_pay.payinfo from 1 for 4 ) = '6011' "; + " substring(cust_pay.payinfo from 1 for 4 ) = '6011' ". + " OR substring(cust_pay.payinfo from 1 for 3 ) = '650' "; + } elsif ( $3 eq 'Maestro' ) { + push @search, + " ( substring(cust_pay.payinfo from 1 for 2 ) = '63' ". + ' OR substring(cust_pay.payinfo from 1 for 2 ) = '67' ". + ' OR substring(cust_pay.payinfo from 1 for 6 ) = '564182' ". + " OR substring(cust_pay.payinfo from 1 for 4 ) = '4936' ". + " OR substring(cust_pay.payinfo from 1 for 6 ) ". + " SIMILAR TO '49030[2-9]' ". + " OR substring(cust_pay.payinfo from 1 for 6 ) ". + " SIMILAR TO '49033[5-9]' ". + " OR substring(cust_pay.payinfo from 1 for 6 ) ". + " SIMILAR TO '49110[1-2]' ". + " OR substring(cust_pay.payinfo from 1 for 6 ) ". + " SIMILAR TO '49117[4-9]' ". + " OR substring(cust_pay.payinfo from 1 for 6 ) ". + " SIMILAR TO '49118[1-2]' ". + " ) "; } else { die "unknown card type $3"; } @@ -134,6 +165,10 @@ 'Check #'. $cust_pay->payinfo; } elsif ( $cust_pay->payby eq 'PREP' ) { 'Prepaid card #'. $cust_pay->payinfo; + } elsif ( $cust_pay->payby eq 'CASH' ) { + 'Cash '. $cust_pay->payinfo; + } elsif ( $cust_pay->payby eq 'WEST' ) { + 'Western Union'; #. $cust_pay->payinfo; } else { $cust_pay->payby. ' '. $cust_pay->payinfo; } diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html index 8b9e27302..18501d5b5 100644 --- a/httemplate/search/report_cust_pay.html +++ b/httemplate/search/report_cust_pay.html @@ -19,8 +19,12 @@ <OPTION VALUE="CARD-VisaMC">credit card (Visa/MasterCard)</OPTION> <OPTION VALUE="CARD-Amex">credit card (American Express)</OPTION> <OPTION VALUE="CARD-Discover">credit card (Discover)</OPTION> + <OPTION VALUE="CARD-Maestro">credit card (Maestro/Switch/Solo)</OPTION> <OPTION VALUE="CHEK">electronic check / ACH</OPTION> - <OPTION VALUE="BILL">check / cash</OPTION> + <OPTION VALUE="BILL">check</OPTION> + <OPTION VALUE="PREP">prepaid card</OPTION> + <OPTION VALUE="CASH">cash</OPTION> + <OPTION VALUE="WEST">Western Union</OPTION> </SELECT> </TD> </TR> diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index d149cf172..8dcbd3a35 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -8,6 +8,12 @@ my $invnum = $3; my $conf = new FS::Conf; +my @payby = $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless grep /\w/, @payby; +my %payby = map { $_=>1 } @payby; + my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Invoice #$invnum not found!" unless $cust_bill; my $custnum = $cust_bill->getfield('custnum'); @@ -22,8 +28,38 @@ my $link = $templatename ? "$templatename-$invnum" : $invnum; "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", )) %> -<% if ( $cust_bill->owed > 0 ) { %> - <A HREF="<%= $p %>edit/cust_pay.cgi?<%= $invnum %>">Enter payments (check/cash) against this invoice</A> | +<% if ( $cust_bill->owed > 0 + && ( $payby{'BILL'} || $payby{'CASH'} || $payby{'WEST'} ) + ) + { + my $s = 0; +%> + + Post + + <% if ( $payby{'BILL'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>edit/cust_pay.cgi?payby=BILL;invnum=<%= $invnum %>">check</A> + + <% } %> + + <% if ( $payby{'CASH'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>edit/cust_pay.cgi?payby=CASH;invnum=<%= $invnum %>">cash</A> + + <% } %> + + <% if ( $payby{'WEST'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>edit/cust_pay.cgi?payby=WEST;invnum=<%= $invnum %>">Western Union</A> + + <% } %> + + payment against this invoice<BR> + <% } %> <A HREF="<%= $p %>misc/print-invoice.cgi?<%= $link %>">Re-print this invoice</A> diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 6c475c5f2..e58b6248e 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,13 +1,56 @@ <% my( $cust_main ) = @_; - my $conf = new FS::Conf; my $custnum = $cust_main->custnum; + + my $conf = new FS::Conf; + + my @payby = $conf->config('payby'); + #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) + @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless grep /\w/, @payby; + my %payby = map { $_=>1 } @payby; + + my $s = 0; + %> <BR><BR><A NAME="history"><FONT SIZE="+2">Payment History</FONT></A><BR> -<A HREF="<%= $p %>edit/cust_pay.cgi?custnum=<%= $custnum %>">Post cash/check payment</A> -| <A HREF="<%= $p %>misc/payment.cgi?payby=CARD;custnum=<%= $custnum %>">Process credit card payment</A> -| <A HREF="<%= $p %>misc/payment.cgi?payby=CHEK;custnum=<%= $custnum %>">Process electronic check (ACH) payment</A> + +<% if ( $payby{'BILL'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>edit/cust_pay.cgi?payby=BILL;custnum=<%= $custnum %>">Post check payment</A> + +<% } %> + +<% if ( $payby{'CASH'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>edit/cust_pay.cgi?payby=CASH;custnum=<%= $custnum %>">Post cash payment</A> + +<% } %> + +<% if ( $payby{'WEST'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>edit/cust_pay.cgi?payby=WEST;custnum=<%= $custnum %>">Post Western Union payment</A> + +<% } %> + +<% if ( $payby{'CARD'} || $payby{'DCRD'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>misc/payment.cgi?payby=CARD;custnum=<%= $custnum %>">Process credit card payment</A> + +<% } %> + +<% if ( $payby{'CHEK'} || $payby{'DCHK'} ) { %> + + <%= $s++ ? ' | ' : '' %> + <A HREF="<%= $p %>misc/payment.cgi?payby=CHEK;custnum=<%= $custnum %>">Process electronic check (ACH) payment</A> + +<% } %> + <BR><A HREF="<%= $p %>edit/cust_credit.cgi?<%= $custnum %>">Post credit</A> <BR> @@ -51,8 +94,11 @@ foreach my $cust_pay ($cust_main->cust_pay) { $payby =~ s/^BILL$/Check #/ if $payinfo; $payby =~ s/^CHEK$/Electronic check /; $payby =~ s/^PREP$/Prepaid card /; + $payby =~ s/^CARD$/Credit card #/; + $payby =~ s/^COMP$/Complimentary by /; + $payby =~ s/^CASH$/Cash/; + $payby =~ s/^WEST$/Western Union/; $payby =~ s/^BILL$//; - $payby =~ s/^(CARD|COMP)$/$1 /; my $info = $payby ? " ($payby$payinfo)" : ''; my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' ); |