ho ho ho, merry XSSmas
[freeside.git] / httemplate / misc / cancel_pkg.html
1 %# if ( $link eq 'popup' ) { 
2   <% include('/elements/header-popup.html', $title ) %>
3 %# } else { 
4 %#  <%  include("/elements/header.html", $title, '') %>
5 %# } 
6
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>
11
12 <% include('/elements/error.html') %>
13
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 %>">
17
18
19 <BR><BR>
20 <% ucfirst($method) . " $pkgnum: " .$part_pkg->pkg. ' - ' .$part_pkg->comment %>
21 <% ntable("#cccccc", 2) %>
22
23 % if ($method eq 'expire' || $method eq 'adjourn') {
24 <TR>
25   <TD><% $submit =~ /^(\w*)\s/ %> package on </TD>
26     <TD><INPUT TYPE="text" NAME="date" ID="expire_date" VALUE="<% $date %>">
27         <IMG SRC="<% $p %>images/calendar.png" ID="expire_button" STYLE="cursor:pointer" TITLE="Select date">
28         <BR><I>m/d/y</I>
29     </TD>
30 </TR>
31 <SCRIPT TYPE="text/javascript">
32   Calendar.setup({
33     inputField: "expire_date",
34     ifFormat:   "%m/%d/%Y",
35     button:     "expire_button",
36     align:      "BR"
37   });
38 </SCRIPT>
39 %}
40 %
41
42 <% include('/elements/tr-select-reason.html',
43              'field'          => 'reasonnum',
44              'reason_class'   => $class,
45              #XXX these need to be sticky on errors too...
46              #'curr_value'     => '',
47              'control_button' => 'document.sc_popup.submit',
48           )
49 %>
50
51 </TABLE>
52
53 <BR>
54 <INPUT TYPE="submit" NAME="submit" VALUE="<% $submit %>" disabled='true'>
55
56 </FORM>
57 </BODY>
58 </HTML>
59
60 <%init>
61 my($method, $pkgnum, $reasonnum, $submit, $cust_pkg, $part_pkg,
62    $date, $curuser, $class); 
63 $date = time2str("%m/%d/%Y", time);
64 if ( $cgi->param('error') ) {
65   $method        = $cgi->param('method');
66   $pkgnum        = $cgi->param('pkgnum');
67   $reasonnum     = $cgi->param('reasonnum');
68   $date = $cgi->param('date');
69 } elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
70   $pkgnum  = $1;
71 } else {
72   die "illegal query ". $cgi->keywords;
73 }
74
75 $method = $cgi->param('method');
76 if ($method eq 'cancel') {
77   $class = 'C';
78   $submit    = "Cancel Now";
79 }elsif ($method eq 'expire') {
80   $class = 'C';
81   $submit    = "Cancel Later";
82 }elsif ($method eq 'suspend') {
83   $class = 'S';
84   $submit    = "Suspend Now";
85 }elsif ($method eq 'adjourn') {
86   $class = 'S';
87   $submit    = "Suspend Later";
88 }else{
89   die "illegal query ". $cgi->keywords;
90 }
91
92 my $title = ucfirst($method) . ' Package';
93
94 $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
95 die "No such package: $pkgnum" unless $cust_pkg;
96
97 $part_pkg = $cust_pkg->part_pkg;
98
99 $curuser = $FS::CurrentUser::CurrentUser;
100
101 </%init>
102