diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-12-10 20:59:42 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-12-10 20:59:42 -0800 |
commit | 430b2c784d2ee9ea5be00b821d2dbd27279ef132 (patch) | |
tree | c8a224219c1425bd3fa03b1a54487bf1f3de7449 /bin | |
parent | 6ced51db0e73603461591e54b7f606467e7c7af0 (diff) | |
parent | e1157f37c618a7b9cdb2793d61999458076dc51b (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts:
FS/FS/Mason.pm
FS/MANIFEST
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cust_pkg-restore_setup | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/cust_pkg-restore_setup b/bin/cust_pkg-restore_setup index 5467ead..a3761d1 100755 --- a/bin/cust_pkg-restore_setup +++ b/bin/cust_pkg-restore_setup @@ -23,7 +23,7 @@ my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; my $dbh = dbh; -my $fuzz = 2; +#my $fuzz = 2; my $changed = 0; @@ -35,14 +35,10 @@ foreach my $cust_pkg ( }) ) { - #XXX only canceled packages? - #XXX only suspended packages? - my $h_cust_pkg = qsearchs({ table => 'h_cust_pkg', hashref => { pkgnum => $cust_pkg->pkgnum, - history_action => 'replace_old', setup => { op=>'!=', value=>'' }, ($opt_u ? ('susp' => { op=>'!=', value=>'' }) : () @@ -51,7 +47,8 @@ foreach my $cust_pkg ( : () ), }, - extra_sql => ' AND history_date >= ? AND history_date <= ? ', + extra_sql => " AND history_action IN ('insert','replace_old')". + ' AND history_date >= ? AND history_date <= ? ', extra_param => [ [$sdate,'int'], [$edate,'int'] ], order_by => 'ORDER BY history_date DESC LIMIT 1', }) @@ -60,14 +57,20 @@ foreach my $cust_pkg ( $changed++; #if ( $opt_r ) { - print "restoring setup for pkgnum ". $cust_pkg->pkgnum. - " (custnum ". $cust_pkg->custnum. - ") to ". time2str('%D', $h_cust_pkg->setup). "\n"; + #print "restoring setup for pkgnum ". $cust_pkg->pkgnum. + # " (custnum ". $cust_pkg->custnum. + # ") to ". time2str('%D', $h_cust_pkg->setup). "\n"; + print $cust_pkg->pkgnum. ','. + time2str('%D', $h_cust_pkg->setup). ','. + $cust_pkg->custnum. ','. + '"'. $cust_pkg->cust_main->name. '"'. "\n"; #} - $cust_pkg->set('setup', $h_cust_pkg->setup); - my $error = $cust_pkg->replace; - die $error if $error; + #don't actually do it yet ... + #$cust_pkg->set('setup', $h_cust_pkg->setup); + #my $error = $cust_pkg->replace; + ##die $error if $error; + #warn "error changing pkgnum ". $cust_pkg->pkgnum.': '. $error."\n"; } |