X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fmisc%2Fcancel_cust.html;h=5c2e0367726d95d0b020430b1a4d3a83eacd4a05;hb=145e7ee0b767e95c229657680ae477bb693ac7fc;hp=a757aa6e38b8f4990c254dbc570ac9c80b0d3be0;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/httemplate/misc/cancel_cust.html b/httemplate/misc/cancel_cust.html index a757aa6e3..5c2e03677 100644 --- a/httemplate/misc/cancel_cust.html +++ b/httemplate/misc/cancel_cust.html @@ -1,9 +1,6 @@ <% include('/elements/header-popup.html', 'Cancel customer' ) %> -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
@@ -20,9 +17,8 @@ <% include('/elements/tr-select-reason.html', 'field' => 'reasonnum', 'reason_class' => 'C', - #XXX these need to be sticky on errors too... - #'curr_value' => '', - 'control_button' => 'document.cust_cancel_popup.submit', + 'cgi' => $cgi, + 'control_button' => "document.getElementById('confirm_cancel_cust_button')", ) %> @@ -30,7 +26,7 @@

-          +         

@@ -38,22 +34,21 @@ <%init> -my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); +my $reasonnum = ''; +my($submit, $class); + +$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; +my $custnum = $1; + if ( $cgi->param('error') ) { - $custnum = $cgi->param('custnum'); - $reasonnum = $cgi->param('reasonnum'); -} else { - my( $query ) = $cgi->keywords; - if ( $query =~ /^(\d+)$/ ) { - $custnum = $1; - } else { - die "illegal query ". $cgi->keywords; - } + $reasonnum = $cgi->param('reasonnum'); } -$curuser = $FS::CurrentUser::CurrentUser; +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" unless $curuser->access_right('Cancel customer'); -$cust_main = qsearchs( { +my $cust_main = qsearchs( { 'table' => 'cust_main', 'hashref' => { 'custnum' => $custnum }, 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,