X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Ffs-setup;h=62c2cd49020d29dd99a47937e1760c6cb325230c;hb=6a37289c12238d48ea864b8177216ca276b33a40;hp=e3dd8b0ead6c007ca94fea4e7f2b68e36bcc37a6;hpb=1aa750eba2b9b73b4f09f28b9acd748ee3669bd4;p=freeside.git diff --git a/bin/fs-setup b/bin/fs-setup index e3dd8b0ea..62c2cd490 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.71 2002-01-28 06:57:23 ivan Exp $ +# $Id: fs-setup,v 1.82 2002-02-27 22:39:14 ivan Exp $ #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } @@ -16,6 +16,7 @@ use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets); use FS::Record; use FS::cust_main_county; use FS::raddb; +use FS::part_bill_event; die "Not running uid freeside!" unless checkeuid(); @@ -234,6 +235,28 @@ YE YU ZR ZM ZW die $error if $error; } +#billing events +foreach my $aref ( + [ 'COMP', 'Comp invoice', '$cust_bill->comp();', 30, 'comp' ], + [ 'CARD', 'Batch card', '$cust_bill->batch_card();', 40, 'batch-card' ], + [ 'BILL', 'Send invoice', '$cust_bill->send();', 50, 'send' ], +) { + + my $part_bill_event = new FS::part_bill_event({ + 'payby' => $aref->[0], + 'event' => $aref->[1], + 'eventcode' => $aref->[2], + 'seconds' => 0, + 'weight' => $aref->[3], + 'plan' => $aref->[4], + }); + my($error); + $error=$part_bill_event->insert; + die $error if $error; + +} + + $dbh->disconnect or die $dbh->errstr; print "Freeside database initialized sucessfully\n"; @@ -306,19 +329,24 @@ sub tables_hash_hack { 'invnum', 'int', '', '', 'eventpart', 'int', '', '', '_date', @date_type, + 'status', 'varchar', '', $char_d, + 'statustext', 'text', 'NULL', '', ], 'primary_key' => 'eventnum', 'unique' => [ [ 'eventpart', 'invnum' ] ], - 'index' => [ ['invnum'] ], + 'index' => [ ['invnum'], ['status'] ], }, 'part_bill_event' => { 'columns' => [ 'eventpart', 'int', '', '', - 'payby', 'int', '', '', + 'payby', 'char', '', 4, 'event', 'varchar', '', $char_d, 'eventcode', @perl_type, 'seconds', 'int', 'NULL', '', + 'weight', 'int', '', '', + 'plan', 'varchar', 'NULL', $char_d, + 'plandata', 'text', 'NULL', '', 'disabled', 'char', 'NULL', 1, ], 'primary_key' => 'eventpart', @@ -461,7 +489,7 @@ sub tables_hash_hack { ], 'primary_key' => 'paynum', 'unique' => [ [] ], - 'index' => [ [] ], + 'index' => [ [ 'custnum' ], [ 'paybatch' ] ], }, 'cust_bill_pay' => { @@ -474,7 +502,7 @@ sub tables_hash_hack { ], 'primary_key' => 'billpaynum', 'unique' => [ [] ], - 'index' => [ [ 'paynum', 'invnum' ] ], + 'index' => [ [ 'paynum' ], [ 'invnum' ] ], }, 'cust_pay_batch' => { #what's this used for again? list of customers @@ -830,10 +858,12 @@ sub tables_hash_hack { 'job', 'text', '', '', '_date', 'int', '', '', 'status', 'varchar', '', $char_d, + 'statustext', 'text', 'NULL', '', + 'svcnum', 'int', 'NULL', '', ], 'primary_key' => 'jobnum', 'unique' => [], - 'index' => [], + 'index' => [ [ 'svcnum' ], [ 'status' ] ], }, 'queue_arg' => { @@ -864,12 +894,12 @@ sub tables_hash_hack { 'columns' => [ 'optionnum', 'int', '', '', 'exportnum', 'int', '', '', - 'option', 'varchar', '', $char_d, + 'optionname', 'varchar', '', $char_d, 'optionvalue', 'text', 'NULL', '', ], 'primary_key' => 'optionnum', 'unique' => [], - 'index' => [ [ 'exportnum' ], [ 'option' ] ], + 'index' => [ [ 'exportnum' ], [ 'optionname' ] ], }, );