summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/cust_pay-pkgnum.html
blob: cefe970fe312ff2df3057d07ba8a78a1683e113d (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
%if ($error) {
%  $cgi->param('error', $error);
<% $cgi->redirect(popurl(2). 'cust_pay-pkgnum.html?'. $cgi->query_string ) %>
%} else {
<% header(emt('Payment package changed')) %>
    <SCRIPT TYPE="text/javascript">
      topreload();
    </SCRIPT>

    </BODY></HTML>
%}
<%init>

my $conf = FS::Conf->new;

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Apply credit'); #own ACL?

$cgi->param('paynum') =~ /^(\d+)$/
  or die "Illegal paynum: ". $cgi->param('paynum');
my $paynum = $1;

my $cust_pay = qsearchs({
  'select'    => 'cust_pay.*',
  'table'     => 'cust_pay',
  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
  'hashref'   => { paynum => scalar($cgi->param('paynum')), },
  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
})
  or die 'unknown payment';

$cust_pay->pkgnum( $cgi->param('pkgnum') );
my $error = $cust_pay->replace;

</%init>