X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=53db722ddcb755dae6a7b58878ad3b7349196943;hb=f8f4c51eaa6f5aa3d49672fe7a17f19fa22494c0;hp=ff8226c8d606b40a45b9ceb708389424f2815c53;hpb=08b36523ebbf6e2995878f26bfac988f32f7a218;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index ff8226c8d..53db722dd 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -659,7 +659,7 @@ Returns an SQL fragment to retreive the unapplied amount. =cut sub unapplied_sql { - my ($class, $start, $end) = shift; + my ($class, $start, $end) = @_; my $bill_start = $start ? "AND cust_bill_pay._date <= $start" : ''; my $bill_end = $end ? "AND cust_bill_pay._date > $end" : ''; my $refund_start = $start ? "AND cust_pay_refund._date <= $start" : ''; @@ -693,6 +693,10 @@ sub _upgrade_data { #class method warn "$me upgrading $class\n" if $DEBUG; + ## + # otaker/ivan upgrade + ## + #not the most efficient, but hey, it only has to run once my $where = "WHERE ( otaker IS NULL OR otaker = '' OR otaker = 'ivan' ) ". @@ -748,6 +752,33 @@ sub _upgrade_data { #class method } + ### + # payinfo N/A upgrade + ### + + my @na_cust_pay = qsearch( { + 'table' => 'cust_pay', + 'hashref' => { 'payinfo' => 'N/A' }, + 'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )", + } ); + + foreach my $na ( @na_cust_pay ) { + my $cust_pay_pending = + qsearchs('cust_pay_pending', { 'paynum' => $na->paynum } ); + $na->$_($cust_pay_pending->$_) for qw( payinfo paymask ); + my $error = $na->replace; + if ( $error ) { + warn " *** WARNING: Error updating payinfo for payment paynum ". + $na->paynun. ": $error\n"; + next; + } + + } + + ### + # otaker->usernum upgrade + ### + $class->_upgrade_otaker(%opts); }