From b19266599870172bda0921df60020f0440854750 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 24 Aug 2006 01:37:19 +0000 Subject: [PATCH] oops, "Auto-apply to invoices" dropdown disappeared --- httemplate/edit/cust_credit.cgi | 70 +++++++++--------- httemplate/edit/cust_pay.cgi | 154 +++++++++++++++++++++------------------- 2 files changed, 114 insertions(+), 110 deletions(-) diff --git a/httemplate/edit/cust_credit.cgi b/httemplate/edit/cust_credit.cgi index c54fb8147..13d062c74 100755 --- a/httemplate/edit/cust_credit.cgi +++ b/httemplate/edit/cust_credit.cgi @@ -1,40 +1,10 @@ -% -% -%my $conf = new FS::Conf; -%my($custnum, $amount, $reason); -%if ( $cgi->param('error') ) { -% #$cust_credit = new FS::cust_credit ( { -% # map { $_, scalar($cgi->param($_)) } fields('cust_credit') -% #} ); -% $custnum = $cgi->param('custnum'); -% $amount = $cgi->param('amount'); -% #$refund = $cgi->param('refund'); -% $reason = $cgi->param('reason'); -%} else { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/; -% $custnum = $1; -% $amount = ''; -% #$refund = 'yes'; -% $reason = ''; -%} -%my $_date = time; -% -%my $otaker = getotaker; -% -%my $p1 = popurl(1); -% -% <% include('/elements/header-popup.html', 'Enter Credit') %> -% if ( $cgi->param('error') ) { +% if ( $cgi->param('error') ) { Error: <% $cgi->param('error') %>

% } - - -
@@ -44,7 +14,6 @@ Credit - <% ntable("#cccccc", 2) %> @@ -56,11 +25,11 @@ Credit Amount $ + % %#print qq! Also post refund!; % - Reason @@ -74,7 +43,38 @@ Credit
+
-
- + + + + +<%once> +my $conf = new FS::Conf; + + +<%init> +my($custnum, $amount, $reason); +if ( $cgi->param('error') ) { + #$cust_credit = new FS::cust_credit ( { + # map { $_, scalar($cgi->param($_)) } fields('cust_credit') + #} ); + $custnum = $cgi->param('custnum'); + $amount = $cgi->param('amount'); + #$refund = $cgi->param('refund'); + $reason = $cgi->param('reason'); +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + $custnum = $1; + $amount = ''; + #$refund = 'yes'; + $reason = ''; +} +my $_date = time; + +my $otaker = getotaker; + +my $p1 = popurl(1); + diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 83e4e82ea..855fbfcf1 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,61 +1,14 @@ -% -% -%my $conf = new FS::Conf; -% -%my %payby = ( -% 'BILL' => 'Check', -% 'CASH' => 'Cash', -% 'WEST' => 'Western Union', -% 'MCRD' => 'Manual credit card', -%); -% -%my($link, $linknum, $paid, $payby, $payinfo, $_date); -%if ( $cgi->param('error') ) { -% $link = $cgi->param('link'); -% $linknum = $cgi->param('linknum'); -% $paid = $cgi->param('paid'); -% $payby = $cgi->param('payby'); -% $payinfo = $cgi->param('payinfo'); -% $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; -%} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { -% $link = $cgi->param('popup') ? 'popup' : 'custnum'; -% $linknum = $1; -% $paid = ''; -% $payby = $cgi->param('payby') || 'BILL'; -% $payinfo = ''; -% $_date = time; -%} elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) { -% $link = 'invnum'; -% $linknum = $1; -% $paid = ''; -% $payby = $cgi->param('payby') || 'BILL'; -% $payinfo = ""; -% $_date = time; -%} else { -% die "illegal query ". $cgi->keywords; -%} -% -%my $paybatch = "webui-$_date-$$-". rand() * 2**32; -% -%my $title = 'Post '. $payby{$payby}. ' payment'; -%$title .= " against Invoice #$linknum" if $link eq 'invnum'; -% -%if ( $link eq 'popup' ) { -% -% -<% include('/elements/header-popup.html', $title ) %> +% if ( $link eq 'popup' ) { + <% include('/elements/header-popup.html', $title ) %> % } else { - - -<% include("/elements/header.html", $title, '') %> + <% include("/elements/header.html", $title, '') %> % } -% if ( $cgi->param('error') ) { -Error: <% $cgi->param('error') %> -

+% if ( $cgi->param('error') ) { + Error: <% $cgi->param('error') %> +

% } - @@ -64,28 +17,17 @@
-% -%my $money_char = $conf->config('money_char') || '$'; -%my $custnum; -%if ( $link eq 'invnum' ) { -% my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) -% or die "unknown invnum $linknum"; -% $custnum = $cust_bill->custnum; -%} elsif ( $link eq 'custnum' ) { -% $custnum = $linknum; -%} -% -% unless ( $link eq 'popup' ) { -<% small_custview($custnum, $conf->config('countrydefault')) %> +% unless ( $link eq 'popup' ) { + <% small_custview($custnum, $conf->config('countrydefault')) %> % } -

Payment <% ntable("#cccccc", 2) %> + Date @@ -93,6 +35,7 @@ Payment + + Amount <% $money_char %> by <% $payby{$payby} %> -% if ( $payby eq 'BILL' ) { - +% if ( $payby eq 'BILL' ) { Check # % } - -% if ( $link eq 'custnum' ) { +% if ( $link eq 'custnum' || $link eq 'popup' ) { Auto-apply
to invoices - + + + + % } elsif ( $link eq 'invnum' ) { Apply to Invoice #<% $linknum %> only -% } +% } @@ -136,6 +83,63 @@ Payment
-
- + + + + +<%once> +my $conf = new FS::Conf; + +my %payby = ( + 'BILL' => 'Check', + 'CASH' => 'Cash', + 'WEST' => 'Western Union', + 'MCRD' => 'Manual credit card', +); + +my $money_char = $conf->config('money_char') || '$'; + + +<%init> +my($link, $linknum, $paid, $payby, $payinfo, $_date); +if ( $cgi->param('error') ) { + $link = $cgi->param('link'); + $linknum = $cgi->param('linknum'); + $paid = $cgi->param('paid'); + $payby = $cgi->param('payby'); + $payinfo = $cgi->param('payinfo'); + $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; +} elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + $link = $cgi->param('popup') ? 'popup' : 'custnum'; + $linknum = $1; + $paid = ''; + $payby = $cgi->param('payby') || 'BILL'; + $payinfo = ''; + $_date = time; +} elsif ( $cgi->param('invnum') =~ /^(\d+)$/ ) { + $link = 'invnum'; + $linknum = $1; + $paid = ''; + $payby = $cgi->param('payby') || 'BILL'; + $payinfo = ""; + $_date = time; +} else { + die "illegal query ". $cgi->keywords; +} + +my $paybatch = "webui-$_date-$$-". rand() * 2**32; + +my $title = 'Post '. $payby{$payby}. ' payment'; +$title .= " against Invoice #$linknum" if $link eq 'invnum'; + +my $custnum; +if ( $link eq 'invnum' ) { + my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) + or die "unknown invnum $linknum"; + $custnum = $cust_bill->custnum; +} elsif ( $link eq 'custnum' ) { + $custnum = $linknum; +} + + -- 2.11.0