[freeside-commits] freeside/FS/FS cust_pay.pm,1.61,1.62

Ivan,,, ivan at wavetail.420.am
Thu Mar 13 01:57:46 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv12522

Modified Files:
	cust_pay.pm 
Log Message:
allow cust_pay.otaker upgrade to proceed even if there are some old crufty records around attached to now-deleted customers

Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cust_pay.pm	4 Mar 2008 21:06:42 -0000	1.61
+++ cust_pay.pm	13 Mar 2008 08:57:41 -0000	1.62
@@ -673,7 +673,9 @@
 
   #not the most efficient, but hey, it only has to run once
 
-  my $where = "WHERE otaker IS NULL OR otaker = '' OR otaker = 'ivan' ";
+  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";
 
@@ -705,7 +707,15 @@
 
     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++;



More information about the freeside-commits mailing list