[freeside-commits] branch master updated. cfd80c91527e3eebb6b81bef07dd191f37f9c212

Christopher Burger burgerc at 420.am
Fri May 26 09:21:06 PDT 2017


The branch, master has been updated
       via  cfd80c91527e3eebb6b81bef07dd191f37f9c212 (commit)
      from  00cd6dc7e1f767476d449a9180d44e6a6d042284 (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 cfd80c91527e3eebb6b81bef07dd191f37f9c212
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri May 26 12:20:21 2017 -0400

    RT# 74523 - added command line option to use a status table

diff --git a/FS/FS/cdr/Import.pm b/FS/FS/cdr/Import.pm
index 5046caf..35069ae 100644
--- a/FS/FS/cdr/Import.pm
+++ b/FS/FS/cdr/Import.pm
@@ -45,7 +45,7 @@ sub dbi_import {
   my %args = @_; #args are specifed by the script using this sub
 
   my %opt; #opt is specified for each install / run of the script
-  getopts('H:U:P:D:T:c:L:', \%opt);
+  getopts('H:U:P:D:T:c:L:S:', \%opt);
   my $user = shift(@ARGV) or die $class->cli_usage;
 
   $opt{D} ||= $args{database};
@@ -91,9 +91,9 @@ sub dbi_import {
 
   #my @cols = values %{ $args{column_map} };
   my $sql = "SELECT $table.* FROM $table "; # join(',', @cols). " FROM $table ".
-  $sql .=  'LEFT JOIN '. $args{status_table}.
-           " ON ( $table.$pkey = ". $args{status_table}. ".$pkey )"
-    if $args{status_table};
+  $sql .=  'LEFT JOIN '. $opt{S}.
+           " ON ( $table.$pkey = ". $opt{S}. ".$pkey )"
+    if $opt{S};
   $sql .= ' WHERE freesidestatus IS NULL ';
 
   #$sql .= ' LIMIT '. $opt{L} if $opt{L};
@@ -141,10 +141,10 @@ sub dbi_import {
       $imported++;
 
       my $st_sql;
-      if ( $args{status_table} ) {
+      if ( $opt{S} ) {
 
         $st_sql = 
-          'INSERT INTO '. $args{status_table}. " ( $pkey, freesidestatus ) ".
+          'INSERT INTO '. $opt{S}. " ( $pkey, freesidestatus ) ".
             " VALUES ( ?, 'done' )";
 
       } else {
@@ -175,7 +175,7 @@ sub dbi_import {
 sub cli_usage {
   #"Usage: \n  $0\n\t[ -H hostname ]\n\t-D database\n\t-U user\n\t-P password\n\tfreesideuser\n";
   #"Usage: \n  $0\n\t-H hostname\n\t-D database\n\t-U user\n\t-P password\n\t[ -c cdrtypenum ]\n\tfreesideuser\n";
-  "Usage: \n  $0\n\t-H hostname\n\t[ -D database ]\n\t-U user\n\t-P password\n\t[ -c cdrtypenum ]\n\t[ -L num_cdrs_limit ]\n\tfreesideuser\n";
+  "Usage: \n  $0\n\t-H hostname\n\t[ -D database ]\n\t-U user\n\t-P password\n\t[ -c cdrtypenum ]\n\t[ -L num_cdrs_limit ]\n\t[ -T table ]\n\t[ -S status table ]\n\tfreesideuser\n";
 }
 
 =head1 BUGS
diff --git a/FS/bin/freeside-cdr-freeswitch b/FS/bin/freeside-cdr-freeswitch
index 7bac699..7f09578 100644
--- a/FS/bin/freeside-cdr-freeswitch
+++ b/FS/bin/freeside-cdr-freeswitch
@@ -9,7 +9,6 @@ FS::cdr::Import->dbi_import(
   'database'     => 'fusionpbx',
   'table'        => 'v_xml_cdr',
   'primary_key'  => 'uuid',
-  'status_table' => 'freeside_billing',
   'column_map'   => { #freeside => fusionpbx
     #'cdrid'             => 'uuid', #Primary key
     #'' => 'CALL_SESSION_ID', # Call Session Id (unique per call session – GUID)

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

Summary of changes:
 FS/FS/cdr/Import.pm            |   14 +++++++-------
 FS/bin/freeside-cdr-freeswitch |    1 -
 2 files changed, 7 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list