implement package changes w/location change, RT#4499
[freeside.git] / FS / FS / Schema.pm
index 17665b1..2c3c967 100644 (file)
@@ -661,16 +661,45 @@ sub tables_hashref {
       'primary_key' => 'custnum',
       'unique' => [ [ 'agentnum', 'agent_custid' ] ],
       #'index' => [ ['last'], ['company'] ],
-      'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ],
-                   [ 'daytime' ], [ 'night' ], [ 'fax' ], [ 'refnum' ],
-                   [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ],
+      'index' => [
+                   [ 'agentnum' ], [ 'refnum' ], [ 'custbatch' ],
+                   [ 'referral_custnum' ],
+                   [ 'payby' ], [ 'paydate' ],
+                   #billing
+                   [ 'last' ], [ 'company' ],
+                   [ 'county' ], [ 'state' ], [ 'country' ],
+                   [ 'zip' ],
+                   [ 'daytime' ], [ 'night' ], [ 'fax' ],
+                   #shipping
                    [ 'ship_last' ], [ 'ship_company' ],
+                   [ 'ship_county' ], [ 'ship_state' ], [ 'ship_country' ],
+                   [ 'ship_zip' ],
                    [ 'ship_daytime' ], [ 'ship_night' ], [ 'ship_fax' ],
-                   [ 'payby' ], [ 'paydate' ],
-                   [ 'agentnum' ], [ 'custbatch' ],
                  ],
     },
 
+    #eventually use for billing & ship from cust_main too
+    #for now, just cust_pkg locations
+    'cust_location' => {
+      'columns' => [
+        'locationnum',  'serial',     '',      '', '', '',
+        'custnum',         'int',     '',      '', '', '',
+        'address1',    'varchar',     '', $char_d, '', '', 
+        'address2',    'varchar', 'NULL', $char_d, '', '', 
+        'city',        'varchar',     '', $char_d, '', '', 
+        'county',      'varchar', 'NULL', $char_d, '', '', 
+        'state',       'varchar', 'NULL', $char_d, '', '', 
+        'zip',         'varchar', 'NULL',      10, '', '', 
+        'country',        'char',     '',       2, '', '', 
+        'geocode',     'varchar', 'NULL',      20, '', '',
+      ],
+      'primary_key' => 'locationnum',
+      'unique'      => [],
+      'index'       => [ [ 'custnum' ],
+                         [ 'county' ], [ 'state' ], [ 'country' ], [ 'zip' ],
+                       ],
+    },
+
     'cust_main_invoice' => {
       'columns' => [
         'destnum',  'serial',  '',     '', '', '', 
@@ -938,26 +967,28 @@ sub tables_hashref {
 
     'cust_pkg' => {
       'columns' => [
-        'pkgnum',         'serial',    '',   '', '', '', 
-        'custnum',        'int',    '',   '', '', '', 
-        'pkgpart',        'int',    '',   '', '', '', 
-        'otaker',         'varchar', '', 32, '', '', 
-        'setup',          @date_type, '', '', 
-        'bill',           @date_type, '', '', 
-        'last_bill',      @date_type, '', '', 
-        'susp',           @date_type, '', '', 
-        'adjourn',        @date_type, '', '', 
-        'cancel',         @date_type, '', '', 
-        'expire',         @date_type, '', '', 
-        'change_date',    @date_type, '', '',
-        'change_pkgnum',  'int', 'NULL', '', '', '',
-        'change_pkgpart', 'int', 'NULL', '', '', '',
-        'manual_flag',    'char', 'NULL', 1, '', '', 
-        'quantity',       'int', 'NULL', '', '', '',
+        'pkgnum',           'serial',     '', '', '', '', 
+        'custnum',             'int',     '', '', '', '', 
+        'pkgpart',             'int',     '', '', '', '', 
+        'locationnum',         'int', 'NULL', '', '', '',
+        'otaker',          'varchar',     '', 32, '', '', 
+        'setup',          @date_type,             '', '', 
+        'bill',           @date_type,             '', '', 
+        'last_bill',      @date_type,             '', '', 
+        'susp',           @date_type,             '', '', 
+        'adjourn',        @date_type,             '', '', 
+        'cancel',         @date_type,             '', '', 
+        'expire',         @date_type,             '', '', 
+        'change_date',    @date_type,             '', '',
+        'change_pkgnum',       'int', 'NULL', '', '', '',
+        'change_pkgpart',      'int', 'NULL', '', '', '',
+        'change_locationnum',  'int', 'NULL', '', '', '',
+        'manual_flag',        'char', 'NULL',  1, '', '', 
+        'quantity',            'int', 'NULL', '', '', '',
       ],
       'primary_key' => 'pkgnum',
       'unique' => [],
-      'index' => [ ['custnum'], ['pkgpart'],
+      'index' => [ ['custnum'], ['pkgpart'], [ 'locationnum' ],
                    ['setup'], ['last_bill'], ['bill'], ['susp'], ['adjourn'],
                    ['expire'], ['cancel'],
                    ['change_date'],
@@ -1971,7 +2002,7 @@ sub tables_hashref {
       ],
       'primary_key' => 'acctid',
       'unique' => [],
-      'index' => [ [ 'calldate' ], [ 'dst' ], [ 'accountcode' ], [ 'freesidestatus' ], [ 'cdrbatch' ], ],
+      'index' => [ [ 'calldate' ], [ 'src' ], [ 'dst' ], [ 'charged_party' ], [ 'accountcode' ], [ 'freesidestatus' ], [ 'cdrbatch' ], ],
     },
 
     'cdr_calltype' => {
@@ -2016,6 +2047,21 @@ sub tables_hashref {
       'index'  => [],
     },
 
+    #'cdr_file' => {
+    #  'columns' => [
+    #    'filenum',    'serial',     '', '', '', '',
+    #    'filename',  'varchar',     '', '', '', '',
+    #    'status',    'varchar', 'NULL', '', '', '',
+    #  ],
+    #  'primary_key' => 'filenum',
+    #  'unique' => [ [ 'filename' ], ], #just change the index if we need to
+    #                                   # agent-virtualize or have a customer
+    #                                   # with dup-filename needs or something
+    #                                   # (only used by cdr.http_and_import for
+    #                                   #  chrissakes)
+    #  'index'  => [],
+    #},
+
     'inventory_item' => {
       'columns' => [
         'itemnum',  'serial',      '',      '', '', '',