time-based prepaid cards, session monitor. woop!
[freeside.git] / bin / fs-setup
index 002a4ed..1df46d3 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.25 2000-06-29 12:00:49 ivan Exp $
+# $Id: fs-setup,v 1.33 2001-02-03 14:03:50 ivan Exp $
 #
 # ivan@sisd.com 97-nov-8,9
 #
 # fix radius attributes ivan@sisd.com 98-sep-27
 #
 # $Log: fs-setup,v $
-# Revision 1.25  2000-06-29 12:00:49  ivan
+# Revision 1.33  2001-02-03 14:03:50  ivan
+# time-based prepaid cards, session monitor.  woop!
+#
+# Revision 1.32  2000/12/04 00:13:02  ivan
+# fix nas.last type
+#
+# Revision 1.31  2000/12/01 18:34:53  ivan
+# another tyop
+#
+# Revision 1.30  2000/12/01 18:33:32  ivan
+# tyop
+#
+# Revision 1.29  2000/11/07 15:00:37  ivan
+# session monitor
+#
+# Revision 1.28  2000/10/30 10:47:26  ivan
+# nas.last can't be defined NULL if indexed
+#
+# Revision 1.26  2000/07/06 08:57:27  ivan
+# support for radius check attributes (except importing).  poorly documented.
+#
+# Revision 1.25  2000/06/29 12:00:49  ivan
 # support for pre-encrypted md5 passwords.
 #
 # Revision 1.24  2000/03/02 07:44:07  ivan
@@ -127,9 +148,16 @@ print "\nEnter the maximum username length: ";
 my($username_len)=&getvalue;
 
 print "\n\n", <<END, ":";
-Freeside tracks the RADIUS attributes User-Name, Password and Framed-IP-Address
-for each user.  Enter any additional RADIUS attributes you need to track for
-each user, separated by whitespace.
+Freeside tracks the RADIUS attributes 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.
+END
+my @check_attributes = map { s/\-/_/g; $_; } split(" ",&getvalue);
+
+print "\n\n", <<END, ":";
+Now enter any additional reply attributes you need to track for each user,
+separated by whitespace.
 END
 my @attributes = map { s/\-/_/g; $_; } split(" ",&getvalue);
 
@@ -186,6 +214,15 @@ foreach $attribute (@attributes) {
   ));
 }
 
+foreach $attribute (@check_attributes) {
+  $svc_acct->addcolumn( new FS::dbdef_column (
+    'rc_'. $attribute,
+    'varchar',
+    'NULL',
+    $char_d,
+  ));
+}
+
 #make part_svc table (but now as object)
 
 my($part_svc)=$dbdef->table('part_svc');
@@ -624,6 +661,7 @@ sub tables_hash_hack {
         'shell',     'varchar',   'NULL',   $char_d,
         'quota',     'varchar',   'NULL',   $char_d,
         'slipip',    'varchar',   'NULL',   15, #four TINYINTs, bah.
+        'seconds',   'int', 'NULL',   '', #uhhhh
       ],
       'primary_key' => 'svcnum',
       'unique' => [ [] ],
@@ -705,12 +743,51 @@ sub tables_hash_hack {
         'prepaynum',   'int',     '',   '',
         'identifier',  'varchar', '', $char_d,
         'amount',      @money_type,
+        'seconds',     'int',     'NULL', '',
       ],
       'primary_key' => 'prepaynum',
       'unique'      => [ ['identifier'] ],
       'index'       => [ [] ],
     },
 
+    'port' => {
+      'columns' => [
+        'portnum',  'int',     '',   '',
+        'ip',       'varchar', 'NULL', 15,
+        'nasport',  'int',     'NULL', '',
+        'nasnum',   'int',     '',   '',
+      ],
+      'primary_key' => 'portnum',
+      'unique'      => [],
+      'index'       => [],
+    },
+
+    'nas' => {
+      'columns' => [
+        'nasnum',   'int',     '',    '',
+        'nas',      'varchar', '',    $char_d,
+        'nasip',    'varchar', '',    15,
+        'nasfqdn',  'varchar', '',    $char_d,
+        'last',     'int',     '',    '',
+      ],
+      'primary_key' => 'nasnum',
+      'unique'      => [ [ 'nas' ], [ 'nasip' ] ],
+      'index'       => [ [ 'last' ] ],
+    },
+
+    'session' => {
+      'columns' => [
+        'sessionnum', 'int',       '',   '',
+        'portnum',    'int',       '',   '',
+        'svcnum',     'int',       '',   '',
+        'login',      @date_type,
+        'logout',     @date_type,
+      ],
+      'primary_key' => 'sessionnum',
+      'unique'      => [],
+      'index'       => [ [ 'portnum' ] ],
+    },
+
   );
 
   %tables;