CRM-12856 - CRM_Core_Lock - Quieter logs
[civicrm-core.git] / CRM / Core / Payment.php
index 0ec1c5853242d4f27c95a2f5245dd8773cae32f7..56249840903185d4f2f806e43a08b0e0daa56e21 100644 (file)
@@ -255,16 +255,12 @@ abstract class CRM_Core_Payment {
       // Check pp is extension
       $ext = CRM_Extension_System::singleton()->getMapper();
       if ($ext->isExtensionKey($dao->class_name)) {
-        $extension_instance_found = TRUE;
         $paymentClass = $ext->keyToClass($dao->class_name, 'payment');
         require_once $ext->classToPath($paymentClass);
       }
       else {
         // Legacy or extension as module instance
-        if(empty($paymentClass)) {
-          $paymentClass = 'CRM_Core_' . $dao->class_name;
-
-        }
+        $paymentClass = 'CRM_Core_' . $dao->class_name;
       }
 
       $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($dao->processor_id, $mode);
@@ -288,6 +284,7 @@ abstract class CRM_Core_Payment {
 
       // Everything, it seems, is ok - execute pp callback handler
       $processorInstance->$method();
+      $extension_instance_found = TRUE;
     }
 
     if (!$extension_instance_found) CRM_Core_Error::fatal(
@@ -376,8 +373,9 @@ INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
    */
   static function allowBackofficeCreditCard($template = NULL, $variableName = 'newCredit') {
     $newCredit = FALSE;
+    // restrict to type=1 (credit card) payment processor payment_types and only include billing mode types 1 and 3
     $processors = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE,
-      "billing_mode IN ( 1, 3 )"
+      "billing_mode IN ( 1, 3 ) AND payment_type = 1"
     );
     if (count($processors) > 0) {
       $newCredit = TRUE;