X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=de14610d655ced2afe7612b24076173c2821d03e;hb=188c20600560139fc40811c6538a18109c050f95;hp=90a14ea02af052ae5e7c92898bb7b3cd544603d8;hpb=ea811d7900590c66ed62b56c889c1042897e87e3;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 90a14ea02..de14610d6 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,11 @@ 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' ) ". + " AND 0 < ( SELECT COUNT(*) FROM cust_main ". + " WHERE cust_main.custnum = cust_pay.custnum ) "; + + 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,7 +692,7 @@ 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', } ); @@ -706,7 +707,15 @@ sub _upgrade_data { #class method delete $FS::payby::hash{'COMP'}->{cust_pay}; #quelle kludge my $error = $cust_pay->replace; + + #infinite... + #if ( $error ) { + # warn " *** WARNING: Error updaating order taker for payment paynum". + # $cust_pay->paynun. ": $error\n"; + # next; + #} die $error if $error; + $FS::payby::hash{'COMP'}->{cust_pay} = ''; #restore it $count++;