X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Ffs-setup;h=03b5a04a91254ea5d74bba957e252e17d9cb4e31;hb=a594e8f54dd5582ac36eb9e6a2b260d63f3b91fa;hp=5e735294f5c2419fe76dda9f4244c380ecb5170d;hpb=8c1f9804d9a02c0c054eededeb500c72a640249a;p=freeside.git diff --git a/bin/fs-setup b/bin/fs-setup index 5e735294f..03b5a04a9 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.48 2001-09-02 02:46:55 ivan Exp $ +# $Id: fs-setup,v 1.56 2001-09-08 00:28:49 khoff 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 { $FS::raddb::attrib{lc($_)} => $_ } 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); @@ -426,14 +432,14 @@ sub tables_hash_hack { }, 'cust_bill_pay' => { - 'column' => [ + 'columns' => [ 'billpaynum', 'int', '', '', 'invnum', 'int', '', '', 'paynum', 'int', '', '', 'amount', @money_type, '_date', @date_type ], - 'primary_key' => 'billpaynum' + 'primary_key' => 'billpaynum', 'unique' => [ [] ], 'index' => [ [ 'paynum', 'invnum' ] ], }, @@ -496,18 +502,18 @@ sub tables_hash_hack { ], 'primary_key' => 'refundnum', 'unique' => [ [] ], - 'index' => [ ['crednum'] ], + 'index' => [ [] ], }, 'cust_credit_refund' => { - 'column' => [ + 'columns' => [ 'creditrefundnum', 'int', '', '', 'crednum', 'int', '', '', 'refundnum', 'int', '', '', 'amount', @money_type, '_date', @date_type ], - 'primary_key' => 'creditrefundnum' + 'primary_key' => 'creditrefundnum', 'unique' => [ [] ], 'index' => [ [ 'crednum', 'refundnum' ] ], }, @@ -580,6 +586,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' => [