more work on package service addresses: hide locations when they're all the default...
[freeside.git] / httemplate / misc / order_pkg.html
1 <% include('/elements/header-popup.html', 'Order new package' ) %>
2
3 <SCRIPT TYPE="text/javascript">
4
5   function enable_order_pkg () {
6     if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) {
7       document.OrderPkgForm.submit.disabled = false;
8     } else {
9       document.OrderPkgForm.submit.disabled = true;
10     }
11   }
12
13 </SCRIPT>
14
15 <% include('/elements/error.html') %>
16
17 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">
18
19 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>">
20
21 <% ntable("#cccccc", 2) %>
22 <TR>
23   <TH ALIGN="right">Package</TH>
24   <TD COLSPAN=7>
25     <% include('/elements/select-cust-part_pkg.html',
26                  'curr_value' => $pkgpart,
27                  'cust_main'  => $cust_main,
28                  'onchange'   => 'enable_order_pkg',
29               )
30     %>
31   </TD>
32 </TR>
33
34 % if ( $conf->exists('pkg_referral') ) {
35   <% include('/elements/tr-select-part_referral.html',
36                'curr_value'    => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum,
37                'disable_empty' => 1,
38                'multiple'      => $conf->exists('pkg_referral-multiple'),
39                'colspan'       => 7,
40             )
41   %>
42 % }
43
44 <% include('/elements/tr-select-cust_location.html',
45              'cgi'       => $cgi,
46              'cust_main' => $cust_main,
47           )
48 %>
49
50 </TABLE>
51
52 <BR>
53 <INPUT NAME="submit" TYPE="submit" VALUE="Order Package" <% $pkgpart ? '' : 'DISABLED' %>>
54
55 </FORM>
56 </BODY>
57 </HTML>
58 <%init>
59
60 die "access denied"
61   unless $FS::CurrentUser::CurrentUser->access_right('Order customer package');
62
63 my $conf = new FS::Conf;
64
65 $cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum";
66 my $custnum = $1;
67 my $cust_main = qsearchs({
68   'table'     => 'cust_main',
69   'hashref'   => { 'custnum' => $custnum },
70   'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
71 });
72
73 my $pkgpart = scalar($cgi->param('pkgpart'));
74
75 </%init>