[freeside-commits] branch master updated. fadc3d69d6a6bceac54fcb52b456222f28c42645

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


The branch, master has been updated
       via  fadc3d69d6a6bceac54fcb52b456222f28c42645 (commit)
      from  8f43e32350b7f8a0925959f747f7296b9b42c09e (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 fadc3d69d6a6bceac54fcb52b456222f28c42645
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Mar 29 17:12:00 2012 -0700

    one-line CSV format for invoice spool, #16382

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 9c7710b..1b01aa6 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2940,7 +2940,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', ],
   },
 
   {
@@ -2976,7 +2976,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