summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-09-26 00:53:05 -0700
committerMark Wells <mark@freeside.biz>2012-09-26 00:53:05 -0700
commit82d8565fbeaebd69177a3a14d833685ecb86a545 (patch)
tree2b5313e05aaa0cdbc1be393f10263010db2d62d8 /bin
parenteb9148f0ab9aac5e4f89824b7fab6bb9d648e688 (diff)
tax calculation and reporting for new customer locations, #940
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tax_location.upgrade31
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/tax_location.upgrade b/bin/tax_location.upgrade
new file mode 100755
index 000000000..814094551
--- /dev/null
+++ b/bin/tax_location.upgrade
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use FS::UID qw(adminsuidsetup);
+use FS::Record;
+use FS::cust_bill_pkg;
+use Date::Parse qw(str2time);
+use Getopt::Std;
+getopts('s:e:');
+my $username = shift @ARGV;
+
+if (!$username) {
+ print
+"Usage: tax_location.upgrade [ -s START ] [ -e END ] username
+
+This script creates cust_bill_pkg_tax_location and cust_tax_exempt_pkg records
+for existing sales tax records prior to the 3.0 cust_location changes. Changes
+will be committed immediately; back up your data and run 'make
+install-perl-modules' and 'freeside-upgrade' before running this script.
+START and END specify an optional range of invoice dates to upgrade.
+
+";
+ exit(1);
+}
+
+my %opt;
+$opt{s} = str2time($opt_s) if $opt_s;
+$opt{e} = str2time($opt_e) if $opt_e;
+
+adminsuidsetup($username);
+FS::cust_bill_pkg->upgrade_tax_location(%opt);
+1;