summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-10-31 15:45:50 -0700
committerMark Wells <mark@freeside.biz>2014-10-31 15:45:50 -0700
commit7516e3da0f17eeecba27219ef96a8b5f46af2083 (patch)
tree772fe13627910a7d0774871633697f2a4d1c6faf /httemplate/edit
parentf31a9212ab3835b815aa87a86cca3b19babcaaff (diff)
tax engine refactoring for Avalara and Billsoft tax vendors, #25718
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/cust_main.cgi2
-rw-r--r--httemplate/edit/cust_main/basics.html (renamed from httemplate/edit/cust_main/top_misc.html)7
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi28
3 files changed, 32 insertions, 5 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index ddb61fa64..ae5085e11 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -25,7 +25,7 @@
%# agent, agent_custid, refnum (advertising source), referral_custnum
%# better section title for this?
<FONT CLASS="fsinnerbox-title"><% mt('Basics') |h %></FONT>
-<& cust_main/top_misc.html, $cust_main, 'custnum' => $custnum &>
+<& cust_main/basics.html, $cust_main, 'custnum' => $custnum &>
%# birthdate
% if ( $conf->config('national_id-country')
diff --git a/httemplate/edit/cust_main/top_misc.html b/httemplate/edit/cust_main/basics.html
index 41dd5636b..91868d4a8 100644
--- a/httemplate/edit/cust_main/top_misc.html
+++ b/httemplate/edit/cust_main/basics.html
@@ -145,6 +145,13 @@
'label' => emt("Class"),
&>
+%# tax status
+<& /elements/tr-select-tax_status.html,
+ 'curr_value' => $cust_main->taxstatusnum,
+ 'disable_empty' => 0,
+ 'empty_label' => ' ',
+&>
+
%#sales person
<& /elements/tr-select-sales.html,
'curr_value' => $cust_main->salesnum,
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index d27ddb0b0..0343cc0fb 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -96,11 +96,31 @@ my $args_callback = sub {
grep { $_ !~ /^report_option_/ }
@options;
- foreach ( split(',', $cgi->param('taxproductnums') ) ) {
- my $value = $cgi->param("taxproductnum_$_");
- $error ||= "Illegal taxproductnum_$_: $value"
+ foreach my $class ( '', split(',', $cgi->param('taxproductnums') ) ) {
+ my $param = 'taxproductnum';
+ $param .= "_$class" if length($class); # gah, "_$class"?
+ my $value = $cgi->param($param);
+
+ if ( $value == -1 ) {
+ my $desc = $cgi->param($param.'_description');
+ # insert a new part_pkg_taxproduct
+ my $engine = FS::TaxEngine->new;
+ my $obj_or_error = $engine->add_taxproduct($desc);
+ if (ref $obj_or_error) {
+ $value = $obj_or_error->taxproductnum;
+ $cgi->param($param, $value); # for error handling
+ } else {
+ die "$obj_or_error (adding tax product)";
+ }
+ }
+
+ $error ||= "Illegal $param: $value"
unless ( $value =~ /^\d*$/ );
- $options{"usage_taxproductnum_$_"} = $value;
+ if (length($class)) {
+ $options{"usage_taxproductnum_$_"} = $value;
+ } else {
+ $new->set('taxproductnum', $value);
+ }
}
foreach ( grep $_, $cgi->param('report_option') ) {