[freeside-commits] branch master updated. 47822a049bc96a4cc0d868553f87d7c4568e868c

Ivan ivan at 420.am
Wed May 9 18:34:47 PDT 2012


The branch, master has been updated
       via  47822a049bc96a4cc0d868553f87d7c4568e868c (commit)
      from  406e97fe228cd249a8bd0fa58cbfbf33ab805f18 (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 47822a049bc96a4cc0d868553f87d7c4568e868c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 9 18:34:46 2012 -0700

    add (new?) troop CDR format, RT#17666

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 8b9d10a..843e210 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -3011,7 +3011,6 @@ sub tables_hashref {
         ###
 
         'upstream_currency',      'char', 'NULL',       3, '', '',
-        'upstream_price',      'decimal', 'NULL',  '10,4', '', '', 
         'upstream_rateplanid',     'int', 'NULL',      '', '', '', #?
 
         # how it was rated internally...
@@ -3036,6 +3035,10 @@ sub tables_hashref {
 
         'charged_party',       'varchar', 'NULL', $char_d, '', '',
 
+        'upstream_price',      'decimal', 'NULL',  '10,4', '', '', 
+        'upstream_src_regionname', 'varchar', 'NULL', $char_d, '', '',
+        'upstream_dst_regionname', 'varchar', 'NULL', $char_d, '', '',
+
         # how it was rated internally...
         'rated_pretty_dst',       'varchar', 'NULL', $char_d, '', '',
         'rated_regionname',       'varchar', 'NULL', $char_d, '', '',
diff --git a/FS/FS/cdr/troop.pm b/FS/FS/cdr/troop.pm
index 020af2b..429c25a 100644
--- a/FS/FS/cdr/troop.pm
+++ b/FS/FS/cdr/troop.pm
@@ -7,7 +7,7 @@ use Time::Local;
 #use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
 
 %info = (
-  'name'          => 'Troop',
+  'name'          => 'Troop (old?)',
   'weight'        => 220,
   'header'        => 2,
   'type'          => 'xls',
diff --git a/FS/FS/cdr/troop2.pm b/FS/FS/cdr/troop2.pm
new file mode 100644
index 0000000..ee64740
--- /dev/null
+++ b/FS/FS/cdr/troop2.pm
@@ -0,0 +1,94 @@
+package FS::cdr::troop2;
+
+use strict;
+use base qw( FS::cdr );
+use vars qw( %info $tmp_date $tmp_src_city $tmp_dst_city );
+use Date::Parse;
+#use Time::Local;
+##use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
+
+%info = (
+  'name' => 'Troop',
+  'weight' => 219,
+  'header' => 1,
+  'type'   => 'xls',
+
+  'import_fields' => [
+
+    'userfield', #account_num  (userfield?)
+
+    #call_date
+    sub { my($cdr, $date) = @_;
+          #is this an excel date?  or just text?
+          $tmp_date = $date;
+        },
+
+    #call_time
+    sub { my($cdr, $time) = @_;
+          #is this an excel time?  or just text?
+          $cdr->startdate( str2time("$tmp_date $time") );
+        },
+
+    'src', #orig_tn
+    'dst', #term_tn
+
+     #call_dur
+    sub { my($cdr, $duration) = @_;
+          $cdr->duration($duration);
+          $cdr->billsec($duration);
+        },
+
+    'clid', #auth_code_ani (clid?)
+
+    'accountcode', #account_code
+
+    #ovs_type
+    # OVS Type / Maybe / add "011" to international calls
+    # N = DOM LD / normal
+    # Z = INTL LD
+    # O = INTL LD
+    # others...?
+    sub { my($cdr, $ovs) = @_;
+          my $pre = ( $ovs =~ /^\s*[OZ]\s*$/i ) ? '011' : '1';
+          $cdr->dst( $pre. $cdr->dst ) unless $cdr->dst =~ /^$pre/;
+        },
+
+    #orig_city
+    sub { (my $cdr, $tmp_src_city) = @_; },
+
+    #orig_prov_state
+    sub { my($cdr, $state) = @_;
+          $cdr->upstream_src_regionname("$tmp_src_city, $state");
+        },
+
+    #term_city
+    sub { (my $cdr, $tmp_dst_city) = @_; },
+
+    #term_prov_state
+    sub { my($cdr, $state) = @_;
+          $cdr->upstream_dst_regionname("$tmp_dst_city, $state");
+        },
+
+    #term_ovs
+    '', #CANADA / UNITED STATES / BELL.  huh.  country or terminating provider?
+
+    '', #cc_ind (what's this?)
+
+    'upstream_price', #call_charge
+
+    #important?
+    '', #creation_date
+    '', #creation_time
+
+    #additional upstream pricing details we don't need?
+    '', #net_charge
+    '', #surcharge
+    '', #gst
+    '', #pst
+    '', #hst
+
+  ],
+
+);
+
+1;

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

Summary of changes:
 FS/FS/Schema.pm     |    5 ++-
 FS/FS/cdr/troop.pm  |    2 +-
 FS/FS/cdr/troop2.pm |   94 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+), 2 deletions(-)
 create mode 100644 FS/FS/cdr/troop2.pm




More information about the freeside-commits mailing list