summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2003-04-01 06:55:01 +0000
committerivan <ivan>2003-04-01 06:55:01 +0000
commit26deea8eb085dcb06295e6795f72f2844bcd3fe1 (patch)
tree5659204176a3c6c7be3c07b945ab78338ac273cb /httemplate
parentf3b8b72d2a07683b2deb2774f29407e25e725b5a (diff)
cancel button for customers (closes: Bug#25)
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/misc/cust_main-cancel.cgi16
-rwxr-xr-xhttemplate/view/cust_main.cgi21
2 files changed, 33 insertions, 4 deletions
diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi
new file mode 100755
index 000000000..526e128a4
--- /dev/null
+++ b/httemplate/misc/cust_main-cancel.cgi
@@ -0,0 +1,16 @@
+<%
+
+#untaint custnum
+my($query) = $cgi->keywords;
+$query =~ /^(\d+)$/ || die "Illegal custnum";
+my $custnum = $1;
+
+my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } );
+
+my $error = $cust_main->cancel;
+eidiot($error) if $error;
+
+#print $cgi->redirect($p. "view/cust_main.cgi?". $cust_main->custnum);
+print $cgi->redirect($p);
+
+%>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 9b7b5d029..1d6243e23 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -22,10 +22,23 @@ my $custnum = $1;
my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum});
die "Customer not found!" unless $cust_main;
-print qq!<A HREF="!, popurl(2),
- qq!edit/cust_main.cgi?$custnum">Edit this customer</A>!;
-print qq! | <A HREF="!, popurl(2),
- qq!misc/delete-customer.cgi?$custnum"> Delete this customer</A>!
+print qq!<A HREF="${p}edit/cust_main.cgi?$custnum">Edit this customer</A>!;
+
+print <<END;
+<SCRIPT>
+function cancel_areyousure(href) {
+ if (confirm("Perminantly delete all services and cancel this customer?") == true)
+ window.location.href = href;
+}
+</SCRIPT>
+END
+
+print qq! | <A HREF="javascript:cancel_areyousure('${p}misc/cust_main-cancel.cgi?$custnum')">!.
+ 'Cancel this customer</A>'
+ if $cust_main->ncancelled_pkgs;
+
+print qq! | <A HREF="${p}misc/delete-customer.cgi?$custnum">!.
+ 'Delete this customer</A>'
if $conf->exists('deletecustomers');
unless ( $conf->exists('disable_customer_referrals') ) {