diff options
author | Irina Todeva <itodeva@hostgator.com> | 2015-10-08 15:45:09 -0600 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-11-03 12:28:14 -0800 |
commit | b5d5f7680d0736ff0150b337cd29026135fb2e34 (patch) | |
tree | 9b1f5b78b47e7ff5d94015378930be23debe91d9 /httemplate/misc | |
parent | 1ef811033e1ea791388c7c8d15a3a5a720b1f37f (diff) |
Changes for being consistent in the payment history GUI on void credit /
payment / invoice links
renamed httemplate/misc/void-cust_credit.html to .cgi
renamed httemplate/misc/void-cust_bill.html to .cgi
Diffstat (limited to 'httemplate/misc')
-rwxr-xr-x | httemplate/misc/process/void-cust_bill.html | 2 | ||||
-rwxr-xr-x | httemplate/misc/void-cust_bill.cgi | 46 | ||||
-rwxr-xr-x | httemplate/misc/void-cust_credit.cgi (renamed from httemplate/misc/void-cust_credit.html) | 2 | ||||
-rwxr-xr-x | httemplate/misc/void-cust_pay.cgi | 70 |
4 files changed, 109 insertions, 11 deletions
diff --git a/httemplate/misc/process/void-cust_bill.html b/httemplate/misc/process/void-cust_bill.html index 7773b0ba9..c0f432b70 100755 --- a/httemplate/misc/process/void-cust_bill.html +++ b/httemplate/misc/process/void-cust_bill.html @@ -1,6 +1,6 @@ %if ( $error ) { % $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "void-cust_bill.html?". $cgi->query_string ) %> +<% $cgi->redirect(popurl(2). "void-cust_bill.cgi?". $cgi->query_string ) %> %} else { <& /elements/header-popup.html, 'Invoice voided' &> <SCRIPT TYPE="text/javascript"> diff --git a/httemplate/misc/void-cust_bill.cgi b/httemplate/misc/void-cust_bill.cgi new file mode 100755 index 000000000..213cf9566 --- /dev/null +++ b/httemplate/misc/void-cust_bill.cgi @@ -0,0 +1,46 @@ +<& /elements/header-popup.html, mt('Void invoice') &> + +<% include('/elements/error.html') %> + +<% emt('Are you sure you want to void this invoice?') %> +<BR><BR> + +<% emt("Invoice #[_1] ([_2])",$cust_bill->display_invnum, $money_char. $cust_bill->owed) %> +<BR><BR> + +<FORM METHOD="POST" ACTION="process/void-cust_bill.html"> +<INPUT TYPE="hidden" NAME="invnum" VALUE="<% $invnum %>"> + +<% ntable("#cccccc", 2) %> +<& /elements/tr-select-reason.html, + 'field' => 'reasonnum', + 'reason_class' => 'X', + 'cgi' => $cgi +&> + +</TABLE> + +<BR> +<CENTER> +<BUTTON TYPE="submit">Yes, void invoice</BUTTON> \ +<BUTTON TYPE="button" onClick="parent.cClick();">No, do not void invoice</BUTTON> +</CENTER> + +</FORM> +</BODY> +</HTML> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Void invoices'); + +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + +#untaint invnum +$cgi->param('invnum') =~ /^(\d+)$/ || die "Illegal invnum"; +my $invnum = $1; + +my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); + +</%init> diff --git a/httemplate/misc/void-cust_credit.html b/httemplate/misc/void-cust_credit.cgi index 1e71f0030..f352e6090 100755 --- a/httemplate/misc/void-cust_credit.html +++ b/httemplate/misc/void-cust_credit.cgi @@ -12,7 +12,7 @@ <P ALIGN="center"><B><% mt('Void this credit?') |h %></B> -<FORM action="<% ${p} %>misc/void-cust_credit.html"> +<FORM action="<% ${p} %>misc/void-cust_credit.cgi"> <INPUT TYPE="hidden" NAME="crednum" VALUE="<% $crednum %>"> <TABLE BGCOLOR="#cccccc" BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto"> diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi index 376fb5652..784bb9a94 100755 --- a/httemplate/misc/void-cust_pay.cgi +++ b/httemplate/misc/void-cust_pay.cgi @@ -1,16 +1,52 @@ -%if ( $error ) { -% errorpage($error); +%if ( $success ) { +<& /elements/header-popup.html, mt("Payment voided") &> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + </BODY> +</HTML> %} else { -<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %> +<& /elements/header-popup.html, mt('Void payment') &> + +<& /elements/error.html &> + +<P ALIGN="center"><B><% mt('Void this payment?') |h %></B> + +<FORM action="<% ${p} %>misc/void-cust_pay.cgi"> +<INPUT TYPE="hidden" NAME="paynum" VALUE="<% $paynum %>"> + +<TABLE BGCOLOR="#cccccc" BORDER="0" CELLSPACING="2" STYLE="margin-left:auto; margin-right:auto"> +<& /elements/tr-select-reason.html, + 'field' => 'reasonnum', + 'reason_class' => 'X', + 'cgi' => $cgi +&> +</TABLE> + +<BR> +<P ALIGN="CENTER"> +<INPUT TYPE="submit" NAME="confirm_void_payment" VALUE="<% mt('Void payment') |h %>"> + +<INPUT TYPE="BUTTON" VALUE="<% mt("Don't void payment") |h %>" onClick="parent.cClick();"> + +</FORM> +</BODY> +</HTML> + %} <%init> #untaint paynum -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/ || die "Illegal paynum"; -my $paynum = $1; +my $paynum = $cgi->param('paynum'); +if ($paynum) { + $paynum =~ /^(\d+)$/ || die "Illegal paynum"; +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)/ || die "Illegal paynum"; + $paynum = $1; +} -my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum}); +my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum}) || die "Payment not found"; my $right = 'Void payments'; $right = 'Credit card void' if $cust_pay->payby eq 'CARD'; @@ -19,8 +55,24 @@ $right = 'Echeck void' if $cust_pay->payby eq 'CHEK'; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right($right); -my $custnum = $cust_pay->custnum; +my $success = 0; +if ($cgi->param('confirm_void_payment')) { + + #untaint reasonnum / create new reason + my ($reasonnum, $error) = $m->comp('process/elements/reason'); + if (!$reasonnum) { + $error = 'Reason required'; + } else { + my $reason = qsearchs('reason', { 'reasonnum' => $reasonnum }) + || die "Reason num $reasonnum not found in database"; + $error = $cust_pay->void($reason) unless $error; + } -my $error = $cust_pay->void; + if ($error) { + $cgi->param('error',$error); + } else { + $success = 1; + } +} </%init> |