start adding package locations, RT#4499
[freeside.git] / FS / FS / Schema.pm
index 17665b1..ecf017e 100644 (file)
@@ -671,6 +671,28 @@ sub tables_hashref {
                  ],
     },
 
+    #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 +960,27 @@ 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', '', '', '',
+        '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'],