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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
<& /elements/header-popup.html, mt($title) &>
<SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT>
<& /elements/error.html &>
<FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/change-cust_pkg.html" METHOD=POST>
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
<FONT CLASS="fsinnerbox-title"><% mt('Package') |h %></FONT>
<% ntable('#cccccc') %>
<TR>
<TH ALIGN="right"><% mt('Current package') |h %></TH>
<TD COLSPAN=7>
<FONT STYLE="background-color:#e8e8e8"><% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B> - <% $part_pkg->comment |h %></FONT>
</TD>
</TR>
<& /elements/tr-select-cust-part_pkg.html,
'pre_label' => emt('New'),
'curr_value' => scalar($cgi->param('pkgpart')),
'classnum' => $part_pkg->classnum,
'cust_main' => $cust_main,
&>
<& /elements/tr-input-pkg-quantity.html,
'curr_value' => $cust_pkg->quantity
&>
</TABLE>
<BR>
<FONT CLASS="fsinnerbox-title"><% mt('Change') |h %></FONT>
<% ntable('#cccccc') %>
<TR>
<!-- <TD> Apply this change: </TD> -->
<TD> <INPUT TYPE="radio" NAME="delay" VALUE="0" \
<% !$cgi->param('delay') ? 'CHECKED' : '' %>> Now </TD>
<TD> <INPUT TYPE="radio" NAME="delay" VALUE="1" \
<% $cgi->param('delay') ? 'CHECKED' : '' %>> In the future
<& /elements/input-date-field.html, {
'name' => 'start_date',
'value' => ($cgi->param('start_date') || $cust_main->next_bill_date),
} &>
</TD>
</TR>
</TABLE>
</BR>
<FONT CLASS="fsinnerbox-title"><% mt('Location') |h %></FONT>
<% ntable('#cccccc') %>
<& /elements/tr-select-cust_location.html,
'cgi' => $cgi,
'cust_main' => $cust_main,
&>
</TABLE>
<BR>
<& /elements/standardize_locations.html,
'form' => "OrderPkgForm",
'callback' => 'document.OrderPkgForm.submit();',
&>
<INPUT NAME = "submitButton"
TYPE = "button"
VALUE = "<% mt("Change package") |h %>"
onClick = "this.disabled=true; standardize_new_location();"
<% scalar($cgi->param('pkgpart')) ? '' : 'DISABLED' %>
>
</FORM>
</BODY>
</HTML>
<%init>
my $conf = new FS::Conf;
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('Change customer package');
my $pkgnum = scalar($cgi->param('pkgnum'));
$pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum";
$pkgnum = $1;
my $cust_pkg =
qsearchs({
'table' => 'cust_pkg',
'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
'hashref' => { 'pkgnum' => $pkgnum },
'extra_sql' => ' AND '. $curuser->agentnums_sql,
}) or die "unknown pkgnum $pkgnum";
my $cust_main = $cust_pkg->cust_main
or die "can't get cust_main record for custnum ". $cust_pkg->custnum.
" ( pkgnum ". cust_pkg->pkgnum. ")";
my $part_pkg = $cust_pkg->part_pkg;
my $title = "Change Package";
# if there's already a package change ordered, preload it
if ( $cust_pkg->change_to_pkgnum ) {
my $change_to = FS::cust_pkg->by_key($cust_pkg->change_to_pkgnum);
$cgi->param('delay', 1);
foreach(qw( start_date pkgpart locationnum quantity )) {
$cgi->param($_, $change_to->get($_));
}
$title = "Edit Scheduled Package Change";
}
</%init>
|