diff options
author | jeff <jeff> | 2008-11-19 14:56:00 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-11-19 14:56:00 +0000 |
commit | f32fab28c5cea2b5619c9b1d5cc6e3fe7beef126 (patch) | |
tree | 0e069e7e490d9d102a5ee0379788d824326e3b83 /FS/FS/cust_tax_location.pm | |
parent | 7c9c69a6e85094310f437d01877b79b3d5c845db (diff) |
support for cch fixed format
Diffstat (limited to 'FS/FS/cust_tax_location.pm')
-rw-r--r-- | FS/FS/cust_tax_location.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/FS/FS/cust_tax_location.pm b/FS/FS/cust_tax_location.pm index 66d32a5a7..cd24cc8a8 100644 --- a/FS/FS/cust_tax_location.pm +++ b/FS/FS/cust_tax_location.pm @@ -3,6 +3,7 @@ package FS::cust_tax_location; use strict; use vars qw( @ISA ); use FS::Record qw( qsearch qsearchs dbh ); +use FS::Misc qw ( csv_from_fixed ); @ISA = qw(FS::Record); @@ -135,12 +136,19 @@ sub batch_import { my @fields; my $hook; + my @column_lengths = (); + my @column_callbacks = (); + if ( $format eq 'cch-fixed' || $format eq 'cch-fixed-update' ) { + $format =~ s/-fixed//; + push @column_lengths, qw( 5 2 4 4 10 1 ); + 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_callbacks) ) { + my $error = csv_from_fixed(\$fh, \$count, \@column_lengths); + return $error if $error; } if ( $format eq 'cch' || $format eq 'cch-update' ) { |