summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorjeff <jeff>2009-02-05 16:57:34 +0000
committerjeff <jeff>2009-02-05 16:57:34 +0000
commit706d7c9808eba10767b8a3f2c7735c00be3797fb (patch)
tree55b028603de7f627629d19097f27a6e4a9b1fb28 /FS
parent37962c0795fe6069c51a50648de038d965bd8a3a (diff)
add a config flag to ignore new style taxes instead of throwing fatal errors
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/tax_rate.pm49
2 files changed, 44 insertions, 12 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 72fb98c0d..eb20590cf 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -1468,6 +1468,13 @@ worry that config_items is freeside-specific and icky.
},
{
+ 'key' => 'ignore_incalculable_taxes',
+ 'section' => 'billing',
+ 'description' => 'Prefer to invoice without tax over not billing at all',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'welcome_email',
'section' => '',
'description' => 'Template file for welcome email. Welcome emails are sent to the customer email invoice destination(s) each time a svc_acct record is created. See the <a href="http://search.cpan.org/dist/Text-Template/lib/Text/Template.pm">Text::Template</a> documentation for details on the template substitution language. The following variables are available<ul><li><code>$username</code> <li><code>$password</code> <li><code>$first</code> <li><code>$last</code> <li><code>$pkg</code></ul>',
diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm
index 95d1c60fd..021bce333 100644
--- a/FS/FS/tax_rate.pm
+++ b/FS/FS/tax_rate.pm
@@ -385,27 +385,35 @@ sub taxline {
if $DEBUG;
if ($self->passflag eq 'N') {
- return "fatal: can't (yet) handle taxes not passed to the customer";
+ # return "fatal: can't (yet) handle taxes not passed to the customer";
+ # until someone needs to track these in freeside
+ return {
+ 'name' => $name,
+ 'amount' => 0,
+ };
}
if ($self->maxtype != 0 && $self->maxtype != 9) {
- return qq!fatal: can't (yet) handle tax with "!. $self->maxtype_name.
- '" threshold';
+ return $self->_fatal_or_null( 'tax with "'.
+ $self->maxtype_name. '" threshold'
+ );
}
if ($self->maxtype == 9) {
- return qq!fatal: can't (yet) handle tax with "!. $self->maxtype_name.
- '" threshold'; # "texas" tax
+ return
+ $self->_fatal_or_null( 'tax with "'. $self->maxtype_name. '" threshold' );
+ # "texas" tax
}
# we treat gross revenue as gross receipts and expect the tax data
# to DTRT (i.e. tax on tax rules)
if ($self->basetype != 0 && $self->basetype != 1 &&
- $self->basetype != 6 && $self->basetype != 7 &&
- $self->basetype != 8 && $self->basetype != 14
+ $self->basetype != 5 && $self->basetype != 6 &&
+ $self->basetype != 7 && $self->basetype != 8 &&
+ $self->basetype != 14
) {
- return qq!fatal: can't (yet) handle tax with "!. $self->basetype_name.
- '" basis';
+ return
+ $self->_fatal_or_null( 'tax with "'. $self->basetype_name. '" basis' );
}
unless ($self->setuptax =~ /^Y$/i) {
@@ -425,12 +433,11 @@ sub taxline {
$seen{$_->pkgnum}++;
}
}elsif ($self->unittype == 1) {
- return qq!fatal: can't (yet) handle fee with minute unit type!;
+ return $self->_fatal_or_null( 'fee with minute unit type' );
}elsif ($self->unittype == 2) {
$taxable_units = 1;
}else {
- return qq!fatal: can't (yet) handle unknown unit type in tax!.
- $self->taxnum;
+ return $self->_fatal_or_null( 'unknown unit type in tax'. $self->taxnum );
}
}
@@ -454,6 +461,24 @@ sub taxline {
}
+sub _fatal_or_null {
+ my ($self, $error) = @_;
+
+ my $conf = new FS::Conf;
+
+ $error = "fatal: can't yet handle ". $error;
+ my $name = $self->taxname;
+ $name = 'Other surcharges'
+ if ($self->passtype == 2);
+
+ if ($conf->exists('ignore_incalculable_tax')) {
+ warn $error;
+ return { name => $name, amount => 0 };
+ } else {
+ return $error;
+ }
+}
+
=item tax_on_tax CUST_MAIN
Returns a list of taxes which are candidates for taxing taxes for the