From 11d000e667b5b07e877971c55311ca5c376b5ba1 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 14 Sep 2020 10:59:28 +1000 Subject: [PATCH] dev/financial#147 Ensure that jQuery Validation doesn't execute when we click the paypal express button and ensure the style of the button doesn't change --- CRM/Core/Payment/PayPalImpl.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 79c2ecd9de99..38a6eb300d3e 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -160,12 +160,22 @@ protected function addPaypalExpressCode(&$form) { $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; + '); } } @@ -1109,7 +1119,6 @@ protected function isPaypalExpress($params) { if ($this->isPayPalType($this::PAYPAL_EXPRESS)) { return TRUE; } - // This would occur postProcess. if (!empty($params['token'])) { return TRUE; @@ -1123,6 +1132,7 @@ protected function isPaypalExpress($params) { $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;