X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftax_rate.pm;h=30d7f58d04d561429654135197911536bcd50012;hb=2922b22de0c028e066f8859d32ebea5bf67ccf63;hp=58be8cba6b7ac8765168a1a5b06b73a532d56575;hpb=f51508fab8873d70f15284664dbba7f27015ce72;p=freeside.git diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm index 58be8cba6..30d7f58d0 100644 --- a/FS/FS/tax_rate.pm +++ b/FS/FS/tax_rate.pm @@ -407,13 +407,14 @@ sub taxline { }; } - if ($self->maxtype != 0 && $self->maxtype != 9) { + my $maxtype = $self->maxtype || 0; + if ($maxtype != 0 && $maxtype != 9) { return $self->_fatal_or_null( 'tax with "'. $self->maxtype_name. '" threshold' ); } - if ($self->maxtype == 9) { + if ($maxtype == 9) { return $self->_fatal_or_null( 'tax with "'. $self->maxtype_name. '" threshold' ); # "texas" tax @@ -439,7 +440,7 @@ sub taxline { my $taxable_units = 0; unless ($self->recurtax =~ /^Y$/i) { - if ($self->unittype == 0) { + if (( $self->unittype || 0 ) == 0) { my %seen = (); foreach (@cust_bill_pkg) { $taxable_units += $_->units @@ -480,16 +481,16 @@ sub _fatal_or_null { my $conf = new FS::Conf; - $error = "fatal: can't yet handle ". $error; + $error = "can't yet handle $error"; my $name = $self->taxname; $name = 'Other surcharges' if ($self->passtype == 2); if ($conf->exists('ignore_incalculable_taxes')) { - warn $error; + warn "WARNING: $error; billing anyway per ignore_incalculable_taxes conf\n"; return { name => $name, amount => 0 }; } else { - return $error; + return "fatal: $error"; } } @@ -1398,11 +1399,14 @@ sub process_download_and_update { eval "use XBase;"; die $@ if $@; - my $conffile = '%%%FREESIDE_CONF%%%/cchconf'; - my $conffh = new IO::File "<$conffile" or die "can't open $conffile: $!\n"; - my ( $urls, $secret, $states ) = - map { /^(.*)$/ or die "bad config line in $conffile: $_\n"; $1 } - <$conffh>; + my $conf = new FS::Conf; + die "direct download of tax data not enabled\n" + unless $conf->exists('taxdatadirectdownload'); + my ( $urls, $username, $secret, $states ) = + $conf->config('taxdatadirectdownload'); + die "No tax download URL provided. ". + "Did you set the taxdatadirectdownload configuration value?\n" + unless $urls; $dir .= '/cch';