From: Mark Wells Date: Fri, 10 Jul 2015 23:38:28 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=0ed195595b5c7ea404c8848d9d1881ada4214489;hp=df4a68099abfa067014f36f92874fccefdea662e Merge branch 'master' of git.freeside.biz:/home/git/freeside --- 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 ]; + $cgi->param('show', $opt{show}); } elsif ( $entry->{popup} ) {