contacts can be shared among customers / "duplicate contact emails", RT#27943
[freeside.git] / FS / FS / Schema.pm
index e854dc6..133b6d8 100644 (file)
@@ -1526,6 +1526,27 @@ sub tables_hashref {
                         ],
     },
 
+    'cust_credit_source_bill_pkg' => {
+      'columns' => [
+        'creditsourcebillpkgnum', 'serial',     '', '', '', '',
+        'crednum',                   'int',     '', '', '', '',
+        'billpkgnum',                'int',     '', '', '', '',
+        'amount',              @money_type,             '', '',
+        'currency',                 'char', 'NULL',  3, '', '',
+      ],
+      'primary_key'  => 'creditsourcebillpkgnum',
+      'unique'       => [],
+      'index'        => [ ['crednum'], ['billpkgnum'] ],
+      'foreign_keys' => [
+                          { columns => ['billpkgnum'],
+                            table   => 'cust_bill_pkg',
+                          },
+                          { columns => ['crednum'],
+                            table   => 'cust_credit',
+                          },
+                        ],
+    },
+
     'cust_main' => {
       'columns' => [
         'custnum',  'serial',  '',     '', '', '', 
@@ -1719,20 +1740,69 @@ sub tables_hashref {
       'index' => [ ['disabled'] ],
     },
 
+    'cust_contact' => {
+      'columns' => [
+        'custcontactnum',     'serial',     '',  '', '', '',
+        'custnum',               'int',     '',  '', '', '',
+        'contactnum',            'int',     '',  '', '', '',
+        'classnum',              'int', 'NULL',  '', '', '',
+        'comment',           'varchar', 'NULL', 255, '', '',
+        'selfservice_access',   'char', 'NULL',   1, '', '',
+      ],
+      'primary_key'  => 'custcontactnum',
+      'unique'       => [ [ 'custnum', 'contactnum' ], ],
+      'index'        => [ [ 'custnum' ], [ 'contactnum' ], ],
+      'foreign_keys' => [
+                          { columns    => [ 'custnum' ],
+                            table      => 'cust_main',
+                          },
+                          { columns    => [ 'contactnum' ],
+                            table      => 'contact',
+                          },
+                          { columns    => [ 'classnum' ],
+                            table      => 'contact_class',
+                          },
+                        ],
+    },
+
+    'prospect_contact' => {
+      'columns' => [
+        'prospectcontactnum', 'serial',     '',  '', '', '',
+        'prospectnum',       'int',     '',  '', '', '',
+        'contactnum',        'int',     '',  '', '', '',
+        'classnum',          'int', 'NULL',  '', '', '',
+        'comment',       'varchar', 'NULL', 255, '', '',
+      ],
+      'primary_key'  => 'prospectcontactnum',
+      'unique'       => [ [ 'prospectnum', 'contactnum' ], ],
+      'index'        => [ [ 'prospectnum' ], [ 'contactnum' ], ],
+      'foreign_keys' => [
+                          { columns    => [ 'prospectnum' ],
+                            table      => 'prospect_main',
+                          },
+                          { columns    => [ 'contactnum' ],
+                            table      => 'contact',
+                          },
+                          { columns    => [ 'classnum' ],
+                            table      => 'contact_class',
+                          },
+                        ],
+    },
+
     'contact' => {
       'columns' => [
         'contactnum', 'serial',     '',      '', '', '',
-        'prospectnum',   'int', 'NULL',      '', '', '',
-        'custnum',       'int', 'NULL',      '', '', '',
+        'prospectnum',   'int', 'NULL',      '', '', '', #deprecated, now prospect_contact table
+        'custnum',       'int', 'NULL',      '', '', '', #deprecated, now cust_contact table
         'locationnum',   'int', 'NULL',      '', '', '', #not yet
-        'classnum',      'int', 'NULL',      '', '', '',
+        'classnum',      'int', 'NULL',      '', '', '', #deprecated, now prospect_contact or cust_contact
 #        'titlenum',      'int', 'NULL',      '', '', '', #eg Mr. Mrs. Dr. Rev.
         'last',      'varchar',     '', $char_d, '', '', 
 #        'middle',    'varchar', 'NULL', $char_d, '', '', 
         'first',     'varchar',     '', $char_d, '', '', 
         'title',     'varchar', 'NULL', $char_d, '', '', #eg Head Bottle Washer
-        'comment',   'varchar', 'NULL',     255, '', '', 
-        'selfservice_access',    'char', 'NULL',       1, '', '',
+        'comment',   'varchar', 'NULL',     255, '', '',  #depredated, now prospect_contact or cust_contact
+        'selfservice_access',    'char', 'NULL',       1, '', '', #deprecated, now cust_contact
         '_password',          'varchar', 'NULL', $char_d, '', '',
         '_password_encoding', 'varchar', 'NULL', $char_d, '', '',
         'disabled',              'char', 'NULL',       1, '', '', 
@@ -1874,6 +1944,8 @@ sub tables_hashref {
         'contract_end',    @date_type,             '', '',
         'quantity',             'int', 'NULL', '', '', '',
         'waive_setup',         'char', 'NULL',  1, '', '', 
+        'unitsetup',     @money_typen,             '', '',
+        'unitrecur',     @money_typen,             '', '',
       ],
       'primary_key'  => 'quotationpkgnum',
       'unique'       => [],
@@ -1896,6 +1968,8 @@ sub tables_hashref {
         'quotationpkgdiscountnum', 'serial', '', '', '', '',
         'quotationpkgnum',            'int', '', '', '', '', 
         'discountnum',                'int', '', '', '', '',
+        'setup_amount',        @money_typen,         '', '',
+        'recur_amount',        @money_typen,         '', '',
         #'end_date',              @date_type,         '', '',
       ],
       'primary_key'  => 'quotationpkgdiscountnum',
@@ -1992,13 +2066,14 @@ sub tables_hashref {
 
     'cust_main_note' => {
       'columns' => [
-        'notenum',  'serial',  '',     '', '', '', 
-        'custnum',  'int',  '',     '', '', '', 
-        'classnum',      'int',     'NULL', '', '', '', 
-        '_date',    @date_type, '', '', 
-        'otaker',   'varchar', 'NULL',    32, '', '', 
-        'usernum',   'int', 'NULL', '', '', '',
-        'comments', 'text', 'NULL', '', '', '', 
+        'notenum',   'serial',    '',  '', '', '', 
+        'custnum',      'int',    '',  '', '', '', 
+        'classnum',     'int', 'NULL', '', '', '', 
+        '_date',          @date_type,      '', '', 
+        'otaker',   'varchar', 'NULL', 32, '', '', 
+        'usernum',      'int', 'NULL', '', '', '',
+        'comments',    'text', 'NULL', '', '', '', 
+        'sticky',       'int',     '', '',  0, '',
       ],
       'primary_key'  => 'notenum',
       'unique'       => [],