X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Ffs-setup;h=476b84d877ef59689c55f138f6b695fca74e5c7d;hp=1c720e6985a56e9121803fee9e7ecb74ea29b629;hb=44e51a5c50be350fa698bcdcf86ad5c01a7631a2;hpb=895e5dd0c472e41875435cc625f1ca0a36bd2524 diff --git a/bin/fs-setup b/bin/fs-setup index 1c720e698..476b84d87 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.52 2001-09-04 11:15:15 ivan Exp $ +# $Id: fs-setup,v 1.60 2001-10-02 16:00:30 jeff Exp $ #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } @@ -15,9 +15,13 @@ use DBIx::DBSchema::ColGroup::Index; use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets); use FS::Record; use FS::cust_main_county; +use FS::raddb; die "Not running uid freeside!" unless checkeuid(); +my %attrib2db = + map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; + my $user = shift or die &usage; getsecrets($user); @@ -35,13 +39,15 @@ 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); +my @check_attributes = map { $attrib2db{lc($_)} or die "unknown attribute $_"; } + split(" ",&getvalue); print "\n\n", <table('part_svc'); - -#because of svc_acct_pop -#foreach (grep /^svc_/, $dbdef->tables) { -#foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) { -foreach (qw(svc_acct svc_domain svc_forward svc_www)) { - my($table)=$dbdef->table($_); - my($col); - foreach $col ( $table->columns ) { - next if $col =~ /^svcnum$/; - $part_svc->addcolumn( new DBIx::DBSchema::Column ( - $table->name. '__' . $table->column($col)->name, - 'varchar', #$table->column($col)->type, - 'NULL', - $char_d, #$table->column($col)->length, - )); - $part_svc->addcolumn ( new DBIx::DBSchema::Column ( - $table->name. '__'. $table->column($col)->name . "_flag", - 'char', - 'NULL', - 1, - )); - } -} +##make part_svc table (but now as object) +# +#my($part_svc)=$dbdef->table('part_svc'); +# +##because of svc_acct_pop +##foreach (grep /^svc_/, $dbdef->tables) { +##foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) { +#foreach (qw(svc_acct svc_domain svc_forward svc_www)) { +# my($table)=$dbdef->table($_); +# my($col); +# foreach $col ( $table->columns ) { +# next if $col =~ /^svcnum$/; +# $part_svc->addcolumn( new DBIx::DBSchema::Column ( +# $table->name. '__' . $table->column($col)->name, +# 'varchar', #$table->column($col)->type, +# 'NULL', +# $char_d, #$table->column($col)->length, +# )); +# $part_svc->addcolumn ( new DBIx::DBSchema::Column ( +# $table->name. '__'. $table->column($col)->name . "_flag", +# 'char', +# 'NULL', +# 1, +# )); +# } +#} #important $dbdef->save($dbdef_file); @@ -442,6 +447,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, @@ -459,7 +465,7 @@ sub tables_hash_hack { 'payname', 'varchar', 'NULL', $char_d, 'amount', @money_type, ], - 'primary_key' => '', + 'primary_key' => 'paybatchnum', 'unique' => [ [] ], 'index' => [ ['invnum'], ['custnum'] ], }, @@ -581,6 +587,19 @@ sub tables_hash_hack { 'index' => [ [] ], }, + 'part_svc_column' => { + 'columns' => [ + 'columnnum', 'int', '', '', + 'svcpart', 'int', '', '', + 'columnname', 'varchar', '', 64, + 'columnvalue', 'varchar', 'NULL', $char_d, + 'columnflag', 'char', 'NULL', 1, + ], + 'primary_key' => 'columnnum', + 'unique' => [ [ 'svcpart', 'columnname' ] ], + 'index' => [ [ 'svcpart' ] ], + }, + #(this should be renamed to part_pop) 'svc_acct_pop' => { 'columns' => [ @@ -593,7 +612,21 @@ sub tables_hash_hack { ], 'primary_key' => 'popnum', 'unique' => [ [] ], - 'index' => [ [] ], + 'index' => [ [ 'state' ] ], + }, + + 'part_pop_local' => { + 'columns' => [ + 'localnum', 'int', '', '', + 'popnum', 'int', '', '', + 'city', 'varchar', 'NULL', $char_d, + 'state', 'char', 'NULL', 2, + 'npa', 'char', '', 3, + 'nxx', 'char', '', 3, + ], + 'primary_key' => 'popnum', + 'unique' => [ [] ], + 'index' => [ [ 'npa', 'nxx' ] ], }, 'svc_acct' => { @@ -750,6 +783,28 @@ sub tables_hash_hack { 'index' => [ [ 'portnum' ] ], }, + 'queue' => { + 'columns' => [ + 'jobnum', 'int', '', '', + 'job', 'varchar', '', '', + '_date', 'int', '', '', + 'status', 'varchar', '', $char_d, + ], + 'primary_key' => 'jobnum', + 'unique' => [], + 'index' => [], + }, + + 'queue_arg' => { + 'columns' => [ + 'argnum', 'int', '', '', + 'jobnum', 'int', '', '', + 'arg', 'varchar', 'NULL', '', + ], + 'primary_key' => 'argnum', + 'unique' => [], + 'index' => [ [ 'jobnum' ] ], + }, ); %tables;