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