diff options
author | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
commit | c82d349f864e6bd9f96fd1156903bc1f7193a203 (patch) | |
tree | e117a87533656110b6acd56fc0ca64289892a9f5 /bin/svc_acct_pop.import | |
parent | 74e058c8a010ef6feb539248a550d0bb169c1e94 (diff) |
This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'.TORRUS_1_0_9
Diffstat (limited to 'bin/svc_acct_pop.import')
-rwxr-xr-x | bin/svc_acct_pop.import | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/bin/svc_acct_pop.import b/bin/svc_acct_pop.import deleted file mode 100755 index 9e3d38bfe..000000000 --- a/bin/svc_acct_pop.import +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/perl - -use strict; -use Text::CSV_XS; -use FS::UID qw(adminsuidsetup); -use FS::svc_acct_pop; - -my @fields = qw( ac loc state city exch ); -my $fixup = sub { - my $hash = shift; - $hash->{ac} =~ /^\s*(\d{3})\s*$/; - $hash->{ac} = $1; - $hash->{loc} =~ /^\s*(\d{3})(\d{4})\s*$/; - $hash->{exch} = $1; - $hash->{loc} = $2; - $hash->{state} =~ /^\s*(\S{0,2})\s*$/; - $hash->{state} = $1; - $hash->{city} =~ /^\s*(.*?)\s*$/; - $hash->{city} = $1; - - }; - -my $user = shift or usage(); -adminsuidsetup $user; - -my $file = shift or usage(); -my $csv = new Text::CSV_XS; - -open(FH, $file) or die "cannot open $file: $!"; - -sub usage { - die "Usage:\n\n svc_acct_pop.import user popfile.csv\n\n"; -} - -### - -my $line; -while ( defined($line=<FH>) ) { - chomp $line; - - $line &= "\177" x length($line); # i hope this isn't really necessary - $csv->parse($line) - or die "cannot parse: " . $csv->error_input(); - - my @values = $csv->fields(); - my %hash; - foreach my $field (@fields) { - $hash{$field} = shift @values; - } - - &{$fixup}(\%hash); - - my $svc_acct_pop = new FS::svc_acct_pop { %hash }; - - #my $error = $svc_acct_pop->check; - my $error = $svc_acct_pop->insert; - die $error if $error; - -} |