prepayment discounts rt#5318
[freeside.git] / httemplate / misc / xmlhttp-cust_main-discount_terms.cgi
diff --git a/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi b/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi
new file mode 100644 (file)
index 0000000..71e2da5
--- /dev/null
@@ -0,0 +1,24 @@
+% if ( $sub eq 'discount_terms' ) {
+% 
+%   my $return = [];
+%   my $custnum = $cgi->param('arg');
+%   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 [ $_, "$_ months" ], $cust_main->discount_terms ];
+%   }
+%
+<% objToJson($return) %>
+% } 
+<%init>
+
+my $conf = new FS::Conf;
+
+my $sub = $cgi->param('sub');
+
+</%init>