projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into 4.x
[freeside.git]
/
FS
/
FS
/
cust_main
/
Billing.pm
diff --git
a/FS/FS/cust_main/Billing.pm
b/FS/FS/cust_main/Billing.pm
index
29d5fa9
..
f4c8045
100644
(file)
--- a/
FS/FS/cust_main/Billing.pm
+++ b/
FS/FS/cust_main/Billing.pm
@@
-379,6
+379,12
@@
Do not save the generated bill in the database. Useful with return_bill
A list reference on which the generated bill(s) will be returned.
A list reference on which the generated bill(s) will be returned.
+=item estimate
+
+Boolean value; indicates that this is an estimate rather than a "tax invoice".
+This will be passed through to the tax engine, as online tax services
+sometimes need to know it for reporting purposes. Otherwise it has no effect.
+
=item invoice_terms
Optional terms to be printed on this invoice. Otherwise, customer-specific
=item invoice_terms
Optional terms to be printed on this invoice. Otherwise, customer-specific
@@
-474,7
+480,8
@@
sub bill {
foreach (@passes) {
$tax_engines{$_} = FS::TaxEngine->new(cust_main => $self,
invoice_time => $invoice_time,
foreach (@passes) {
$tax_engines{$_} = FS::TaxEngine->new(cust_main => $self,
invoice_time => $invoice_time,
- cancel => $options{cancel}
+ cancel => $options{cancel},
+ estimate => $options{estimate},
);
$tax_is_batch ||= $tax_engines{$_}->info->{batch};
}
);
$tax_is_batch ||= $tax_engines{$_}->info->{batch};
}
@@
-542,7
+549,8
@@
sub bill {
$tax_engines{$pass} = FS::TaxEngine->new(
cust_main => $self,
invoice_time => $invoice_time,
$tax_engines{$pass} = FS::TaxEngine->new(
cust_main => $self,
invoice_time => $invoice_time,
- cancel => $options{cancel}
+ cancel => $options{cancel},
+ estimate => $options{estimate},
);
$cust_bill_pkg{$pass} = [];
}
);
$cust_bill_pkg{$pass} = [];
}
@@
-810,16
+818,17
@@
sub bill {
# calculate and append taxes
if ( ! $tax_is_batch) {
# calculate and append taxes
if ( ! $tax_is_batch) {
- my $arrayref_or_error = $tax_engines{$pass}->calculate_taxes($cust_bill);
+ local $@;
+ my $arrayref = eval { $tax_engines{$pass}->calculate_taxes($cust_bill) };
-
unless ( ref( $arrayref_or_error )
) {
+
if ( $@
) {
$dbh->rollback if $oldAutoCommit && !$options{no_commit};
$dbh->rollback if $oldAutoCommit && !$options{no_commit};
- return $
arrayref_or_error
;
+ return $
@
;
}
# or should this be in TaxEngine?
my $total_tax = 0;
}
# or should this be in TaxEngine?
my $total_tax = 0;
- foreach my $taxline ( @$arrayref
_or_error
) {
+ foreach my $taxline ( @$arrayref ) {
$total_tax += $taxline->setup;
$taxline->set('invnum' => $cust_bill->invnum); # just to be sure
push @cust_bill_pkg, $taxline; # for return_bill
$total_tax += $taxline->setup;
$taxline->set('invnum' => $cust_bill->invnum); # just to be sure
push @cust_bill_pkg, $taxline; # for return_bill
@@
-1413,7
+1422,7
@@
sub _handle_taxes {
return if ( $self->payby eq 'COMP' ); #dubious
return if ( $self->payby eq 'COMP' ); #dubious
- if ( $conf->
exists
('enable_taxproducts')
+ if ( $conf->
config
('enable_taxproducts')
&& ( scalar($part_item->part_pkg_taxoverride)
|| $part_item->has_taxproduct
)
&& ( scalar($part_item->part_pkg_taxoverride)
|| $part_item->has_taxproduct
)