From c01c0065f9de3428af812638f6e3bb9e02fb725f Mon Sep 17 00:00:00 2001 From: Irina Todeva Date: Wed, 30 Sep 2015 14:37:18 -0600 Subject: When void / unvoid / apply / unapply is called stay on the same page (payment_history) Keep consistent void credits with other void methods (invoices, payments) regarding the method interface cust_credit->void cust_credit->void('reason string') cust_credit->void(FS::reason) --- httemplate/misc/unapply-cust_credit.cgi | 2 +- httemplate/misc/unapply-cust_pay.cgi | 2 +- httemplate/misc/unvoid-cust_pay_void.cgi | 2 +- httemplate/misc/void-cust_pay.cgi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/unapply-cust_credit.cgi b/httemplate/misc/unapply-cust_credit.cgi index ed739ac1b..aa1a3a9c2 100755 --- a/httemplate/misc/unapply-cust_credit.cgi +++ b/httemplate/misc/unapply-cust_credit.cgi @@ -1,4 +1,4 @@ -<% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %> +<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %> <%init> die "access denied" diff --git a/httemplate/misc/unapply-cust_pay.cgi b/httemplate/misc/unapply-cust_pay.cgi index b0343d034..34c1ecfd3 100755 --- a/httemplate/misc/unapply-cust_pay.cgi +++ b/httemplate/misc/unapply-cust_pay.cgi @@ -1,4 +1,4 @@ -<% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %> +<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %> <%init> die "access denied" diff --git a/httemplate/misc/unvoid-cust_pay_void.cgi b/httemplate/misc/unvoid-cust_pay_void.cgi index 4726ee576..84b7879fb 100755 --- a/httemplate/misc/unvoid-cust_pay_void.cgi +++ b/httemplate/misc/unvoid-cust_pay_void.cgi @@ -1,7 +1,7 @@ %if ( $error ) { % errorpage($error); %} else { -<% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %> +<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %> %} <%init> diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi index 31b7a6201..376fb5652 100755 --- a/httemplate/misc/void-cust_pay.cgi +++ b/httemplate/misc/void-cust_pay.cgi @@ -1,7 +1,7 @@ %if ( $error ) { % errorpage($error); %} else { -<% $cgi->redirect($p. "view/cust_main.cgi?". $custnum) %> +<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %> %} <%init> -- cgit v1.2.1 From b5d5f7680d0736ff0150b337cd29026135fb2e34 Mon Sep 17 00:00:00 2001 From: Irina Todeva Date: Thu, 8 Oct 2015 15:45:09 -0600 Subject: 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 --- httemplate/misc/process/void-cust_bill.html | 2 +- httemplate/misc/void-cust_bill.cgi | 46 ++++++++++++++++++ httemplate/misc/void-cust_credit.cgi | 74 +++++++++++++++++++++++++++++ httemplate/misc/void-cust_credit.html | 74 ----------------------------- httemplate/misc/void-cust_pay.cgi | 70 +++++++++++++++++++++++---- 5 files changed, 182 insertions(+), 84 deletions(-) create mode 100755 httemplate/misc/void-cust_bill.cgi create mode 100755 httemplate/misc/void-cust_credit.cgi delete mode 100755 httemplate/misc/void-cust_credit.html (limited to 'httemplate/misc') 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' &> + + +%} else { +<& /elements/header-popup.html, mt('Void credit') &> + +<& /elements/error.html &> + +

<% mt('Void this credit?') |h %> + +

+ + + +<& /elements/tr-select-reason.html, + 'field' => 'reasonnum', + 'reason_class' => 'X', + 'cgi' => $cgi +&> +
+ +
+

+ +         +" onClick="parent.cClick();"> + +

+ + + +%} +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Void credit'); + +#untaint crednum +my $crednum = $cgi->param('crednum'); +if ($crednum) { + $crednum =~ /^(\d+)$/ || die "Illegal crednum"; +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)/ || die "Illegal crednum"; + $crednum = $1; +} + +my $cust_credit = qsearchs('cust_credit',{'crednum'=>$crednum}) || die "Credit not found"; + +my $success = 0; +if ($cgi->param('confirm_void_credit')) { + + #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_credit->void($reason) unless $error; + } + + if ($error) { + $cgi->param('error',$error); + } else { + $success = 1; + } +} + + diff --git a/httemplate/misc/void-cust_credit.html b/httemplate/misc/void-cust_credit.html deleted file mode 100755 index 1e71f0030..000000000 --- a/httemplate/misc/void-cust_credit.html +++ /dev/null @@ -1,74 +0,0 @@ -%if ( $success ) { -<& /elements/header-popup.html, mt("Credit voided") &> - - - -%} else { -<& /elements/header-popup.html, mt('Void credit') &> - -<& /elements/error.html &> - -

<% mt('Void this credit?') |h %> - -

- - - -<& /elements/tr-select-reason.html, - 'field' => 'reasonnum', - 'reason_class' => 'X', - 'cgi' => $cgi -&> -
- -
-

- -         -" onClick="parent.cClick();"> - -

- - - -%} -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Void credit'); - -#untaint crednum -my $crednum = $cgi->param('crednum'); -if ($crednum) { - $crednum =~ /^(\d+)$/ || die "Illegal crednum"; -} else { - my($query) = $cgi->keywords; - $query =~ /^(\d+)/ || die "Illegal crednum"; - $crednum = $1; -} - -my $cust_credit = qsearchs('cust_credit',{'crednum'=>$crednum}) || die "Credit not found"; - -my $success = 0; -if ($cgi->param('confirm_void_credit')) { - - #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_credit->void($reason) unless $error; - } - - if ($error) { - $cgi->param('error',$error); - } else { - $success = 1; - } -} - - 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") &> + + + %} else { -<% $cgi->redirect($p. "view/cust_main.cgi?custnum=". $custnum. ";show=payment_history") %> +<& /elements/header-popup.html, mt('Void payment') &> + +<& /elements/error.html &> + +

<% mt('Void this payment?') |h %> + +

+ + + +<& /elements/tr-select-reason.html, + 'field' => 'reasonnum', + 'reason_class' => 'X', + 'cgi' => $cgi +&> +
+ +
+

+ +         +" onClick="parent.cClick();"> + +

+ + + %} <%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; + } +} -- cgit v1.2.1