blob: 0bb84b8f22bf1073e07a2219052bc55c611830ad (
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
|
<% include('/elements/header-popup.html', "Discount Package") %>
<SCRIPT TYPE="text/javascript">
function enable_discount_pkg () {
if ( document.DiscountPkgForm.discountnum.selectedIndex > 0 ) {
document.DiscountPkgForm.submit.disabled = false;
} else {
document.DiscountPkgForm.submit.disabled = true;
}
}
</SCRIPT>
<% include('/elements/error.html') %>
<FORM NAME="DiscountPkgForm" ACTION="<% $p %>edit/process/cust_pkg_discount.html" METHOD=POST>
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
<% ntable('#cccccc') %>
<TR>
<TH ALIGN="right">Current package </TH>
<TD COLSPAN=7>
<% $curuser->option('show_pkgnum') ? $cust_pkg->pkgnum.': ' : '' %><B><% $part_pkg->pkg |h %></B> - <% $part_pkg->comment |h %>
</TD>
</TR>
<% include('/elements/tr-select-discount.html',
'empty_label' => ( $pkgdiscountnum ? '' : 'Select discount' ),
'onchange' => 'enable_discount_pkg()',
'cgi' => $cgi,
)
%>
</TABLE>
<BR>
<INPUT NAME="submit" TYPE="submit" VALUE="Discount package" <% $pkgdiscountnum ? '' : 'DISABLED' %>>
</FORM>
</BODY>
</HTML>
<%init>
#some false laziness w/misc/change_pkg.cgi
my $conf = new FS::Conf;
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('Discount customer package');
my $pkgnum = scalar($cgi->param('pkgnum'));
$pkgnum =~ /^(\d+)$/ or die "illegal pkgnum $pkgnum";
$pkgnum = $1;
my $pkgdiscountnum = '';
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;
</%init>
|