cust_bill_pay and cust_credit_refund.
[freeside.git] / bin / fs-setup
index ec8b750..2cba840 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.42 2001-08-13 00:19:02 ivan Exp $
+# $Id: fs-setup,v 1.45 2001-09-01 20:11:07 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
@@ -92,10 +92,11 @@ my($dbdef) = new DBIx::DBSchema ( map {
   );
 } (keys %tables) );
 
-#remove ship_ from cust_main
-unless ($ship) {
-  my $cust_main = $dbdef->table('cust_main');
+my $cust_main = $dbdef->table('cust_main');
+unless ($ship) { #remove ship_ from cust_main
   $cust_main->delcolumn($_) foreach ( grep /^ship_/, $cust_main->columns );
+} else { #add indices on ship_last and ship_company
+  push @{$cust_main->index->lol_ref}, ( ['ship_last'], ['ship_company'] ) 
 }
 
 #add radius attributes to svc_acct
@@ -358,12 +359,13 @@ sub tables_hash_hack {
         'tax',      'char', 'NULL', 1,
         'otaker',   'varchar', '',     8,
         'refnum',   'int',  '',     '',
+        'referral_custnum', 'int',  'NULL', '',
         'comments', 'varchar', 'NULL', '',
       ],
       'primary_key' => 'custnum',
       'unique' => [ [] ],
       #'index' => [ ['last'], ['company'] ],
-      'index' => [ ['last'], ],
+      'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ] ],
     },
 
     'cust_main_invoice' => {
@@ -396,7 +398,7 @@ sub tables_hash_hack {
     'cust_pay' => {
       'columns' => [
         'paynum',   'int',    '',   '',
-        'invnum',   'int',    '',   '',
+        #now cust_bill_pay #'invnum',   'int',    '',   '',
         'paid',     @money_type,
         '_date',    @date_type,
         'payby',    'char',   '',     4, # CARD/BILL/COMP, should be index into
@@ -409,6 +411,19 @@ sub tables_hash_hack {
       'index' => [ ['invnum'] ],
     },
 
+    'cust_bill_pay' => {
+      'column' => [
+        'billpaynum', 'int',     '',   '',
+        'invnum',  'int',     '',   '',
+        'paynum',  'int',     '',   '',
+        'amount',  @money_type,
+        '_date',   @date_type
+      ],
+      'primary_key' => 'billpaynum'
+      'unique' => [ [] ],
+      'index' => [ [ 'paynum', 'invnum' ] ],
+    },
+
     'cust_pay_batch' => { #what's this used for again?  list of customers
                           #in current CARD batch? (necessarily CARD?)
       'columns' => [
@@ -454,7 +469,7 @@ sub tables_hash_hack {
     'cust_refund' => {
       'columns' => [
         'refundnum',    'int',    '',   '',
-        'crednum',      'int',    '',   '',
+        #now cust_credit_refund #'crednum',      'int',    '',   '',
         '_date',        @date_type,
         'refund',       @money_type,
         'otaker',       'varchar',   '',   8,
@@ -462,12 +477,27 @@ sub tables_hash_hack {
         'payby',        'char',   '',     4, # CARD/BILL/COMP, should be index
                                              # into payment type table.
         'payinfo',      'varchar',   'NULL', 16,  #see cust_main above
+        'paybatch',     'varchar',   'NULL', $char_d,
       ],
       'primary_key' => 'refundnum',
       'unique' => [ [] ],
       'index' => [ ['crednum'] ],
     },
 
+    'cust_credit_refund' => {
+      'column' => [
+        'creditrefundnum', 'int',     '',   '',
+        'crednum',  'int',     '',   '',
+        'refundnum',  'int',     '',   '',
+        'amount',  @money_type,
+        '_date',   @date_type
+      ],
+      'primary_key' => 'creditrefundnum'
+      'unique' => [ [] ],
+      'index' => [ [ 'crednum', 'refundnum' ] ],
+    },
+
+
     'cust_svc' => {
       'columns' => [
         'svcnum',    'int',    '',   '',
@@ -597,7 +627,7 @@ sub tables_hash_hack {
       'columns' => [
         'svcnum',    'int',    '',   '',
         'domain',    'varchar',    '',   $char_d,
-        'catchall',  'int',    '',    '',
+        'catchall',  'int', 'NULL',    '',
       ],
       'primary_key' => 'svcnum',
       'unique' => [ ['domain'] ],