X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=acb2844290b39934a652f8ee14df5423f2b3b404;hb=41ed76e0e3625c9f175743d253ad06fc67302d0f;hp=67f34c38780ef3c1d8f3d8629443de1f14e78afe;hpb=3684dae04773904d5500ef93253c5f4c2f6d7f38;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 67f34c387..acb284429 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -432,8 +432,6 @@ sub check { # " already exists"; # } - $self->otaker(getotaker); - $self->SUPER::check; } @@ -675,8 +673,9 @@ sub _upgrade_data { #class method #not the most efficient, but hey, it only has to run once - my $count_sql = - "SELECT COUNT(*) FROM cust_pay WHERE otaker IS NULL OR otaker = ''"; + my $where = "WHERE otaker IS NULL OR otaker = '' OR otaker = 'ivan' "; + + my $count_sql = "SELECT COUNT(*) FROM cust_pay $where"; my $sth = dbh->prepare($count_sql) or die dbh->errstr; $sth->execute or die $sth->errstr; @@ -691,16 +690,23 @@ sub _upgrade_data { #class method my $cust_pay = qsearchs( { 'table' => 'cust_pay', 'hashref' => {}, - 'extra_sql' => "WHERE otaker IS NULL OR otaker = ''", + 'extra_sql' => $where, 'order_by' => 'ORDER BY paynum LIMIT 1', } ); return unless $cust_pay; my $h_cust_pay = $cust_pay->h_search('insert'); - $cust_pay->otaker($h_cust_pay->history_user); + if ( $h_cust_pay ) { + $cust_pay->otaker($h_cust_pay->history_user); + } else { + $cust_pay->otaker('legacy'); + } + + delete $FS::payby::hash{'COMP'}->{cust_pay}; #quelle kludge my $error = $cust_pay->replace; die $error if $error; + $FS::payby::hash{'COMP'}->{cust_pay} = ''; #restore it $count++; if ( $DEBUG > 1 && $lastprog + 30 < time ) {