summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-05-30 00:53:04 +0000
committerivan <ivan>2008-05-30 00:53:04 +0000
commit2212d77b5379ab6bc3907058b8e672106da7cf21 (patch)
tree3ff52343aec0878ee30bc8f518e63e7774a05830
parentb18cc967e340065e579c4b4644796ae5b1918b59 (diff)
clean up any stray/old cust_pay_pending records causing problems
-rw-r--r--FS/FS/Upgrade.pm3
-rw-r--r--FS/FS/cust_pay_pending.pm15
2 files changed, 18 insertions, 0 deletions
diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm
index 5c873bfed..8f3a6e571 100644
--- a/FS/FS/Upgrade.pm
+++ b/FS/FS/Upgrade.pm
@@ -100,6 +100,9 @@ sub upgrade_data {
#populate part_pkg_taxclass for starters
'part_pkg_taxclass' => [],
+ #remove bad pending records
+ 'cust_pay_pending' => [],
+
;
\%hash;
diff --git a/FS/FS/cust_pay_pending.pm b/FS/FS/cust_pay_pending.pm
index ad39b10d7..e5d01c013 100644
--- a/FS/FS/cust_pay_pending.pm
+++ b/FS/FS/cust_pay_pending.pm
@@ -215,6 +215,21 @@ sub check {
$self->SUPER::check;
}
+# _upgrade_data
+#
+# Used by FS::Upgrade to migrate to a new database.
+
+sub _upgrade_data { #class method
+ my ($class, %opts) = @_;
+
+ my $sql =
+ "DELETE FROM cust_pay_pending WHERE status = 'new' AND _date < ".(time-600);
+
+ my $sth = dbh->prepare($sql) or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+
+}
+
=back
=head1 BUGS