summaryrefslogtreecommitdiff
path: root/httemplate/misc/cancel_pkg.html
blob: 642f0c83e4dc5d6070a25e7623da7fb3858b8fcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
%# 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>

% if ( $cgi->param('error') ) { 
  <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT>
  <BR><BR>
% } 

<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) . " $pkgnum: " .$part_pkg->pkg. ' - ' .$part_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 %>">
        <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:   "%m/%d/%Y",
    button:     "expire_button",
    align:      "BR"
  });
</SCRIPT>
%}
%

<% include('/elements/tr-select-reason.html',
             'field'          => 'reasonnum',
             'reason_class'   => $class,
             #XXX these need to be sticky on errors too...
             #'curr_value'     => '',
             'control_button' => 'document.sc_popup.submit',
          )
%>

</TABLE>

<BR>
<INPUT TYPE="submit" NAME="submit" VALUE="<% $submit %>" disabled='true'>

</FORM>
</BODY>
</HTML>

<%init>
my($method, $pkgnum, $reasonnum, $submit, $cust_pkg, $part_pkg,
   $date, $curuser, $class); 
$date = time2str("%m/%d/%Y", time);
if ( $cgi->param('error') ) {
  $method        = $cgi->param('method');
  $pkgnum        = $cgi->param('pkgnum');
  $reasonnum     = $cgi->param('reasonnum');
  $date = $cgi->param('date');
} elsif ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
  $pkgnum  = $1;
} else {
  die "illegal query ". $cgi->keywords;
}

$method = $cgi->param('method');
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;
}

my $title = ucfirst($method) . ' Package';

$cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum});
die "No such package: $pkgnum" unless $cust_pkg;

$part_pkg = $cust_pkg->part_pkg;

$curuser = $FS::CurrentUser::CurrentUser;

</%init>