more flexible package suspend/unsuspend fees, #26828
[freeside.git] / FS / FS / Schema.pm
index e63dba6..fc56d90 100644 (file)
@@ -947,9 +947,9 @@ sub tables_hashref {
                           { columns => [ 'eventnum' ],
                             table   => 'cust_event',
                           },
-                          { columns => [ 'billpkgnum' ],
-                            table   => 'cust_bill_pkg',
-                          },
+                          #{ columns => [ 'billpkgnum' ],
+                          #  table   => 'cust_bill_pkg',
+                          #},
                           { columns => [ 'feepart' ],
                             table   => 'part_fee',
                           },
@@ -1078,17 +1078,31 @@ sub tables_hashref {
                           { columns     => [ 'billpkgnum' ],
                             table       => 'cust_bill_pkg',
                           },
-                          { columns     => [ 'base_billpkgnum' ],
-                            table       => 'cust_bill_pkg',
-                            references  => [ 'billpkgnum' ],
-                          },
-                          { columns     => [ 'base_invnum' ],
-                            table       => 'cust_bill',
-                            references  => [ 'invnum' ],
+                        ],
+    },
+
+    'cust_bill_pkg_fee_void' => {
+      'columns' => [
+        'billpkgfeenum',    'serial', '', '', '', '',
+        'billpkgnum',          'int', '', '', '', '',
+        'base_invnum',       'int', '', '', '', '',
+        'base_billpkgnum',   'int', 'NULL', '', '', '',
+        'amount',        @money_type,         '', '',
+      ],
+      'primary_key' => 'billpkgfeenum',
+      'unique'      => [],
+      'index'       => [ ['billpkgnum'],
+                         ['base_invnum'],
+                         ['base_billpkgnum'],
+                       ],
+      'foreign_keys' => [
+                          { columns     => [ 'billpkgnum' ],
+                            table       => 'cust_bill_pkg_void',
                           },
                         ],
     },
 
+
     'cust_bill_pkg_tax_location' => {
       'columns' => [
         'billpkgtaxlocationnum', 'serial',     '',      '', '', '',
@@ -1119,10 +1133,10 @@ sub tables_hashref {
                           { columns    => [ 'locationnum' ],
                             table      => 'cust_location',
                           },
-                          { columns    => [ 'taxable_billpkgnum' ],
-                            table      => 'cust_bill_pkg',
-                            references => [ 'billpkgnum' ],
-                          },
+                          #{ columns    => [ 'taxable_billpkgnum' ],
+                          #  table      => 'cust_bill_pkg',
+                          #  references => [ 'billpkgnum' ],
+                          #},
                         ],
     },
 
@@ -1150,10 +1164,10 @@ sub tables_hashref {
                           { columns    => [ 'taxratelocationnum' ],
                             table      => 'tax_rate_location',
                           },
-                          { columns    => [ 'taxable_billpkgnum' ],
-                            table      => 'cust_bill_pkg',
-                            references => [ 'billpkgnum' ],
-                          },
+                          #{ columns    => [ 'taxable_billpkgnum' ],
+                          #  table      => 'cust_bill_pkg',
+                          #  references => [ 'billpkgnum' ],
+                          #},
                         ],
     },
 
@@ -1177,6 +1191,7 @@ sub tables_hashref {
         'unitsetup',           @money_typen,            '', '', 
         'unitrecur',           @money_typen,            '', '', 
         'hidden',              'char', 'NULL',       1, '', '',
+        'feepart',              'int', 'NULL',      '', '', '',
         #void fields
         'void_date', @date_type, '', '', 
         'reason',    'varchar',   'NULL', $char_d, '', '', 
@@ -1283,16 +1298,13 @@ sub tables_hashref {
                           { columns    => [ 'billpkgnum' ],
                             table      => 'cust_bill_pkg_void',
                           },
-                          { columns    => [ 'pkgnum' ],
-                            table      => 'cust_pkg',
-                          },
                           { columns    => [ 'locationnum' ],
                             table      => 'cust_location',
                           },
-                          { columns    => [ 'taxable_billpkgnum' ],
-                            table      => 'cust_bill_pkg_void',
-                            references => [ 'billpkgnum' ],
-                          },
+                          #{ columns    => [ 'taxable_billpkgnum' ],
+                          #  table      => 'cust_bill_pkg_void',
+                          #  references => [ 'billpkgnum' ],
+                          #},
                         ],
     },
 
@@ -1633,6 +1645,7 @@ sub tables_hashref {
         'complimentary', 'char', 'NULL', 1, '', '',
         'po_number', 'varchar', 'NULL', $char_d, '', '',
         'invoice_attn', 'varchar', 'NULL', $char_d, '', '',
+        'invoice_ship_address', 'char', 'NULL', 1, '', '',
       ],
       'primary_key'  => 'custnum',
       'unique'       => [ [ 'agentnum', 'agent_custid' ] ],
@@ -1967,6 +1980,26 @@ sub tables_hashref {
                         ],
     },
 
+    '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' ] ],
+      'foreign_keys' => [
+                          { columns    => [ 'quotationpkgnum' ],
+                            table      => 'quotation_pkg',
+                          },
+                        ],
+},
+
     'cust_location' => { #'location' now that its prospects too, but...
       'columns' => [
         'locationnum',      'serial',     '',      '', '', '',
@@ -2818,6 +2851,29 @@ sub tables_hashref {
                         ],
     },
 
+    'cust_pkg_reason_fee' => {
+      'columns' => [
+        'pkgreasonfeenum', 'serial', '', '', '', '',
+        'pkgreasonnum',       'int', '', '', '', '',
+        'billpkgnum',         'int', 'NULL', '', '', '',
+        'feepart',            'int', '', '', '', '',
+        'nextbill',          'char', 'NULL',  1, '', '',
+      ],
+      'primary_key'  => 'pkgreasonfeenum',
+      'unique' => [ [ 'billpkgnum' ], [ 'pkgreasonnum' ] ], # one-to-one link
+      'index'  => [ [ 'feepart' ] ],
+      'foreign_keys' => [
+                          { columns     => [ 'pkgreasonnum' ],
+                            table       => 'cust_pkg_reason',
+                            references  => [ 'num' ],
+                          },
+                          { columns     => [ 'feepart' ],
+                            table       => 'part_fee',
+                          },
+                          # can't link billpkgnum, because of voids
+      ],
+    },
+
     'cust_pkg_discount' => {
       'columns' => [
         'pkgdiscountnum', 'serial', '',        '', '', '',
@@ -5951,6 +6007,9 @@ sub tables_hashref {
         'unsuspend_pkgpart', 'int',  'NULL', '', '', '',
         'unsuspend_hold','char',    'NULL', 1, '', '',
         'unused_credit', 'char',    'NULL', 1, '', '',
+        'feepart',        'int', 'NULL', '', '', '',
+        'fee_on_unsuspend','char',  'NULL', 1, '', '',
+        'fee_hold',      'char',    'NULL', 1, '', '',
       ],
       'primary_key'  => 'reasonnum',
       'unique'       => [],