1 %# if ( $link eq 'popup' ) {
2 <% include('/elements/header-popup.html', $title ) %>
4 %# <% include("/elements/header.html", $title, '') %>
7 <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
8 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
9 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT>
10 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT>
12 <% include('/elements/error.html') %>
14 <FORM NAME="sc_popup" ACTION="<% popurl(1) %>process/cancel_pkg.html" METHOD=POST>
15 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
16 <INPUT TYPE="hidden" NAME="method" VALUE="<% $method %>">
20 <% ucfirst($method) %> <% $part_pkg->pkg_comment %>
21 <% ntable("#cccccc", 2) %>
23 % if ($method eq 'expire' || $method eq 'adjourn') {
25 <TD><% $submit =~ /^(\w*)\s/ %> package on </TD>
26 <TD><INPUT TYPE="text" NAME="date" ID="expire_date" VALUE="<% $date |h %>">
27 <IMG SRC="<% $p %>images/calendar.png" ID="expire_button" STYLE="cursor:pointer" TITLE="Select date">
31 <SCRIPT TYPE="text/javascript">
33 inputField: "expire_date",
34 ifFormat: "<% $date_format %>",
35 button: "expire_button",
42 <% include('/elements/tr-select-reason.html',
43 'field' => 'reasonnum',
44 'reason_class' => $class,
45 'curr_value' => $reasonnum,
46 'control_button' => "document.getElementById('confirm_cancel_pkg_button')",
53 <INPUT TYPE="submit" NAME="submit" ID="confirm_cancel_pkg_button" VALUE="<% $submit %>" DISABLED>
61 my $conf = new FS::Conf;
62 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
64 my $date = time2str($date_format, time);
66 my($pkgnum, $reasonnum);
67 if ( $cgi->param('error') ) {
68 $pkgnum = $cgi->param('pkgnum');
69 $reasonnum = $cgi->param('reasonnum');
70 $date = $cgi->param('date');
71 } elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
75 die "illegal query ". $cgi->keywords;
78 $cgi->param('method') =~ /^(\w+)$/ or die 'illegal method';
81 my($class, $submit, $right);
82 if ($method eq 'cancel') {
84 $submit = 'Cancel Now';
85 $right = 'Cancel customer package immediately';
86 } elsif ($method eq 'expire') {
88 $submit = 'Cancel Later';
89 $right = 'Cancel customer package later';
90 } elsif ($method eq 'suspend') {
92 $submit = 'Suspend Now';
93 $right = 'Suspend customer package';
94 } elsif ($method eq 'adjourn') {
96 $submit = "Suspend Later";
97 $right = 'Suspend customer package later';
99 die 'illegal query (unknown method param)';
102 my $curuser = $FS::CurrentUser::CurrentUser;
103 die "access denied" unless $curuser->access_right($right);
105 my $title = ucfirst($method) . ' Package';
107 my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum})
108 or die "Unknown pkgnum: $pkgnum";
110 my $part_pkg = $cust_pkg->part_pkg;