RT#22952: Employee drop down list in reports shows employee users for all agents
[freeside.git] / FS / FS / Schema.pm
index 6301df2..6ed1d97 100644 (file)
@@ -194,7 +194,8 @@ sub dbdef_dist {
     grep {    ! /^clientapi_session/
            && ! /^h_/
            && ! /^log(_context)?$/
-           && ( ! /^queue(_arg)?$/ || ! $opt->{'queue-no_history'} )
+           && ! /^legacy_cust_history$/
+           && ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
            && ! $tables_hashref_torrus->{$_}
          }
       $dbdef->tables
@@ -636,6 +637,22 @@ sub tables_hashref {
       'index'  => [ ['legacyid', 'custnum', 'locale' ], ],
     },
 
+    'legacy_cust_history' => {
+      'columns' => [
+        'legacyhistorynum', 'serial',     '',        '', '', '',
+        'custnum',             'int',     '',        '', '', '',
+        'history_action',  'varchar',     '',   $char_d, '', '',
+        'history_date',           @date_type,            '', '',
+        'history_usernum',     'int', 'NULL',        '', '', '',
+        'item',            'varchar', 'NULL',   $char_d, '', '',
+        'description',     'varchar', 'NULL', 2*$char_d, '', '',
+        'change_data',        'text', 'NULL',        '', '', '',
+      ],
+      'primary_key'  => 'legacyhistorynum',
+      'unique'       => [],
+      'index'        => [ ['custnum'], ['history_date'], ],
+    },
+
     'cust_statement' => {
       'columns' => [
         'statementnum', 'serial', '', '', '', '',
@@ -885,6 +902,7 @@ sub tables_hashref {
         'taxratelocationnum',           'int',      '', '', '', '',
         'amount',                       @money_type,        '', '',
         'taxable_billpkgnum',       'int',  'NULL', '', '', '',
+        'taxclass',             'varchar',  'NULL', 10, '', '',
       ],
       'primary_key' => 'billpkgtaxratelocationnum',
       'unique' => [],
@@ -1035,6 +1053,7 @@ sub tables_hashref {
         #void fields
         'void_date',  @date_type,                  '', '', 
         'void_reason', 'varchar', 'NULL', $char_d, '', '', 
+        'void_reasonnum', 'int', 'NULL', '', '', '', 
         'void_usernum',    'int', 'NULL',      '', '', '',
       ],
       'primary_key' => 'crednum',
@@ -1358,6 +1377,21 @@ sub tables_hashref {
       'index'  => [ [ 'quotationpkgnum' ], ], #[ 'discountnum' ] ],
     },
 
+    'quotation_pkg_tax' => {
+      'columns' => [
+        'quotationtaxnum',  'serial',     '',      '', '', '',
+        'quotationpkgnum',     'int',     '',      '', '', '',
+        'itemdesc',        'varchar',     '', $char_d, '', '',
+        'taxnum',              'int',     '',      '', '', '', 
+        'taxtype',         'varchar',     '', $char_d, '', '',
+        'setup_amount',    @money_type,                '', '',
+        'recur_amount',    @money_type,                '', '',
+      ],
+      'primary_key' => 'quotationtaxnum',,
+      'unique' => [],
+      'index'  => [ [ 'quotationpkgnum' ] ],
+    },
+
     'cust_location' => { #'location' now that its prospects too, but...
       'columns' => [
         'locationnum',      'serial',     '',      '', '', '',
@@ -1882,6 +1916,7 @@ sub tables_hashref {
         'recur_show_zero',    'char', 'NULL',  1, '', '',
         'setup_show_zero',    'char', 'NULL',  1, '', '',
         'change_to_pkgnum',    'int', 'NULL', '', '', '',
+        'separate_bill',      'char', 'NULL',  1, '', '',
       ],
       'primary_key' => 'pkgnum',
       'unique' => [],
@@ -1916,11 +1951,11 @@ sub tables_hashref {
 
     'cust_pkg_detail' => {
       'columns' => [
-        'pkgdetailnum', 'serial', '',      '', '', '',
-        'pkgnum',          'int', '',      '', '', '',
-        'detail',      'varchar', '', $char_d, '', '', 
-        'detailtype',     'char', '',       1, '', '', # "I"nvoice or "C"omment
-        'weight',          'int', '',      '', '', '',
+        'pkgdetailnum', 'serial', '',        '', '', '',
+        'pkgnum',          'int', '',        '', '', '',
+        'detail',      'varchar', '', 2*$char_d, '', '', 
+        'detailtype',     'char', '',         1, '', '', #"I"nvoice or "C"omment
+        'weight',          'int', '',        '', '', '',
       ],
       'primary_key' => 'pkgdetailnum',
       'unique' => [],
@@ -3057,6 +3092,7 @@ sub tables_hashref {
         #'custnum',      'int', '', '', '', ''
         'billpkgnum',   'int', '', '', '', '', 
         'taxnum',       'int', '', '', '', '', 
+        'taxtype',  'varchar', 'NULL', $char_d, '', '',
         'year',         'int', 'NULL', '', '', '', 
         'month',        'int', 'NULL', '', '', '', 
         'creditbillpkgnum', 'int', 'NULL', '', '', '',
@@ -3072,7 +3108,7 @@ sub tables_hashref {
       'unique' => [],
       'index'  => [ [ 'taxnum', 'year', 'month' ],
                     [ 'billpkgnum' ],
-                    [ 'taxnum' ],
+                    [ 'taxnum', 'taxtype' ],
                     [ 'creditbillpkgnum' ],
                   ],
     },
@@ -3083,6 +3119,7 @@ sub tables_hashref {
         #'custnum',      'int', '', '', '', ''
         'billpkgnum',   'int', '', '', '', '', 
         'taxnum',       'int', '', '', '', '', 
+        'taxtype',  'varchar', 'NULL', $char_d, '', '',
         'year',         'int', 'NULL', '', '', '', 
         'month',        'int', 'NULL', '', '', '', 
         'creditbillpkgnum', 'int', 'NULL', '', '', '',
@@ -3098,7 +3135,7 @@ sub tables_hashref {
       'unique' => [],
       'index'  => [ [ 'taxnum', 'year', 'month' ],
                     [ 'billpkgnum' ],
-                    [ 'taxnum' ],
+                    [ 'taxnum', 'taxtype' ],
                     [ 'creditbillpkgnum' ],
                   ],
     },
@@ -3954,11 +3991,6 @@ sub tables_hashref {
       'primary_key'  => 'itemnum',
       'unique'       => [ [ 'usernum' ] ],
       'index'        => [],
-      'foreign_keys' => [
-                          { columns    => [ 'usernum' ],
-                            table      => 'access_user',
-                          },
-                        ],
     },
 
     #'sched_item_class'
@@ -3975,11 +4007,6 @@ sub tables_hashref {
       'primary_key'  => 'availnum',
       'unique'       => [],
       'index'        => [],
-      'foreign_keys' => [
-                          { columns    => [ 'itemnum' ],
-                            table      => 'sched_item',
-                          },
-                        ],
     },
 
     'svc_phone' => {
@@ -4221,15 +4248,6 @@ sub tables_hashref {
       'primary_key'  => 'extensionnum',
       'unique'       => [ [ 'svcnum', 'extension' ] ],
       'index'        => [ [ 'svcnum' ] ],
-      'foreign_keys' => [
-                          { columns    => [ 'svcnum' ],
-                            table      => 'svc_pbx',
-                          },
-                          { columns    => [ 'circuit_svcnum' ],
-                            table      => 'svc_circuit',
-                            references => [ 'svcnum' ],
-                          },
-                        ],
     },
 
     'svc_mailinglist' => { #svc_group?
@@ -4602,20 +4620,6 @@ sub tables_hashref {
       'primary_key' => 'svcnum',
       'unique'      => [],
       'index'       => [ [ 'providernum' ], [ 'typenum' ] ],
-      'foreign_keys' => [
-                          { columns => [ 'svcnum' ],
-                            table   => 'cust_svc',
-                          },
-                          { columns => [ 'typenum' ],
-                            table   => 'circuit_type',
-                          },
-                          { columns => [ 'providernum' ],
-                            table   => 'circuit_provider',
-                          },
-                          { columns => [ 'termnum' ],
-                            table   => 'circuit_termination',
-                          },
-      ],
     },
     %{ tables_hashref_torrus() },
 
@@ -4688,12 +4692,6 @@ sub tables_hashref {
       'primary_key'  => 'batchnum',
       'unique'       => [],
       'index'        => [ [ 'exportnum' ], [ 'status' ] ],
-      'foreign_keys' => [
-                          { columns    => [ 'exportnum' ],
-                            table      => 'part_export',
-                            references => [ 'exportnum' ]
-                          },
-                        ],
     },
 
     'export_batch_item' => {
@@ -4708,12 +4706,6 @@ sub tables_hashref {
       'primary_key'  => 'itemnum',
       'unique'       => [],
       'index'        => [ [ 'batchnum' ], [ 'svcnum' ] ],
-      'foreign_keys' => [
-                          { columns    => [ 'batchnum' ],
-                            table      => 'export_batch',
-                            references => [ 'batchnum' ]
-                          },
-                        ],
     },
 
     # lookup table for states, similar to msa and lata
@@ -4753,12 +4745,6 @@ sub tables_hashref {
       'primary_key' => 'zonenum',
       'unique' => [],
       'index'  => [ [ 'agentnum' ] ],
-      'foreign_keys' => [
-                          { columns     => [ 'agentnum' ],
-                            table       => 'agent',
-                            references  => [ 'agentnum' ],
-                          },
-                        ],
     },
 
     'deploy_zone_block' => {
@@ -4771,12 +4757,6 @@ sub tables_hashref {
       'primary_key' => 'blocknum',
       'unique' => [],
       'index'  => [ [ 'zonenum' ] ],
-      'foreign_keys' => [
-                          { columns     => [ 'zonenum' ],
-                            table       => 'deploy_zone',
-                            references  => [ 'zonenum' ],
-                          },
-                        ],
     },
 
     'deploy_zone_vertex' => {
@@ -4789,12 +4769,6 @@ sub tables_hashref {
       'primary_key' => 'vertexnum',
       'unique' => [ ],
       'index'  => [ ],
-      'foreign_keys' => [
-                          { columns     => [ 'zonenum' ],
-                            table       => 'deploy_zone',
-                            references  => [ 'zonenum' ],
-                          },
-                        ],
     },