[freeside-commits] branch FREESIDE_4_BRANCH updated. 5e5506c2163ce976d20bfd95d8fc8eca13808cd3
Mark Wells
mark at 420.am
Sat Feb 27 21:02:23 PST 2016
The branch, FREESIDE_4_BRANCH has been updated
via 5e5506c2163ce976d20bfd95d8fc8eca13808cd3 (commit)
via a8f121557a71209fed56e3e00e8e6467284128ee (commit)
from 18dc453ef07f61c4c3b1cb4d6cb7e3a9b95567f2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5e5506c2163ce976d20bfd95d8fc8eca13808cd3
Author: Mark Wells <mark at freeside.biz>
Date: Sat Feb 27 19:24:04 2016 -0800
don't send nonstandard phone numbers to Suretax, #32043
diff --git a/FS/FS/TaxEngine/suretax.pm b/FS/FS/TaxEngine/suretax.pm
index 2c418f9..e18b668 100644
--- a/FS/FS/TaxEngine/suretax.pm
+++ b/FS/FS/TaxEngine/suretax.pm
@@ -216,9 +216,9 @@ sub build_item {
my %hash = (
%base_item,
'LineNumber' => 'C' . $cdr->acctid,
- 'OrigNumber' => $cdr->src,
- 'TermNumber' => $cdr->dst,
- 'BillToNumber' => $cdr->charged_party,
+ 'OrigNumber' => '',
+ 'TermNumber' => '',
+ 'BillToNumber' => '',
'TransDate' => $calldate,
'Revenue' => $cdr->rated_price, # 4 decimal places
'Units' => 0, # right?
@@ -258,11 +258,13 @@ sub build_item {
if !$taxproduct;
my $tsr = $TSR_GENERAL;
+ # when billing on cancellation there are no units
+ my $units = $self->{cancel} ? 0 : $cust_bill_pkg->units;
my %hash = (
%base_item,
'LineNumber' => 'R' . $billpkgnum,
'Revenue' => $recur_without_usage, # 4 decimal places
- 'Units' => $cust_bill_pkg->units,
+ 'Units' => $units,
'TaxSitusRule' => $tsr,
'TransTypeCode' => $taxproduct,
);
commit a8f121557a71209fed56e3e00e8e6467284128ee
Author: Mark Wells <mark at freeside.biz>
Date: Thu Feb 25 13:39:07 2016 -0800
optionally calculate Suretax taxes based only on the service location, #32043
diff --git a/FS/FS/TaxEngine/suretax.pm b/FS/FS/TaxEngine/suretax.pm
index 073d19b..2c418f9 100644
--- a/FS/FS/TaxEngine/suretax.pm
+++ b/FS/FS/TaxEngine/suretax.pm
@@ -137,8 +137,17 @@ sub build_item {
my @items;
my $recur_without_usage = $cust_bill_pkg->recur;
+ # use the _configured_ tax location as 'Zipcode' (respecting
+ # tax-ship_address and tax-pkg_address configs)
my $location = $cust_bill_pkg->tax_location;
- my ($svc_zip, $svc_plus4) = split('-', $location->zip);
+ my ($zip, $plus4) = split('-', $location->zip);
+
+ # and the _real_ location as 'P2PZipcode'
+ my $svc_location = $location;
+ if ( $cust_bill_pkg->pkgnum ) {
+ $svc_location = $cust_bill_pkg->cust_pkg->cust_location;
+ }
+ my ($svc_zip, $svc_plus4) = split('-', $svc_location->zip);
my $startdate =
DateTime->from_epoch( epoch => $cust_bill->_date )->strftime('%m-%d-%Y');
@@ -150,8 +159,8 @@ sub build_item {
'OrigNumber' => '',
'TermNumber' => '',
'BillToNumber' => '',
- 'Zipcode' => $self->{bill_zip},
- 'Plus4' => ($self->{bill_plus4} ||= '0000'),
+ 'Zipcode' => $zip,
+ 'Plus4' => ($plus4 ||= '0000'),
'P2PZipcode' => $svc_zip,
'P2PPlus4' => ($svc_plus4 ||= '0000'),
# we don't support Order Placement/Approval zip codes
@@ -204,14 +213,6 @@ sub build_item {
while ( my $cdr = $cdrs->fetch ) {
my $calldate =
DateTime->from_epoch( epoch => $cdr->startdate )->strftime('%m-%d-%Y');
- # determine the tax situs rule; it's different (probably more accurate)
- # if the call has PSTN phone numbers at both ends
- my $tsr = $TSR_CALL_OTHER;
- if ( $cdr->charged_party =~ /^\d{10}$/ and
- $cdr->src =~ /^\d{10}$/ and
- $cdr->dst =~ /^\d{10}$/ ) {
- $tsr = $TSR_CALL_NPANXX;
- }
my %hash = (
%base_item,
'LineNumber' => 'C' . $cdr->acctid,
@@ -222,9 +223,21 @@ sub build_item {
'Revenue' => $cdr->rated_price, # 4 decimal places
'Units' => 0, # right?
'CallDuration' => $cdr->duration,
- 'TaxSitusRule' => $tsr,
+ 'TaxSitusRule' => $TSR_CALL_OTHER,
'TransTypeCode' => $taxproduct,
);
+ # determine the tax situs rule; it's different (probably more accurate)
+ # if the call has PSTN phone numbers at both ends
+ if ( $cdr->charged_party =~ /^\d{10}$/ and
+ $cdr->src =~ /^\d{10}$/ and
+ $cdr->dst =~ /^\d{10}$/ and
+ !$cdr->is_tollfree ) {
+ $hash{TaxSitusRule} = $TSR_CALL_NPANXX;
+ $hash{OrigNumber} = $cdr->src;
+ $hash{TermNumber} = $cdr->dst;
+ $hash{BillToNumber} = $cdr->charged_party;
+ }
+
push @items, \%hash;
} # while ($cdrs->fetch)
-----------------------------------------------------------------------
Summary of changes:
FS/FS/TaxEngine/suretax.pm | 47 +++++++++++++++++++++++++++++---------------
1 file changed, 31 insertions(+), 16 deletions(-)
More information about the freeside-commits
mailing list