X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_refund.pm;h=2d5b3aaae1ff770fd3d5818e304702b8acffb147;hb=59fec17626ae0cf63b9b527360a617034c9d2993;hp=12ab0d693316048b36fd2fc2c47658a50f71e3eb;hpb=691b4de7c0a7d0e39bebe2ea7fadea5fb21b1539;p=freeside.git diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm index 12ab0d693..2d5b3aaae 100644 --- a/FS/FS/cust_refund.pm +++ b/FS/FS/cust_refund.pm @@ -472,6 +472,19 @@ sub unapplied_sql { } +sub _upgrade_schema { + #my ($class, %opts) = @_; + + my $sql = 'UPDATE cust_refund SET source_paynum = NULL + WHERE source_paynum IS NOT NULL + AND NOT EXISTS ( SELECT 1 FROM cust_pay + WHERE paynum = cust_refund.source_paynum ) + '; + my $sth = dbh->prepare($sql) or die dbh->errstr; + $sth->execute or die $sth->errstr; + ''; +} + # Used by FS::Upgrade to migrate to a new database. sub _upgrade_data { # class method my ($class, %opts) = @_;