RT#42393: Verification cust_pay_pending handling in history & report
[freeside.git] / bin / tax_location.upgrade
1 #!/usr/bin/perl
2
3 use FS::UID qw(adminsuidsetup);
4 use FS::Record;
5 use FS::cust_bill_pkg;
6 use Date::Parse qw(str2time);
7 use Getopt::Std;
8 getopts('s:e:');
9 my $username = shift @ARGV;
10
11 if (!$username) {
12   print
13 "Usage: tax_location.upgrade [ -s START ] [ -e END ] username
14
15 This script creates cust_bill_pkg_tax_location and cust_tax_exempt_pkg records
16 for existing sales tax records prior to the 3.0 cust_location changes.  Changes
17 will be committed immediately; back up your data and run 'make
18 install-perl-modules' and 'freeside-upgrade' before running this script.  
19 START and END specify an optional range of invoice dates to upgrade.
20
21 ";
22   exit(1);
23 }
24
25 my %opt;
26 $opt{s} = str2time($opt_s) if $opt_s;
27 $opt{e} = str2time($opt_e) if $opt_e;
28
29 adminsuidsetup($username);
30 FS::cust_bill_pkg->upgrade_tax_location(%opt);
31 1;