summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-05-07 23:42:58 -0700
committerMark Wells <mark@freeside.biz>2014-05-07 23:42:58 -0700
commit13d6bd1395b5f006cab027d68723c7a8eab47a4f (patch)
tree709909325d48fb5d44d4afa95537eaf02afaaa2a
parented4d5fe0311a21c687083e1edca5ef36b9dbb049 (diff)
upgrade in reverse numeric order, #29017
-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 7b68ae2af..3413a077a 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1100,12 +1100,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 '' ) {