X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_refund.pm;h=44d4d97d6fef338953fe13c70afd52e8e0bc11b9;hb=639e88d37ab33deeea4db7c8d1f15e8967f1826f;hp=4affb151a2c393c3caf5e7ba4693217f32a1c4cb;hpb=2787aff7551116a223b4dea8bb144c1d03452d01;p=freeside.git diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm index 4affb151a..44d4d97d6 100644 --- a/FS/FS/cust_refund.pm +++ b/FS/FS/cust_refund.pm @@ -515,6 +515,19 @@ sub reason { ( $self->addlinfo ? ' '.$self->addlinfo : '' ); } +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) = @_;