X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftax_class.pm;h=51d87ab10949a7d8037d81579ec238ff4a2290de;hb=7d0b690f5684cdfdcd68d25568a101f6b088ad98;hp=2fa9fb0f8238b1da9bc9cb27a8df74e798639676;hpb=052ebe1ded9859bff023141274edf891e743275a;p=freeside.git diff --git a/FS/FS/tax_class.pm b/FS/FS/tax_class.pm index 2fa9fb0f8..51d87ab10 100644 --- a/FS/FS/tax_class.pm +++ b/FS/FS/tax_class.pm @@ -4,6 +4,7 @@ use strict; use vars qw( @ISA ); use FS::UID qw(dbh); use FS::Record qw( qsearch qsearchs ); +use FS::Misc qw( csv_from_fixed ); @ISA = qw(FS::Record); @@ -147,12 +148,19 @@ sub batch_import { my $imported = 0; my $dbh = dbh; + my @column_lengths = (); + my @column_callbacks = (); + if ( $format eq 'cch-fixed' || $format eq 'cch-fixed-update' ) { + $format =~ s/-fixed//; + push @column_lengths, qw( 8 10 3 2 2 10 100 ); + push @column_lengths, 1 if $format eq 'cch-update'; + } + my $line; my ( $count, $last, $min_sec ) = (0, time, 5); #progressbar - if ( $job ) { - $count++ - while ( defined($line=<$fh>) ); - seek $fh, 0, 0; + if ( $job || scalar(@column_lengths) ) { + my $error = csv_from_fixed(\$fh, \$count, \@column_lengths); + return $error if $error; } if ( $format eq 'cch' || $format eq 'cch-update' ) {