summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormark <mark>2010-10-22 22:38:37 +0000
committermark <mark>2010-10-22 22:38:37 +0000
commit0dcb2b5174594aa4675de053fb68108d74fc53eb (patch)
tree9f50338c7b8a5db5b3311dafea6001e0ce4eadbc /bin
parent314763d9596378c8250718e3414d7ae61273155a (diff)
fix contract_end bug, RT#10319
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fix-contract_end24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/fix-contract_end b/bin/fix-contract_end
new file mode 100755
index 000000000..6458722ef
--- /dev/null
+++ b/bin/fix-contract_end
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use FS::Record;
+use FS::UID qw(adminsuidsetup dbh driver_name);
+
+# Fix bad values in some contract_end fields resulting from a short-lived bug
+
+my $dbh = adminsuidsetup(shift) or die "Usage: fix-contract_end username\n";
+local $FS::UID::AutoCommit = 0;
+
+my @updates = (
+ q!UPDATE cust_pkg SET contract_end = NULL WHERE contract_end = -1!,
+ q!UPDATE part_pkg_option SET optionvalue = NULL WHERE optionname = 'contract_end_months' AND optionvalue = '(none)'!,
+);
+
+foreach my $sql (@updates) {
+ print "$sql\n";
+ my $rows = $dbh->do($sql);
+ print "$rows rows.\n";
+ die $dbh->errstr if $dbh->errstr;
+}
+$dbh->commit or die $dbh->errstr;