X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fcustomer-faker;h=236a4124774ec0b14748290495138722c11bf16f;hp=b4032d1ecb8bd77cad9ef62baaf9e1ef82d13fed;hb=75e11f1d1a5ced24496b5732e290f7762403feb8;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1 diff --git a/bin/customer-faker b/bin/customer-faker index b4032d1ec..236a41247 100755 --- a/bin/customer-faker +++ b/bin/customer-faker @@ -10,15 +10,17 @@ use FS::cust_main; use FS::cust_pkg; use FS::svc_acct; -my $agentnum = 1; my $refnum = 1; -#my @pkgs = ( 2, 3, 4 ); -my @pkgs = ( 4, 5, 6 ); +#my @pkgs = ( 4, 5, 6 ); my $svcpart = 2; -use vars qw( $opt_p ); -getopts('p:'); +use vars qw( $opt_p $opt_a $opt_k ); +getopts('p:a:k:'); + +my $agentnum = $opt_a || 1; + +my @pkgs = $opt_k ? split(/,\s*/, $opt_k) : ( 2, 3, 4 ); my $user = shift or die &usage; my $num = shift or die &usage; @@ -27,6 +29,9 @@ adminsuidsetup($user); my $onum = $num; my $start = time; +my @states = qw( AL AK AS AZ AR CA CO CT DE DC FL GA GU HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND MP OH OK OR PA PR RI SC SD TN TX UT VT VI VA WA WV WI WY ); +#FM MH + until ( $num-- <= 0 ) { my $faker = new Data::Faker; @@ -39,7 +44,8 @@ until ( $num-- <= 0 ) { 'company' => ( $num % 2 ? $faker->company. ', '. $faker->company_suffix : '' ), #half with companies.. 'address1' => $faker->street_address, 'city' => 'Tofutown', #missing, so everyone is from tofutown# $faker->city, - 'state' => $faker->us_state_abbr, + #'state' => $faker->us_state_abbr, + 'state' => $states[ int(rand($#states)) ], 'zip' => $faker->us_zip_code, 'country' => 'US', 'daytime' => $faker->phone_number, @@ -114,5 +120,5 @@ print "$onum customers inserted in $sec seconds ($persec customers/sec)\n"; #--- sub usage { - die "Usage:\n\n customer-faker [ -p payby ] user num_fakes\n"; + die "Usage:\n\n customer-faker [ -p payby ] [ -a agentnum ] [ -k pkgpart,pkgpart,pkgpart... ] user num_fakes\n"; }