summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/TaxEngine/suretax.pm6
-rw-r--r--httemplate/elements/tr-part_pkg-taxproducts.html9
-rw-r--r--httemplate/elements/tr-select-tax_status.html1
-rw-r--r--httemplate/view/cust_main/menu.html1
4 files changed, 14 insertions, 3 deletions
diff --git a/FS/FS/TaxEngine/suretax.pm b/FS/FS/TaxEngine/suretax.pm
index 8139b1dff..4e7edd575 100644
--- a/FS/FS/TaxEngine/suretax.pm
+++ b/FS/FS/TaxEngine/suretax.pm
@@ -85,6 +85,8 @@ sub build_request {
my @lines = map { $self->build_item($_) }
$cust_bill->cust_bill_pkg;
+ return if !@lines;
+
my $ClientNumber = $conf->config('suretax-client_number')
or die "suretax-client_number config required.\n";
my $ValidationKey = $conf->config('suretax-validation_key')
@@ -306,6 +308,10 @@ sub make_taxlines {
# assemble the request hash
my $request = $self->build_request;
+ if (!$request) {
+ warn "no taxable items in invoice; skipping SureTax request\n" if $DEBUG;
+ return;
+ }
warn "sending SureTax request\n" if $DEBUG;
my $request_json = $json->encode($request);
diff --git a/httemplate/elements/tr-part_pkg-taxproducts.html b/httemplate/elements/tr-part_pkg-taxproducts.html
index 274dc3b48..ad464ca77 100644
--- a/httemplate/elements/tr-part_pkg-taxproducts.html
+++ b/httemplate/elements/tr-part_pkg-taxproducts.html
@@ -21,9 +21,12 @@
my %opt = @_;
my $field = delete($opt{field}) || 'taxproductnum';
my $pkgpart = delete($opt{pkgpart});
-my $part_pkg = FS::part_pkg->by_key($pkgpart);
-my %pkg_options = $part_pkg->options;
-$pkg_options{'usage_taxproductnum_'} = $part_pkg->taxproductnum;
+my %pkg_options;
+if ($pkgpart) {
+ my $part_pkg = FS::part_pkg->by_key($pkgpart);
+ my %pkg_options = $part_pkg->options;
+ $pkg_options{'usage_taxproductnum_'} = $part_pkg->taxproductnum;
+}
my @classes = qsearch('usage_class', { 'disabled' => '' });
unshift @classes,
diff --git a/httemplate/elements/tr-select-tax_status.html b/httemplate/elements/tr-select-tax_status.html
index 1e0ea8a98..387e49e1f 100644
--- a/httemplate/elements/tr-select-tax_status.html
+++ b/httemplate/elements/tr-select-tax_status.html
@@ -10,6 +10,7 @@
name_col => 'description',
hashref => { data_vendor => $vendor },
order_by => 'order by taxstatus',
+ required => 1,
%opt
&>
diff --git a/httemplate/view/cust_main/menu.html b/httemplate/view/cust_main/menu.html
index ab56bcfcb..ff001bb67 100644
--- a/httemplate/view/cust_main/menu.html
+++ b/httemplate/view/cust_main/menu.html
@@ -557,6 +557,7 @@ foreach my $submenu (@menu) {
}
$a .= qq[>$label</A> ];
+ $cgi->param('show', $opt{show});
} elsif ( $entry->{popup} ) {