X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fcancel_pkg.html;h=e0e5fd1f88c6f039b5b3a66aa29771b6768b1009;hb=145e7ee0b767e95c229657680ae477bb693ac7fc;hp=642f0c83e4dc5d6070a25e7623da7fb3858b8fcf;hpb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;p=freeside.git diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index 642f0c83e..e0e5fd1f8 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -9,10 +9,7 @@ -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
@@ -26,7 +23,7 @@ % if ($method eq 'expire' || $method eq 'adjourn') { <% $submit =~ /^(\w*)\s/ %> package on - +
m/d/y @@ -45,61 +42,68 @@ <% include('/elements/tr-select-reason.html', 'field' => 'reasonnum', 'reason_class' => $class, - #XXX these need to be sticky on errors too... - #'curr_value' => '', - 'control_button' => 'document.sc_popup.submit', + 'curr_value' => $reasonnum, + 'control_button' => "document.getElementById('confirm_cancel_pkg_button')", ) %>
- +
<%init> -my($method, $pkgnum, $reasonnum, $submit, $cust_pkg, $part_pkg, - $date, $curuser, $class); -$date = time2str("%m/%d/%Y", time); + +my $date = time2str("%m/%d/%Y", time); + +my($pkgnum, $reasonnum); if ( $cgi->param('error') ) { - $method = $cgi->param('method'); - $pkgnum = $cgi->param('pkgnum'); - $reasonnum = $cgi->param('reasonnum'); - $date = $cgi->param('date'); + $pkgnum = $cgi->param('pkgnum'); + $reasonnum = $cgi->param('reasonnum'); + $date = $cgi->param('date'); } elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { - $pkgnum = $1; + $pkgnum = $1; + $reasonnum = ''; } else { die "illegal query ". $cgi->keywords; } -$method = $cgi->param('method'); +$cgi->param('method') =~ /^(\w+)$/ or die 'illegal method'; +my $method = $1; + +my($class, $submit, $right); if ($method eq 'cancel') { - $class = 'C'; - $submit = "Cancel Now"; -}elsif ($method eq 'expire') { - $class = 'C'; - $submit = "Cancel Later"; -}elsif ($method eq 'suspend') { - $class = 'S'; - $submit = "Suspend Now"; -}elsif ($method eq 'adjourn') { - $class = 'S'; - $submit = "Suspend Later"; -}else{ - die "illegal query ". $cgi->keywords; + $class = 'C'; + $submit = 'Cancel Now'; + $right = 'Cancel customer package immediately'; +} elsif ($method eq 'expire') { + $class = 'C'; + $submit = 'Cancel Later'; + $right = 'Cancel customer package later'; +} elsif ($method eq 'suspend') { + $class = 'S'; + $submit = 'Suspend Now'; + $right = 'Suspend customer package'; +} elsif ($method eq 'adjourn') { + $class = 'S'; + $submit = "Suspend Later"; + $right = 'Suspend customer package later'; +} else { + die 'illegal query (unknown method param)'; } -my $title = ucfirst($method) . ' Package'; +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" unless $curuser->access_right($right); -$cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}); -die "No such package: $pkgnum" unless $cust_pkg; +my $title = ucfirst($method) . ' Package'; -$part_pkg = $cust_pkg->part_pkg; +my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}) + or die "Unknown pkgnum: $pkgnum"; -$curuser = $FS::CurrentUser::CurrentUser; +my $part_pkg = $cust_pkg->part_pkg; -