From: ivan <ivan>
Date: Fri, 22 Oct 2010 06:37:09 +0000 (+0000)
Subject: deal with multiply-voided payments
X-Git-Tag: freeside_2_1_1~1^2~69
X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;ds=sidebyside;h=20083b23d487f90b27f228262171152e98c5d9fc;p=freeside.git

deal with multiply-voided payments
---

diff --git a/FS/FS/cust_pay_void.pm b/FS/FS/cust_pay_void.pm
index 1a298ba2c..3a30acbac 100644
--- a/FS/FS/cust_pay_void.pm
+++ b/FS/FS/cust_pay_void.pm
@@ -253,7 +253,7 @@ sub void_access_user {
 sub _upgrade_data {  # class method
   my ($class, %opts) = @_;
 
-  my $sql = "SELECT usernum FROM access_user WHERE username = ( SELECT history_user FROM h_cust_pay_void WHERE paynum = ? AND history_action = 'insert' ) ";
+  my $sql = "SELECT usernum FROM access_user WHERE username = ( SELECT history_user FROM h_cust_pay_void WHERE paynum = ? AND history_action = 'insert' ORDER BY history_date LIMIT 1 ) ";
   my $sth = dbh->prepare($sql) or die dbh->errstr;
 
   foreach my $cust_pay_void (qsearch('cust_pay_void', {'void_usernum' => ''})) {