Have checkCbTransID check only against the current gateway's transactions
As it is now, the checkCbTransID function seems to just check if a given transactionID already exists in the tblaccounts table.
Theoretically (very theoritically), this could cause issues.
Let's say we use two different payment gateways. These payment gateways both use the same format for transactionIDs (eg. an interger consisting of 10 digits).
In theory, transactionIDs *could* be identical across the two payment gateways. Here's an example:
1. Client A pays for invoice #1 using Payment Gateway 1
2. His transaction is assigned ID 1234567890
3. WHMCS checks if this ID exists anywhere in the database; it does not
4. The payment is added to invoice #1
5. A few years passes, and Client B pays for invoice #7000 using Payment Gateway 2
6. His transaction is assigned ID 1234567890
7. WHMCS checks is this ID exists anywhere in the database; YIKES! It does
8. WHMCS will not add the payment to the invoice as the transaction already exists
I know... It's very unlikely that it will ever happen, but there's a chance that it might - and the solution is rather simple. Instead of checking against the entire tblaccounts table, WHMCS should only check against transactions made by the same payment gateway.