add billco-account_num option, RT#22934
authorIvan Kohler <ivan@freeside.biz>
Fri, 11 Oct 2013 05:51:41 +0000 (22:51 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 11 Oct 2013 05:51:41 +0000 (22:51 -0700)
FS/FS/Conf.pm
FS/FS/cust_bill.pm

index 16bbaad..dd4cd68 100644 (file)
@@ -935,7 +935,19 @@ sub reason_type_options {
     'type'        => 'text',
     'per_agent'   => 1,
   },
-  
+
+  {
+    'key'         => 'billco-account_num',
+    'section'     => 'billing',
+    'description' => 'The data to place in the "Transaction Account No" / "TRACCTNUM" field.',
+    'type'        => 'select',
+    'select_hash' => [
+                       'invnum-date' => 'Invoice number - Date (default)',
+                       'display_custnum'  => 'Customer number',
+                     ],
+    'per_agent'   => 1,
+  },
+
   {
     'key'         => 'next-bill-ignore-time',
     'section'     => 'billing',
index a747a78..a61adde 100644 (file)
@@ -1972,6 +1972,13 @@ sub print_csv {
 
   if ( $format eq 'billco' ) {
 
+    my $account_num =
+      $self->conf->config('billco-account_num', $cust_main->agentnum);
+
+    my $tracctnum = $account_num eq 'display_custnum'
+                      ? $cust_main->display_custnum
+                      : $opt{'tracctnum'};
+
     my $taxtotal = 0;
     $taxtotal += $_->{'amount'} foreach $self->_items_tax;
 
@@ -1988,7 +1995,7 @@ sub print_csv {
     $csv->combine(
       '',                         #  1 | N/A-Leave Empty               CHAR   2
       '',                         #  2 | N/A-Leave Empty               CHAR  15
-      $opt{'tracctnum'},          #  3 | Transaction Account No        CHAR  15
+      $tracctnum,                 #  3 | Transaction Account No        CHAR  15
       $self->invnum,              #  4 | Transaction Invoice No        CHAR  15
       $cust_main->zip,            #  5 | Transaction Zip Code          CHAR   5
       $cust_main->company,        #  6 | Transaction Company Bill To   CHAR  30