summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/cust_pkg_quantity.html
blob: b60595583b9e9063716d30f324b03641329c03d1 (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
% if ($error) {
%   $cgi->param('error', $error);
%   $cgi->redirect(popurl(3). 'edit/cust_pkg_quantity.html?'. $cgi->query_string );
% } else {

    <& /elements/header-popup.html, "Quantity changed" &>
      <SCRIPT TYPE="text/javascript">
        topreload();
      </SCRIPT>
    </BODY>
    </HTML>

% }
<%init>

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

die "access denied"
  unless $curuser->access_right('Change customer package');

my $cust_pkg = qsearchs({
  'table'     => 'cust_pkg',
  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
  'hashref'   => { 'pkgnum' => scalar($cgi->param('pkgnum')), },
  'extra_sql' => ' AND '. $curuser->agentnums_sql,
});
die 'unknown pkgnum' unless $cust_pkg;

$cgi->param('quantity') =~ /^(\d+)$/;
my $quantity = $1;
my $error = $cust_pkg->set_quantity($1);

</%init>