From c82e10e2a7af8039962b3f2bd8df4050977c279c Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 4 Nov 2015 15:06:58 -0800 Subject: separate reason classes for voiding different transaction types, #38532 --- httemplate/misc/void-cust_bill.cgi | 2 +- httemplate/misc/void-cust_pay.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/void-cust_bill.cgi b/httemplate/misc/void-cust_bill.cgi index 213cf9566..e4e4705d7 100755 --- a/httemplate/misc/void-cust_bill.cgi +++ b/httemplate/misc/void-cust_bill.cgi @@ -14,7 +14,7 @@ <% ntable("#cccccc", 2) %> <& /elements/tr-select-reason.html, 'field' => 'reasonnum', - 'reason_class' => 'X', + 'reason_class' => 'I', 'cgi' => $cgi &> diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi index 784bb9a94..dc0ff4d35 100755 --- a/httemplate/misc/void-cust_pay.cgi +++ b/httemplate/misc/void-cust_pay.cgi @@ -18,7 +18,7 @@ <& /elements/tr-select-reason.html, 'field' => 'reasonnum', - 'reason_class' => 'X', + 'reason_class' => 'P', 'cgi' => $cgi &>
-- cgit v1.2.1 From 4f223dd481c3a9c7816bed964ff45171f9b5d014 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 4 Nov 2015 15:12:49 -0800 Subject: rename .cgi back to .html, #38532 --- httemplate/misc/process/void-cust_bill.html | 2 +- httemplate/misc/void-cust_bill.cgi | 46 ----------------- httemplate/misc/void-cust_bill.html | 9 ++-- httemplate/misc/void-cust_credit.cgi | 74 --------------------------- httemplate/misc/void-cust_credit.html | 74 +++++++++++++++++++++++++++ httemplate/misc/void-cust_pay.cgi | 78 ----------------------------- httemplate/misc/void-cust_pay.html | 78 +++++++++++++++++++++++++++++ 7 files changed, 158 insertions(+), 203 deletions(-) delete mode 100755 httemplate/misc/void-cust_bill.cgi mode change 100644 => 100755 httemplate/misc/void-cust_bill.html delete mode 100755 httemplate/misc/void-cust_credit.cgi create mode 100755 httemplate/misc/void-cust_credit.html delete mode 100755 httemplate/misc/void-cust_pay.cgi create mode 100755 httemplate/misc/void-cust_pay.html (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/void-cust_bill.html b/httemplate/misc/process/void-cust_bill.html index c0f432b70..7773b0ba9 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.cgi?". $cgi->query_string ) %> +<% $cgi->redirect(popurl(2). "void-cust_bill.html?". $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 new file mode 100755 index 000000000..1e71f0030 --- /dev/null +++ b/httemplate/misc/void-cust_credit.html @@ -0,0 +1,74 @@ +%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 deleted file mode 100755 index dc0ff4d35..000000000 --- a/httemplate/misc/void-cust_pay.cgi +++ /dev/null @@ -1,78 +0,0 @@ -%if ( $success ) { -<& /elements/header-popup.html, mt("Payment voided") &> - - - -%} else { -<& /elements/header-popup.html, mt('Void payment') &> - -<& /elements/error.html &> - -

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

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

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

- - - -%} -<%init> - -#untaint paynum -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}) || die "Payment not found"; - -my $right = 'Void payments'; -$right = 'Credit card void' if $cust_pay->payby eq 'CARD'; -$right = 'Echeck void' if $cust_pay->payby eq 'CHEK'; - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right($right); - -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; - } - - if ($error) { - $cgi->param('error',$error); - } else { - $success = 1; - } -} - - diff --git a/httemplate/misc/void-cust_pay.html b/httemplate/misc/void-cust_pay.html new file mode 100755 index 000000000..205d93aa3 --- /dev/null +++ b/httemplate/misc/void-cust_pay.html @@ -0,0 +1,78 @@ +%if ( $success ) { +<& /elements/header-popup.html, mt("Payment voided") &> + + + +%} else { +<& /elements/header-popup.html, mt('Void payment') &> + +<& /elements/error.html &> + +

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

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

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

+ + + +%} +<%init> + +#untaint paynum +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}) || die "Payment not found"; + +my $right = 'Void payments'; +$right = 'Credit card void' if $cust_pay->payby eq 'CARD'; +$right = 'Echeck void' if $cust_pay->payby eq 'CHEK'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right($right); + +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; + } + + if ($error) { + $cgi->param('error',$error); + } else { + $success = 1; + } +} + + -- cgit v1.2.1