summaryrefslogtreecommitdiff
path: root/httemplate/misc/order_pkg.html
blob: 2c8335154753c122694a39496debe32ac51855d0 (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
<% include('/elements/header-popup.html', 'Order new package' ) %>

<SCRIPT TYPE="text/javascript">

  function enable_order_pkg () {
    if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) {
      document.OrderPkgForm.submit.disabled = false;
    } else {
      document.OrderPkgForm.submit.disabled = true;
    }
  }

</SCRIPT>

<% include('/elements/error.html') %>

<FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">

<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>">

<% ntable("#cccccc", 2) %>
<TR>
  <TH ALIGN="right">Package</TH>
  <TD COLSPAN=7>
    <% include('/elements/select-cust-part_pkg.html',
                 'curr_value' => $pkgpart,
                 'cust_main'  => $cust_main,
                 'onchange'   => 'enable_order_pkg',
              )
    %>
  </TD>
</TR>

% if ( $conf->exists('pkg_referral') ) {
  <% include('/elements/tr-select-part_referral.html',
               'curr_value'    => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum,
               'disable_empty' => 1,
               'multiple'      => $conf->exists('pkg_referral-multiple'),
               'colspan'       => 7,
            )
  %>
% }

<% include('/elements/tr-select-cust_location.html',
             'cgi'       => $cgi,
             'cust_main' => $cust_main,
          )
%>

</TABLE>

<BR>
<INPUT NAME="submit" TYPE="submit" VALUE="Order Package" <% $pkgpart ? '' : 'DISABLED' %>>

</FORM>
</BODY>
</HTML>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Order customer package');

my $conf = new FS::Conf;

$cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum";
my $custnum = $1;
my $cust_main = qsearchs({
  'table'     => 'cust_main',
  'hashref'   => { 'custnum' => $custnum },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
});

my $pkgpart = scalar($cgi->param('pkgpart'));

</%init>