X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fcancel_pkg.html;h=607ce13c43a39b1b48a48ae6afa9041ad0095879;hb=089001124dbd8016d5d51f9aaef50fb9f101dae5;hp=b085d2281d95a8c9c136257aabddf165a692ec40;hpb=c8f56207c0c8ee26b62824064e59d5952c20f70b;p=freeside.git diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index b085d2281..607ce13c4 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') %>
@@ -20,13 +17,13 @@

-<% ucfirst($method) . " $pkgnum: " .$part_pkg->pkg. ' - ' .$part_pkg->comment %> +<% ucfirst($method) %> <% $part_pkg->pkg_comment %> <% ntable("#cccccc", 2) %> % if ($method eq 'expire' || $method eq 'adjourn') { <% $submit =~ /^(\w*)\s/ %> package on - +
m/d/y @@ -42,57 +39,71 @@ %} % -<% include('/elements/tr-select-reason.html', 'reasonnum', $class, '', '', '', 'document.sc_popup.submit' ) %> +<% include('/elements/tr-select-reason.html', + 'field' => 'reasonnum', + 'reason_class' => $class, + '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; -