[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 180c20dc0b463cab61f9c8b31009e18a7be1b5c0

Mark Wells mark at 420.am
Thu Mar 29 17:18:35 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  180c20dc0b463cab61f9c8b31009e18a7be1b5c0 (commit)
      from  32276032c4c3754b6318b9b70a934a1f8fb52586 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 180c20dc0b463cab61f9c8b31009e18a7be1b5c0
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Mar 29 17:18:17 2012 -0700

    one-line CSV format for invoice spool, #16382

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 22a618d..344dc2a 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2918,7 +2918,7 @@ and customer address. Include units.',
     'section'     => 'invoicing',
     'description' => 'Enable FTP of raw invoice data - format.',
     'type'        => 'select',
-    'select_enum' => [ '', 'default', 'billco', ],
+    'select_enum' => [ '', 'default', 'oneline', 'billco', ],
   },
 
   {
@@ -2954,7 +2954,7 @@ and customer address. Include units.',
     'section'     => 'invoicing',
     'description' => 'Enable spooling of raw invoice data - format.',
     'type'        => 'select',
-    'select_enum' => [ '', 'default', 'billco', ],
+    'select_enum' => [ '', 'default', 'oneline', 'billco', ],
   },
 
   {
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 3aa75ec..945771e 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2005,6 +2005,36 @@ sub print_csv {
       '0',                        # 29 | Other Taxes & Fees***         NUM*   9
     );
 
+  } elsif ( lc($opt{'format'}) eq 'oneline' ) { #name?
+   
+    my ($previous_balance) = $self->previous; 
+    my $totaldue = sprintf('%.2f', $self->owed + $previous_balance);
+    my @items = map {
+      ($_->{pkgnum} || ''),
+      $_->{description},
+      $_->{amount}
+    } $self->_items_pkg;
+
+    $csv->combine(
+      $cust_main->agentnum,
+      $self->custnum,
+      $cust_main->first,
+      $cust_main->last,
+      $cust_main->address1,
+      $cust_main->address2,
+      $cust_main->city,
+      $cust_main->state,
+      $cust_main->zip,
+
+      # invoice fields
+      time2str("%x", $self->_date),
+      $self->invnum,
+      $self->charged,
+      $totaldue,
+
+      @items,
+    );
+
   } else {
   
     $csv->combine(
@@ -2044,6 +2074,10 @@ sub print_csv {
 
     }
 
+  } elsif ( lc($opt{'format'}) eq 'oneline' ) {
+
+    #do nothing
+
   } else {
 
     foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) {

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Conf.pm      |    4 ++--
 FS/FS/cust_bill.pm |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list