Fix CRM-12560 by matching test trxn_ids only which can be incremented.
authorChris Burgess <chris@giantrobot.co.nz>
Wed, 8 May 2013 02:42:41 +0000 (14:42 +1200)
committerChris Burgess <chris@giantrobot.co.nz>
Wed, 8 May 2013 02:42:41 +0000 (14:42 +1200)
CRM/Core/Payment/AuthorizeNet.php

index 3b4047575d008156896e5990ef82a9f9996974a1..558fe93a36fba692e41e118ef91cdf2eafa52134 100644 (file)
@@ -185,7 +185,7 @@ class CRM_Core_Payment_AuthorizeNet extends CRM_Core_Payment {
     // hence treat that also as test mode transaction
     // fix for CRM-2566
     if (($this->_mode == 'test') || $response_fields[6] == 0) {
-      $query             = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test%'";
+      $query             = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id RLIKE 'test[0-9]+'";
       $p                 = array();
       $trxn_id           = strval(CRM_Core_Dao::singleValueQuery($query, $p));
       $trxn_id           = str_replace('test', '', $trxn_id);