dev/financial#147 Ensure that jQuery Validation doesn't execute when we click the...
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 14 Sep 2020 00:59:28 +0000 (10:59 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 14 Sep 2020 00:59:28 +0000 (10:59 +1000)
CRM/Core/Payment/PayPalImpl.php

index be3f794b11ef4d2f3b91da398b7bf003006bce62..b1833a8752ca0cb1ec08a2d5dda3b275f02eb989 100644 (file)
@@ -160,12 +160,22 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
         $form->_expressButtonName = $form->getButtonName('upload', 'express');
       }
       $form->assign('expressButtonName', $form->_expressButtonName);
-      $form->add(
-        'image',
-        $form->_expressButtonName,
-        $this->_paymentProcessor['url_button'],
-        ['class' => 'crm-form-submit']
-      );
+      $form->add('xbutton', $form->_expressButtonName, ts('Pay using PayPal'), [
+        'type' => 'submit',
+        'formnovalidate' => 'formnovalidate',
+        'class' => 'crm-form-submit',
+      ]);
+      CRM_Core_Resources::singleton()->addStyle('
+        button#' . $form->_expressButtonName . '{
+         background-image: url(' . $this->_paymentProcessor['url_button'] . ');
+         color: transparent;
+         background-repeat: no-repeat;
+         background-color: transparent;
+         background-position: center;
+         min-width: 150px;
+         min-height: 50px;
+         border: none;
+       ');
     }
   }
 
@@ -1108,7 +1118,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     if ($this->isPayPalType($this::PAYPAL_EXPRESS)) {
       return TRUE;
     }
-
     // This would occur postProcess.
     if (!empty($params['token'])) {
       return TRUE;
@@ -1122,6 +1131,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $possibleExpressFields = [
       '_qf_Register_upload_express_x',
       '_qf_Payment_upload_express_x',
+      '_qf_Main_upload_express',
     ];
     if (array_intersect_key($params, array_fill_keys($possibleExpressFields, 1))) {
       return TRUE;