summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-06-29 00:41:18 -0700
committerMark Wells <mark@freeside.biz>2016-06-29 00:41:18 -0700
commit84bc64eeaa9650333fbbb79ecb03a1aff4a347fd (patch)
tree933c7f206461d1c50f4a81746e8b0eabeb415c27
parent539daa850d829061bb0901c2851ec6ddf685030e (diff)
make customer tax status a required field when the vendor requires it, #39639
-rwxr-xr-xhttemplate/edit/process/cust_main.cgi9
-rw-r--r--httemplate/edit/process/prospect_main.html11
-rw-r--r--httemplate/edit/prospect_main.html1
3 files changed, 21 insertions, 0 deletions
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 99c7f90..04516e9 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -188,6 +188,15 @@ if ( $cgi->param('residential_commercial') eq 'Residential' ) {
}
+# kind of a hack, but some tax data vendors require a status and others
+# don't.
+my $vendor = $conf->config('tax_data_vendor');
+if ( $vendor eq 'avalara' or $vendor eq 'suretax' ) {
+ if ( ! $cgi->param('taxstatusnum') ) {
+ $error ||= 'Tax status required';
+ }
+}
+
#perhaps this stuff should go to cust_main.pm
if ( $new->custnum eq '' or $duplicate_of ) {
diff --git a/httemplate/edit/process/prospect_main.html b/httemplate/edit/process/prospect_main.html
index 7c8cc27..b2ae88e 100644
--- a/httemplate/edit/process/prospect_main.html
+++ b/httemplate/edit/process/prospect_main.html
@@ -1,5 +1,6 @@
<% include('elements/process.html',
'table' => 'prospect_main',
+ 'precheck_callback' => $precheck,
'args_callback' => $args_callback,
'agent_virt' => 1,
'process_o2m' => {
@@ -11,6 +12,16 @@
%>
<%init>
+my $precheck = sub {
+ my $cgi = shift;
+ my $vendor = FS::Conf->new->config('tax_data_vendor');
+ if ( $vendor eq 'avalara' or $vendor eq 'suretax' ) {
+ if ( ! $cgi->param('taxstatusnum') ) {
+ return 'Tax status required';
+ }
+ }
+};
+
my $args_callback = sub {
my( $cgi, $object ) = @_;
diff --git a/httemplate/edit/prospect_main.html b/httemplate/edit/prospect_main.html
index fb67515..7c02538 100644
--- a/httemplate/edit/prospect_main.html
+++ b/httemplate/edit/prospect_main.html
@@ -50,6 +50,7 @@
},
{ 'field' => 'taxstatusnum',
'type' => 'select-tax_status',
+ 'required' => 1,
'empty_label' => ' ',
},
],