summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-08-01 14:01:14 -0700
committerIvan Kohler <ivan@freeside.biz>2012-08-01 14:01:14 -0700
commitbec3b6c2bf97d66b992866d7ee7295f1f05452e6 (patch)
tree78fb0c2523f237ad06905fe099dc5d32330a0e6e /httemplate
parent55675d6cdd93f00b7c0ac93403e8c4d66567a729 (diff)
invoice voiding, RT#18677
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/misc/process/void-cust_bill.html6
-rwxr-xr-xhttemplate/misc/unvoid-cust_bill_void.html25
-rwxr-xr-xhttemplate/misc/unvoid-cust_pay_void.cgi2
-rwxr-xr-xhttemplate/misc/void-cust_pay.cgi2
-rw-r--r--httemplate/view/cust_main/payment_history/payment.html2
-rw-r--r--httemplate/view/cust_main/payment_history/voided_invoice.html8
-rw-r--r--httemplate/view/cust_main/payment_history/voided_payment.html2
7 files changed, 41 insertions, 6 deletions
diff --git a/httemplate/misc/process/void-cust_bill.html b/httemplate/misc/process/void-cust_bill.html
index f2930ec01..899901a50 100755
--- a/httemplate/misc/process/void-cust_bill.html
+++ b/httemplate/misc/process/void-cust_bill.html
@@ -2,7 +2,11 @@
% $cgi->param('error', $error);
<% $cgi->redirect(popurl(1). "void-cust_bill.html?". $cgi->query_string ) %>
%} else {
-<% $cgi->redirect(popurl(3). "view/cust_main.cgi?". $custnum) %>
+<& /elements/header-popup.html, 'Invoice voided' &>
+<SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+</SCRIPT>
+</BODY></HTML>
%}
<%init>
diff --git a/httemplate/misc/unvoid-cust_bill_void.html b/httemplate/misc/unvoid-cust_bill_void.html
new file mode 100755
index 000000000..f61416549
--- /dev/null
+++ b/httemplate/misc/unvoid-cust_bill_void.html
@@ -0,0 +1,25 @@
+%if ( $error ) {
+% errorpage($error);
+%} else {
+% my $show = $curuser->default_customer_view =~ /^(jumbo|payment_history)$/
+% ? ''
+% : ';show=payment_history';
+<% $cgi->redirect($p. "view/cust_main.cgi?custnum=$custnum$show" ) %>
+%}
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+die "access denied"
+ unless $curuser->access_right('Unvoid invoices');
+
+#untaint invnum
+$cgi->param('invnum') =~ /^(\d+)$/ || die "Illegal invnum";
+my $invnum = $1;
+
+my $cust_bill_void = qsearchs('cust_bill_void', { 'invnum' => $invnum } );
+my $custnum = $cust_bill_void->custnum;
+
+my $error = $cust_bill_void->unvoid;
+
+</%init>
diff --git a/httemplate/misc/unvoid-cust_pay_void.cgi b/httemplate/misc/unvoid-cust_pay_void.cgi
index 91fe1c223..4726ee576 100755
--- a/httemplate/misc/unvoid-cust_pay_void.cgi
+++ b/httemplate/misc/unvoid-cust_pay_void.cgi
@@ -6,7 +6,7 @@
<%init>
die "access denied"
- unless $FS::CurrentUser::CurrentUser->access_right('Unvoid');
+ unless $FS::CurrentUser::CurrentUser->access_right('Unvoid payments');
#untaint paynum
my($query) = $cgi->keywords;
diff --git a/httemplate/misc/void-cust_pay.cgi b/httemplate/misc/void-cust_pay.cgi
index 7b484e93e..31b7a6201 100755
--- a/httemplate/misc/void-cust_pay.cgi
+++ b/httemplate/misc/void-cust_pay.cgi
@@ -12,7 +12,7 @@ my $paynum = $1;
my $cust_pay = qsearchs('cust_pay',{'paynum'=>$paynum});
-my $right = 'Regular void';
+my $right = 'Void payments';
$right = 'Credit card void' if $cust_pay->payby eq 'CARD';
$right = 'Echeck void' if $cust_pay->payby eq 'CHEK';
diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html
index d7322a2d6..ff269bfaf 100644
--- a/httemplate/view/cust_main/payment_history/payment.html
+++ b/httemplate/view/cust_main/payment_history/payment.html
@@ -181,7 +181,7 @@ $void = areyousure_link("${p}misc/void-cust_pay.cgi?".$cust_pay->paynum,
&& $curuser->access_right('Echeck void')
)
|| ( $cust_pay->payby !~ /^(CARD|CHEK)$/
- && $curuser->access_right('Regular void')
+ && $curuser->access_right('Void payments')
)
)
);
diff --git a/httemplate/view/cust_main/payment_history/voided_invoice.html b/httemplate/view/cust_main/payment_history/voided_invoice.html
index 7bf206352..15393cbf5 100644
--- a/httemplate/view/cust_main/payment_history/voided_invoice.html
+++ b/httemplate/view/cust_main/payment_history/voided_invoice.html
@@ -25,7 +25,13 @@ my $link = $curuser->access_right('View invoices')
? qq!<A HREF="${p}view/cust_bill_void.html?$invnum">!
: '';
-my $unvoid = ''; #XXX unvoid
+my $unvoid = '';
+$unvoid = areyousure_link("${p}misc/unvoid-cust_bill_void.html?invnum=". $cust_bill_void->invnum,
+ emt('Are you sure you want to unvoid this invoice?'),
+ emt('Unvoid this invoice'),
+ emt('unvoid')
+ )
+ if $cust_bill_void->closed !~ /^Y/ && $curuser->access_right('Unvoid invoices');
my $delete = '';
$delete = areyousure_link("${p}misc/delete-cust_bill.html?$invnum",
diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html
index 2f038be41..88b5e0a84 100644
--- a/httemplate/view/cust_main/payment_history/voided_payment.html
+++ b/httemplate/view/cust_main/payment_history/voided_payment.html
@@ -31,6 +31,6 @@ $unvoid = areyousure_link("${p}misc/unvoid-cust_pay_void.cgi?".$cust_pay_void->p
emt('Unvoid this payment from the database') . $unvoidmsg,
emt('unvoid')
)
- if ( $cust_pay_void->closed !~ /^Y/i && $curuser->access_right('Unvoid') );
+ if ( $cust_pay_void->closed !~ /^Y/i && $curuser->access_right('Unvoid payments') );
</%init>