rate tiers for vnes, RT#14903
[freeside.git] / FS / FS / Schema.pm
index 9733e85..0568bdf 100644 (file)
@@ -549,10 +549,11 @@ sub tables_hashref {
         'charged',    @money_type,                  '', '', 
         'content_pdf',     'blob', 'NULL',      '', '', '',
         'content_html',    'text', 'NULL',      '', '', '',
+        'locale',       'varchar', 'NULL',      16, '', '', 
       ],
       'primary_key' => 'legacyinvnum',
       'unique' => [],
-      'index'  => [ ['legacyid', 'custnum'], ],
+      'index'  => [ ['legacyid', 'custnum', 'locale' ], ],
     },
 
     'cust_statement' => {
@@ -2011,31 +2012,32 @@ sub tables_hashref {
     
     'svc_dsl' => {
       'columns' => [
-        'svcnum',           'int',    '',        '', '', '',
-       'pushed',     'int', 'NULL',       '', '', '',
-       'desired_due_date',     'int', 'NULL',       '', '', '',
-       'due_date',     'int', 'NULL',       '', '', '',
-        'vendor_order_id',              'varchar', 'NULL', $char_d,  '', '',
-        'vendor_qual_id',              'varchar', 'NULL', $char_d,  '', '',
-        'vendor_order_type',   'varchar', 'NULL', $char_d,  '', '',
+        'svcnum',                    'int',    '',        '', '', '',
+        'pushed',                    'int', 'NULL',       '', '', '',
+        'desired_due_date',          'int', 'NULL',       '', '', '',
+        'due_date',                  'int', 'NULL',       '', '', '',
+        'vendor_order_id',       'varchar', 'NULL', $char_d,  '', '',
+        'vendor_qual_id',        'varchar', 'NULL', $char_d,  '', '',
+        'vendor_order_type',     'varchar', 'NULL', $char_d,  '', '',
         'vendor_order_status',   'varchar', 'NULL', $char_d,  '', '',
-        'first',              'varchar', 'NULL', $char_d,  '', '',
-        'last',              'varchar', 'NULL', $char_d,  '', '',
-        'company',              'varchar', 'NULL', $char_d,  '', '',
-       'phonenum',     'varchar', 'NULL',       24, '', '',
-        'loop_type',   'char', 'NULL',       1,  '', '', 
-        'local_voice_provider', 'varchar', 'NULL', $char_d,  '', '',
-        'circuitnum',              'varchar', 'NULL', $char_d,  '', '',
-        'rate_band',              'varchar', 'NULL', $char_d,  '', '',
-       'vpi',     'int', 'NULL',       '', '', '',
-       'vci',     'int', 'NULL',       '', '', '',
-        'isp_chg',   'char', 'NULL',       1,  '', '', 
-        'isp_prev',              'varchar', 'NULL', $char_d,  '', '',
-        'username',              'varchar', 'NULL', $char_d,  '', '',
-        'password',              'varchar', 'NULL', $char_d,  '', '',
-        'staticips',             'text', 'NULL', '',  '', '',
-        'monitored',           'char', 'NULL',       1,  '', '', 
-       'last_pull',     'int', 'NULL',       '', '', '',
+        'first',                 'varchar', 'NULL', $char_d,  '', '',
+        'last',                  'varchar', 'NULL', $char_d,  '', '',
+        'company',               'varchar', 'NULL', $char_d,  '', '',
+        'phonenum',              'varchar', 'NULL',      24, '', '',
+        'gateway_access_number', 'varchar', 'NULL',      24, '', '',
+        'loop_type',                'char', 'NULL',       1, '', '', 
+        'local_voice_provider',  'varchar', 'NULL', $char_d, '', '',
+        'circuitnum',            'varchar', 'NULL', $char_d, '', '',
+        'rate_band',             'varchar', 'NULL', $char_d, '', '',
+        'vpi',                       'int', 'NULL',      '', '', '',
+        'vci',                       'int', 'NULL',      '', '', '',
+        'isp_chg',                  'char', 'NULL',       1, '', '', 
+        'isp_prev',              'varchar', 'NULL', $char_d, '', '',
+        'username',              'varchar', 'NULL', $char_d, '', '',
+        'password',              'varchar', 'NULL', $char_d, '', '',
+        'staticips',                'text', 'NULL',      '', '', '',
+        'monitored',                'char', 'NULL',       1, '', '', 
+        'last_pull',                 'int', 'NULL',      '', '', '',
       ],
       'primary_key' => 'svcnum',
       'unique' => [ ],
@@ -2686,6 +2688,30 @@ sub tables_hashref {
       'index'       => [],
     },
 
+    #not really part of the above rate_ stuff (used with flat rate rather than
+    # rated billing), but could be eventually, and its a rate
+    'rate_tier' => {
+      'columns' => [
+        'tiernum',   'serial', '',      '', '', '',
+        'tiername', 'varchar', '', $char_d, '', '',
+      ],
+      'primary_key' => 'tiernum',
+      'unique'      => [ [ 'tiername'], ],
+      'index'       => [],
+    },
+
+    'rate_tier_detail' => {
+      'columns' => [
+        'tierdetailnum', 'serial', '',     '', '', '',
+        'tiernum',          'int', '',     '', '', '',
+        'min_quan',         'int', '',     '', '', '',
+        'min_charge',   'decimal', '', '10,4', '', '',
+      ],
+      'primary_key' => 'tierdetailnum',
+      'unique'      => [],
+      'index'       => [ ['tiernum'], ],
+    },
+
     'usage_class' => {
       'columns' => [
         'classnum',    'serial',      '',      '', '', '', 
@@ -2873,24 +2899,17 @@ sub tables_hashref {
         'max_callers', 'int',  'NULL',      '',    '', '',
 
         ###
-        # fields for unitel/RSLCOM/convergent that don't map well to asterisk
-        # defaults
-        # though these are now used elsewhere:
+        # old fields for unitel/RSLCOM/convergent that don't map to asterisk
+        # ones we adoped moved to "own fields" section below
         # charged_party, upstream_price, rated_price, carrierid, cdrtypenum
         ###
 
-        #cdr_type: Usage = 1, S&E = 7, OC&C = 8
-        'cdrtypenum',              'int', 'NULL',      '', '', '',
-
-        'charged_party',       'varchar', 'NULL', $char_d, '', '',
-
         'upstream_currency',      'char', 'NULL',       3, '', '',
         'upstream_price',      'decimal', 'NULL',  '10,4', '', '', 
         'upstream_rateplanid',     'int', 'NULL',      '', '', '', #?
 
         # how it was rated internally...
         'ratedetailnum',           'int', 'NULL',      '', '', '',
-        'rated_price',         'decimal', 'NULL',  '10,4', '', '',
 
         'distance',            'decimal', 'NULL',      '', '', '',
         'islocal',                 'int', 'NULL',      '', '', '', # '',  '', 0, '' instead?
@@ -2901,16 +2920,24 @@ sub tables_hashref {
         'description',         'varchar', 'NULL', $char_d, '', '',
         'quantity',                'int', 'NULL',      '', '', '', 
 
-        #cdr_carrier: Telstra =1, Optus = 2, RSL COM = 3
-        'carrierid',               'int', 'NULL',      '', '', '',
-
         'upstream_rateid',         'int', 'NULL',      '', '', '',
         
         ###
         #and now for our own fields
         ###
 
-        # a svcnum... right..?
+        'cdrtypenum',              'int', 'NULL',      '', '', '',
+
+        'charged_party',       'varchar', 'NULL', $char_d, '', '',
+
+        # how it was rated internally...
+        'rated_price',         'decimal', 'NULL',  '10,4', '', '',
+        'rated_seconds',           'int', 'NULL',      '', '', '',
+        'rated_minutes', 'double precision', 'NULL',   '', '', '',
+
+        'carrierid',               'int', 'NULL',      '', '', '',
+
+        # service it was matched to
         'svcnum',             'int',   'NULL',     '',   '', '', 
 
         #NULL, done (or something)
@@ -2961,6 +2988,8 @@ sub tables_hashref {
         'acctid',        'bigint',     '',      '', '', '', 
         'termpart',         'int',     '',      '', '', '',#future use see below
         'rated_price',  'decimal', 'NULL',  '10,4', '', '',
+        'rated_seconds',    'int', 'NULL',      '', '', '',
+        'rated_minutes', 'double precision', 'NULL',   '', '', '',
         'status',       'varchar', 'NULL',      32, '', '',
         'svcnum',           'int', 'NULL',      '', '', '',
       ],