diff options
Diffstat (limited to 'httemplate/misc/cancel_pkg.html')
-rwxr-xr-x | httemplate/misc/cancel_pkg.html | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html new file mode 100755 index 0000000..10c0e0d --- /dev/null +++ b/httemplate/misc/cancel_pkg.html @@ -0,0 +1,112 @@ +%# if ( $link eq 'popup' ) { + <% include('/elements/header-popup.html', $title ) %> +%# } else { +%# <% include("/elements/header.html", $title, '') %> +%# } + +<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> + +<% include('/elements/error.html') %> + +<FORM NAME="sc_popup" ACTION="<% popurl(1) %>process/cancel_pkg.html" METHOD=POST> +<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> +<INPUT TYPE="hidden" NAME="method" VALUE="<% $method %>"> + + +<BR><BR> +<% ucfirst($method) %> <% $part_pkg->pkg_comment %> +<% ntable("#cccccc", 2) %> + +% if ($method eq 'expire' || $method eq 'adjourn') { +<TR> + <TD><% $submit =~ /^(\w*)\s/ %> package on </TD> + <TD><INPUT TYPE="text" NAME="date" ID="expire_date" VALUE="<% $date |h %>"> + <IMG SRC="<% $p %>images/calendar.png" ID="expire_button" STYLE="cursor:pointer" TITLE="Select date"> + <BR><I>m/d/y</I> + </TD> +</TR> +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "expire_date", + ifFormat: "<% $date_format %>", + button: "expire_button", + align: "BR" + }); +</SCRIPT> +%} +% + +<% include('/elements/tr-select-reason.html', + 'field' => 'reasonnum', + 'reason_class' => $class, + 'curr_value' => $reasonnum, + 'control_button' => "document.getElementById('confirm_cancel_pkg_button')", + ) +%> + +</TABLE> + +<BR> +<INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_pkg_button" VALUE="<% $submit %>" DISABLED> + +</FORM> +</BODY> +</HTML> + +<%init> + +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +my $date = time2str($date_format, time); + +my($pkgnum, $reasonnum); +if ( $cgi->param('error') ) { + $pkgnum = $cgi->param('pkgnum'); + $reasonnum = $cgi->param('reasonnum'); + $date = $cgi->param('date'); +} elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + $pkgnum = $1; + $reasonnum = ''; +} else { + die "illegal query ". $cgi->keywords; +} + +$cgi->param('method') =~ /^(\w+)$/ or die 'illegal method'; +my $method = $1; + +my($class, $submit, $right); +if ($method eq 'cancel') { + $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 $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" unless $curuser->access_right($right); + +my $title = ucfirst($method) . ' Package'; + +my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum}) + or die "Unknown pkgnum: $pkgnum"; + +my $part_pkg = $cust_pkg->part_pkg; + +</%init> |