summaryrefslogtreecommitdiff
path: root/FS/FS/cust_pay.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-05-07 23:43:07 -0700
committerMark Wells <mark@freeside.biz>2014-05-07 23:43:07 -0700
commit6e0f3e5ce5de21104124afa048b2787e36ac0131 (patch)
tree49c9784746d993e569406fdc2280daaa0f9899d1 /FS/FS/cust_pay.pm
parent903a18a39978770c60c6334c9342831be426cec5 (diff)
upgrade in reverse numeric order, #29017
Diffstat (limited to 'FS/FS/cust_pay.pm')
-rw-r--r--FS/FS/cust_pay.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index e3670db..775c353 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1066,12 +1066,14 @@ sub process_upgrade_paybatch {
foreach my $table (qw(cust_pay cust_pay_void cust_refund)) {
my $and_batchnum_is_null =
( $table =~ /^cust_pay/ ? ' AND batchnum IS NULL' : '' );
+ my $pkey = ($table =~ /^cust_pay/ ? 'paynum' : 'refundnum');
my $search = FS::Cursor->new({
table => $table,
extra_sql => "WHERE payby IN('CARD','CHEK') ".
"AND (paybatch IS NOT NULL ".
"OR (paybatch IS NULL AND auth IS NULL
- $and_batchnum_is_null ) )",
+ $and_batchnum_is_null ) )
+ ORDER BY $pkey DESC"
});
while ( my $object = $search->fetch ) {
if ( $object->paybatch eq '' ) {