improved svc_acct replacement
[freeside.git] / bin / fs-setup
index 52a2505..4df3773 100755 (executable)
@@ -1,13 +1,13 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.59 2001-09-26 09:17:06 ivan Exp $
+# $Id: fs-setup,v 1.66 2001-10-30 19:05:27 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
 
 use strict;
 use DBI;
-use DBIx::DBSchema 0.18;
+use DBIx::DBSchema 0.19;
 use DBIx::DBSchema::Table;
 use DBIx::DBSchema::Column;
 use DBIx::DBSchema::ColGroup::Unique;
@@ -30,14 +30,18 @@ my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc;
 
 ###
 
-print "\nEnter the maximum username length: ";
-my($username_len)=&getvalue;
+#print "\nEnter the maximum username length: ";
+#my($username_len)=&getvalue;
+my $username_len = 32; #usernamemax config file
 
 print "\n\n", <<END, ":";
-Freeside tracks the RADIUS attributes User-Name, check attribute Password and
+Freeside tracks the RADIUS User-Name, check attribute Password and
 reply attribute Framed-IP-Address for each user.  You can specify additional
-check and reply attributes.  First enter any additional RADIUS check attributes
-you need to track for each user, separated by whitespace.
+check and reply attributes (or you can add them later with the
+fs-radius-add-check and fs-radius-add-reply programs).
+
+First enter any additional RADIUS check attributes you need to track for each 
+user, separated by whitespace.
 END
 my @check_attributes = map { $attrib2db{lc($_)} or die "unknown attribute $_"; }
                          split(" ",&getvalue);
@@ -73,7 +77,7 @@ my($char_d) = 80; #default maxlength for text fields
 
 #my(@date_type)  = ( 'timestamp', '', ''     );
 my(@date_type)  = ( 'int', 'NULL', ''     );
-my(@perl_type) = ( 'varchar', 'NULL', 255  ); 
+my(@perl_type) = ( 'text', 'NULL', ''  ); 
 my @money_type = ( 'decimal',   '', '10,2' );
 
 ###
@@ -316,7 +320,7 @@ sub tables_hash_hack {
         '_date',    @date_type,
         'amount',   @money_type,
         'otaker',   'varchar', '', 8,
-        'reason',   'varchar', 'NULL', 255,
+        'reason',   'text', 'NULL', '',
       ],
       'primary_key' => 'crednum',
       'unique' => [ [] ],
@@ -379,7 +383,7 @@ sub tables_hash_hack {
         'otaker',   'varchar', '',     8,
         'refnum',   'int',  '',     '',
         'referral_custnum', 'int',  'NULL', '',
-        'comments', 'varchar', 'NULL', '',
+        'comments', 'text', 'NULL', '',
       ],
       'primary_key' => 'custnum',
       'unique' => [ [] ],
@@ -447,6 +451,7 @@ sub tables_hash_hack {
     'cust_pay_batch' => { #what's this used for again?  list of customers
                           #in current CARD batch? (necessarily CARD?)
       'columns' => [
+        'paybatchnum',   'int',    '',   '',
         'invnum',   'int',    '',   '',
         'custnum',   'int',    '',   '',
         'last',     'varchar', '',     $char_d,
@@ -457,14 +462,14 @@ sub tables_hash_hack {
         'state',    'varchar', '',     $char_d,
         'zip',      'varchar', '',     10,
         'country',  'char', '',     2,
-        'trancode', 'int', '', '',
+#        'trancode', 'int', '', '',
         'cardnum',  'varchar', '',     16,
         #'exp',      @date_type,
         'exp',      'varchar', '',     11,
         'payname',  'varchar', 'NULL', $char_d,
         'amount',   @money_type,
       ],
-      'primary_key' => '',
+      'primary_key' => 'paybatchnum',
       'unique' => [ [] ],
       'index' => [ ['invnum'], ['custnum'] ],
     },
@@ -480,6 +485,7 @@ sub tables_hash_hack {
         'susp',      @date_type,
         'cancel',    @date_type,
         'expire',    @date_type,
+        'manual_flag', 'char', 'NULL', 1,
       ],
       'primary_key' => 'pkgnum',
       'unique' => [ [] ],
@@ -538,6 +544,10 @@ sub tables_hash_hack {
         'setup',      @perl_type,
         'freq',       'int', '', '',  #billing frequency (months)
         'recur',      @perl_type,
+        'setuptax',  'char', 'NULL', 1,
+        'recurtax',  'char', 'NULL', 1,
+        'plan',       'varchar', 'NULL', $char_d,
+        'plandata',   'text', 'NULL', '',
       ],
       'primary_key' => 'pkgpart',
       'unique' => [ [] ],
@@ -785,7 +795,7 @@ sub tables_hash_hack {
     'queue' => {
       'columns' => [
         'jobnum', 'int', '', '',
-        'job', 'varchar', '', '',
+        'job', 'text', '', '',
         '_date', 'int', '', '',
         'status', 'varchar', '', $char_d,
       ],
@@ -798,7 +808,7 @@ sub tables_hash_hack {
       'columns' => [
         'argnum', 'int', '', '',
         'jobnum', 'int', '', '',
-        'arg', 'varchar', 'NULL', '',
+        'arg', 'text', 'NULL', '',
       ],
       'primary_key' => 'argnum',
       'unique'      => [],