[freeside-commits] branch master updated. 84bc64eeaa9650333fbbb79ecb03a1aff4a347fd
Mark Wells
mark at 420.am
Wed Jun 29 00:42:45 PDT 2016
The branch, master has been updated
via 84bc64eeaa9650333fbbb79ecb03a1aff4a347fd (commit)
via 539daa850d829061bb0901c2851ec6ddf685030e (commit)
from ca00b528d98dbf454bae7b497c8d83ca8851724c (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 84bc64eeaa9650333fbbb79ecb03a1aff4a347fd
Author: Mark Wells <mark at freeside.biz>
Date: Wed Jun 29 00:41:18 2016 -0700
make customer tax status a required field when the vendor requires it, #39639
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' => ' ',
},
],
commit 539daa850d829061bb0901c2851ec6ddf685030e
Author: Mark Wells <mark at freeside.biz>
Date: Wed Jun 29 00:20:58 2016 -0700
script to set up Suretax customer statuses, #39639
diff --git a/bin/set-tax-status b/bin/set-tax-status
new file mode 100755
index 0000000..d656780
--- /dev/null
+++ b/bin/set-tax-status
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+
+use FS::Misc::Getopt;
+use FS::cust_main;
+use FS::Record qw(qsearch dbh);
+use FS::Conf;
+getopts('');
+
+my $conf = FS::Conf->new;
+if ( $conf->config('tax_data_vendor') ne 'suretax' ) {
+ die "This script is for Suretax only.";
+}
+
+$FS::UID::AutoCommit = 0;
+local $FS::cust_main::ignore_expired_card = 1;
+local $FS::cust_main::ignore_invalid_card = 1;
+local $FS::cust_main::import = 1;
+
+my %taxstatusnum = map {
+ $_->taxstatus => $_->taxstatusnum
+} qsearch('tax_status', { data_vendor => 'suretax' });
+
+foreach my $cust_main (qsearch('cust_main', { taxstatusnum => '' })) {
+ my $status = length($cust_main->company) ? 'B' : 'R';
+ print $cust_main->custnum . "\t" .
+ $cust_main->name_short . "\t" .
+ $status . "\n";
+ $cust_main->set('taxstatusnum', $taxstatusnum{ $status });
+ my $error = $cust_main->replace;
+ die $error if $error;
+}
+
+warn "Finished.\n";
+dbh->commit;
-----------------------------------------------------------------------
Summary of changes:
bin/set-tax-status | 34 ++++++++++++++++++++++++++++
httemplate/edit/process/cust_main.cgi | 9 ++++++++
httemplate/edit/process/prospect_main.html | 11 +++++++++
httemplate/edit/prospect_main.html | 1 +
4 files changed, 55 insertions(+)
create mode 100755 bin/set-tax-status
More information about the freeside-commits
mailing list