ACL for hardware class config, RT#85057
[freeside.git] / FS / FS / cust_bill_pay_batch.pm
index 30fb744..a9d07d3 100644 (file)
@@ -1,10 +1,8 @@
 package FS::cust_bill_pay_batch;
+use base qw( FS::Record );
 
 use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
+use FS::Record qw( dbh );
 
 =head1 NAME
 
@@ -106,6 +104,24 @@ sub check {
 
 =back
 
+=cut
+
+
+sub _upgrade_schema {
+  my ($class, %opts) = @_;
+
+  my $sql = '
+    DELETE FROM cust_bill_pay_batch WHERE NOT EXISTS
+      ( SELECT 1 FROM cust_pay_batch WHERE cust_pay_batch.paybatchnum = cust_bill_pay_batch.paybatchnum )
+  ';
+
+  my $sth = dbh->prepare($sql) or die dbh->errstr;
+  $sth->execute or die $sth->errstr;
+  '';
+
+}
+
+
 =head1 BUGS
 
 Just hangs there.