summaryrefslogtreecommitdiff
path: root/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi
blob: 36b18b455dfc202494276fc1ce0dc32c797d4d5f (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
% if ( $sub eq 'discount_terms' ) {
% 
%   my $return = [];
%   my $custnum = $cgi->param('arg');
%   if ( $custnum =~ /^\d+$/ ) {
%     my $cust_main = '';
%     $cust_main = qsearchs({
%       'table'   => 'cust_main',
%       'hashref' => { 'custnum' => $custnum },
%       'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
%     });
%     
%     if ($cust_main) {
%       $return = [ map [ $_, sprintf("%d months", $_) ], 
%         $cust_main->discount_terms ];
%     }
%   }
%
<% encode_json($return) %>\
% } 
<%init>

my $conf = new FS::Conf;

my $sub = $cgi->param('sub');

</%init>