4 use Storable qw( thaw nfreeze );
6 use FS::UID qw( adminsuidsetup );
11 #my @namelist = qw( code detail geocode plus4 txmatrix zip );
12 my @namelist = qw( code detail plus4 txmatrix zip );
14 my $cache_dir = '/usr/local/etc/freeside/cache.'. $FS::UID::datasrc. '/';
15 my $dir = $cache_dir.'taxdata/cch';
18 foreach my $name ( @namelist ) {
19 my $difffile = "$dir.new/$name.txt";
20 if (1) { # ($update) {
21 #my $error = $job->update_statustext( "0,Comparing to previous $name" );
22 #die $error if $error;
23 warn "processing $dir.new/$name.txt\n"; # if $DEBUG;
24 #my $olddir = $update ? "$dir.1" : "";
25 my $olddir = "$dir.1";
26 $difffile = FS::tax_rate::_perform_cch_diff( $name, "$dir.new", $olddir );
28 $difffile =~ s/^$cache_dir//;
29 push @list, "${name}file:$difffile";
33 local $FS::tax_rate::keep_cch_files = 1;
35 'format' => 'cch-update',
36 'uploaded_files' => join( ',', @list ),
39 #_perform_batch_import( $job, encode_base64( nfreeze( $param ) ) );
40 FS::tax_rate::_perform_batch_import( '', encode_base64( nfreeze( $param ) ) );
43 warn "ERROR: $error\n";
49 #rename "$dir.new", "$dir"
50 # or die "cch tax update processed, but can't rename $dir.new: $!\n";