From aa17ca1562130ebfb6666d65a4d93e4037627364 Mon Sep 17 00:00:00 2001 From: drastik <jwjoshuawalker@gmail.com> Date: Fri, 9 Jan 2015 13:42:35 -0600 Subject: [PATCH] * Fix JS issue introduced in 9f840628a0533c371e034d48212bfed94d2695da ** This would cause the "Stripe.js token not passed!" because of a JS error. --- js/civicrm_stripe.js | 4 ++-- stripe.php | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/civicrm_stripe.js b/js/civicrm_stripe.js index 2dbf462f..17c4f62c 100644 --- a/js/civicrm_stripe.js +++ b/js/civicrm_stripe.js @@ -2,7 +2,7 @@ * @file * JS Integration between CiviCRM & Stripe. */ -(function ($) { +(function($, CRM) { var $form, $submit, buttonText; @@ -93,4 +93,4 @@ return false; }); }); -}(CRM.$)); +}(cj, CRM)); diff --git a/stripe.php b/stripe.php index 71199685..8a9eecf1 100644 --- a/stripe.php +++ b/stripe.php @@ -125,7 +125,7 @@ function stripe_civicrm_buildForm($formName, &$form) { if (empty($form->_attributes['class'])) { $form->_attributes['class'] = ''; } - $form->_attributes['class'] .= " stripe-payment-form"; + $form->_attributes['class'] .= ' stripe-payment-form'; $form->addElement('hidden', 'stripe_token', NULL, array('id' => 'stripe-token')); stripe_add_stripe_js($form); } @@ -152,7 +152,10 @@ function stripe_civicrm_buildForm($formName, &$form) { ); if (in_array($formName, $backendForms) && !empty($form->_processors)) { if (!isset($form->_elementIndex['stripe_token'])) { - $form->_attributes['class'] .= " stripe-payment-form"; + if (empty($form->_attributes['class'])) { + $form->_attributes['class'] = ''; + } + $form->_attributes['class'] .= ' stripe-payment-form'; $form->addElement('hidden', 'stripe_token', NULL, array('id' => 'stripe-token')); stripe_add_stripe_js($form); } -- GitLab