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