[freeside-commits] freeside/FS/FS tax_rate.pm, 1.16, 1.17 Conf.pm, 1.260, 1.261
Jeff Finucane,420,,
jeff at wavetail.420.am
Thu Feb 5 08:57:37 PST 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv29097
Modified Files:
tax_rate.pm Conf.pm
Log Message:
add a config flag to ignore new style taxes instead of throwing fatal errors
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.260
retrieving revision 1.261
diff -u -d -r1.260 -r1.261
--- Conf.pm 12 Jan 2009 23:51:33 -0000 1.260
+++ Conf.pm 5 Feb 2009 16:57:34 -0000 1.261
@@ -1468,6 +1468,13 @@
},
{
+ '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>',
Index: tax_rate.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/tax_rate.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- tax_rate.pm 19 Jan 2009 23:53:44 -0000 1.16
+++ tax_rate.pm 5 Feb 2009 16:57:34 -0000 1.17
@@ -385,27 +385,35 @@
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 @@
$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 _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
More information about the freeside-commits
mailing list