From: ivan Date: Wed, 7 May 2008 21:36:36 +0000 (+0000) Subject: fix customer cancellation, sort of a side effect of #2872, fixes #3480, #3481 X-Git-Tag: freeside_1_7_4rc1~363 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=d14d966d6932a7dcbe34ab684342a5892609a574;p=freeside.git fix customer cancellation, sort of a side effect of #2872, fixes #3480, #3481 --- diff --git a/httemplate/misc/cancel_cust.html b/httemplate/misc/cancel_cust.html index 1773afc54..470aa6057 100644 --- a/httemplate/misc/cancel_cust.html +++ b/httemplate/misc/cancel_cust.html @@ -14,7 +14,7 @@ <% ntable("#cccccc", 2) %> -<% include('/elements/tr-select-reason.html', 'reasonnum', 'C', '', '', '', "document.getElementById('confirm_cancel_cust_button')", +<% include('/elements/tr-select-reason.html', 'reasonnum', 'C', $reasonnum, '', '', "document.getElementById('confirm_cancel_cust_button')", ) %> @@ -30,24 +30,19 @@ <%init> -my($custnum, $reasonnum, $submit, $cust_main, $curuser, $class); +$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; +my $custnum = $1; + +my $reasonnum = ''; 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, diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 12aa82aac..3b47d76e8 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -13,24 +13,6 @@ function areyousure(href, message) { } - % if ( $curuser->access_right('Cancel customer') % && $cust_main->ncancelled_pkgs % ) { @@ -45,28 +27,23 @@ var confirm_cancel = '
misc/delete-customer.cgi?<% $custnum%>">Delete this customer | % } -% unless ( $conf->exists('disable_customer_referrals') ) { - Refer a new customer | - View this customer's referrals +% unless ( $conf->exists('disable_customer_referrals') ) { + Refer a new customer | + View this customer's referrals % } - -

-% + %my $signupurl = $conf->config('signupurl'); %if ( $signupurl ) { -% - This customer's signup URL: <% $signupurl %>?ref=<% $custnum %>

% } @@ -174,9 +151,9 @@ die "No customer specified (bad URL)!" unless $cgi->keywords; my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array $query =~ /^(\d+)$/; my $custnum = $1; -my $cust_main = qsearchs({ +my $cust_main = qsearchs( { 'table' => 'cust_main', - 'hashref' => {'custnum'=>$custnum}, + 'hashref' => { 'custnum' => $custnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, }); die "Customer not found!" unless $cust_main;