From cccd0b7cd38a88c131e19981be38434f87abe194 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 21 Oct 2005 15:21:37 +0000 Subject: add CASH and WEST payment types (payments only, not cust_main.payby) --- httemplate/edit/cust_main.cgi | 5 +++- httemplate/edit/cust_main/billing.html | 54 ++++++++++++++++++++++++++++++++-- httemplate/edit/cust_pay.cgi | 46 +++++++++++++++++------------ httemplate/edit/process/cust_main.cgi | 3 ++ 4 files changed, 86 insertions(+), 22 deletions(-) (limited to 'httemplate/edit') 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' ) { '', + 'CASH' => + + ''. + + qq!!. + qq!!. + + ''. + ''. + ''. + ''. + ''. + ''. + + '
${r}Amount
 
 
 
 
 
 
', + + 'WEST' => + + ''. + + qq!!. + qq!!. + + ''. + ''. + ''. + ''. + ''. + ''. + + '
${r}Amount
 
 
 
 
 
 
', + ); - 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 @@ - <% 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 Amount <%= $money_char %> - - - - Check # - + by <%= $payby{$payby} %> +<% if ( $payby eq 'BILL' ) { %> + + + Check # + + + +<% } %> + <% if ( $link eq 'custnum' ) { %> Auto-apply
to invoices 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 = ''; -- cgit v1.2.1