summaryrefslogtreecommitdiff
path: root/httemplate/misc/xmlhttp-cust_main-display_recurring.html
blob: dd9ed3bb58a7245c572b3c9a2fae9a99576a042d (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
<% encode_json($return) %>\
<%init>

my %arg = $cgi->param('arg');
my $custnum = delete($arg{'custnum'});

my $error;
my $return;

$error = "No customer specified" unless $custnum =~ /^\d+$/;

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

$error = "access denied"
  unless $error or $curuser->access_right('View customer');

my $cust_main;
$cust_main = qsearchs( {
  'table'     => 'cust_main',
  'hashref'   => { 'custnum' => $custnum },
  'extra_sql' => ' AND '. $curuser->agentnums_sql,
}) unless $error;
$error = "Customer not found!" unless $error or $cust_main;

$return = $error
        ? { 'error' => $error }
        : { 'display_recurring' => [ $cust_main->display_recurring ] };

</%init>