the master control program has chosen YOU to serve your system on the game grid
[freeside.git] / FS / FS / cust_pay_pending.pm
index ad39b10..7469720 100644 (file)
@@ -2,7 +2,7 @@ package FS::cust_pay_pending;
 
 use strict;
 use vars qw( @ISA  @encrypted_fields );
-use FS::Record qw( qsearch qsearchs );
+use FS::Record qw( qsearch qsearchs dbh ); #dbh for _upgrade_data
 use FS::payby;
 use FS::payinfo_Mixin;
 use FS::cust_main;
@@ -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