blob: 05798c9a2cb089bf7e5e9cb8b4c7b1b9347ecf2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/perl
#
# import-county-tax-rates username state country <filename.csv
# example: import-county-tax-rates ivan CA US <taxes.csv
#
# rates.csv: taxrate,county
use FS::UID qw(adminsuidsetup);
use FS::cust_main_county;
my $user = shift;
adminsuidsetup $user;
my($state, $country) = (shift, shift);
while (<>) {
my($tax, $county) = split(','); #half-ass CSV parser
my $cust_main_county = new FS::cust_main_county {
'county' => $county,
'state' => $state,
'country' => $country,
'tax' => $tax,
};
my $error = $cust_main_county->insert;
#my $error = $cust_main_county->check;
die $error if $error;
}
|