summaryrefslogtreecommitdiff
path: root/httemplate/misc/void-cust_credit.html
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-02-16 13:53:20 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-02-16 13:53:20 -0600
commit251d07aa41b6830a0a2f2a51c14fa94586d843c2 (patch)
treec53f5a96bc595b914187a4c2be0c9a3084bedb98 /httemplate/misc/void-cust_credit.html
parent4771a2fe6202aa77d8e6fda10dc2b221899f3941 (diff)
RT#27710: Credit voiding
Diffstat (limited to 'httemplate/misc/void-cust_credit.html')
-rwxr-xr-xhttemplate/misc/void-cust_credit.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/httemplate/misc/void-cust_credit.html b/httemplate/misc/void-cust_credit.html
new file mode 100755
index 0000000..1e71f00
--- /dev/null
+++ b/httemplate/misc/void-cust_credit.html
@@ -0,0 +1,74 @@
+%if ( $success ) {
+<& /elements/header-popup.html, mt("Credit voided") &>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+ </BODY>
+</HTML>
+%} else {
+<& /elements/header-popup.html, mt('Void credit') &>
+
+<& /elements/error.html &>
+
+<P ALIGN="center"><B><% mt('Void this credit?') |h %></B>
+
+<FORM action="<% ${p} %>misc/void-cust_credit.html">
+<INPUT TYPE="hidden" NAME="crednum" VALUE="<% $crednum %>">
+
+<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_credit" VALUE="<% mt('Void credit') |h %>">
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+<INPUT TYPE="BUTTON" VALUE="<% mt("Don't void credit") |h %>" onClick="parent.cClick();">
+
+</FORM>
+</BODY>
+</HTML>
+
+%}
+<%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;
+ }
+}
+
+</%init>