Merge branch 'onlyjob-master'
[civicrm-core.git] / CRM / Core / Payment / Elavon.php
index a45c07c0bd3a6ac41b18d1d6e5d9be0bd742fa70..bcbe845b7d158c060c079dd24e18b4bd8bf0dcf7 100644 (file)
@@ -145,7 +145,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
     CRM_Utils_Hook::alterPaymentProcessorParams($this, $params, $requestFields);
 
     // Check to see if we have a duplicate before we send
-    if ($this->_checkDupe($params['invoiceID'])) {
+    if ($this->checkDupe($params['invoiceID'], CRM_Utils_Array::value('contributionID', $params))) {
       return self::errorExit(9003, 'It appears that this transaction is a duplicate.  Have you already submitted the form once?  If so there may have been a connection problem.  Check your email for a receipt.  If you do not receive a receipt within 2 hours you can try your transaction again.  If you continue to have problems please contact the site administrator.');
     }
 
@@ -259,21 +259,6 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment {
     }
   }
 
-  /**
-   * Checks to see if invoice_id already exists in db.
-   *
-   * @param int $invoiceId
-   *   The ID to check.
-   *
-   * @return bool
-   *   True if ID exists, else false
-   */
-  public function _checkDupe($invoiceId) {
-    $contribution = new CRM_Contribute_DAO_Contribution();
-    $contribution->invoice_id = $invoiceId;
-    return $contribution->find();
-  }
-
   /**
    * Produces error message and returns from class.
    * @param string $errorCode