Skip to content
Snippets Groups Projects
Commit 52efe677 authored by mattwire's avatar mattwire
Browse files

Cleanup, load js.stripe.com for events

parent 3768ccfe
Branches
Tags
No related merge requests found
......@@ -50,7 +50,10 @@
// Re-prep form when we've loaded a new payproc
$( document ).ajaxComplete(function( event, xhr, settings ) {
if (settings.url.match("/civicrm/payment/form?")) {
// /civicrm/payment/form? occurs when a payproc is selected on page
// /civicrm/contact/view/participant occurs when payproc is first loaded on event credit card payment
if ((settings.url.match("/civicrm/payment/form?"))
|| (settings.url.match("/civicrm/contact/view/participant?"))) {
loadStripeBillingBlock();
}
});
......
......@@ -60,7 +60,7 @@ function stripe_civicrm_install() {
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
");
return _stripe_civix_civicrm_install();
_stripe_civix_civicrm_install();
}
/**
......@@ -73,7 +73,7 @@ function stripe_civicrm_uninstall() {
CRM_Core_DAO::executeQuery("DROP TABLE civicrm_stripe_plans");
CRM_Core_DAO::executeQuery("DROP TABLE civicrm_stripe_subscriptions");
return _stripe_civix_civicrm_uninstall();
_stripe_civix_civicrm_uninstall();
}
/**
......@@ -96,7 +96,7 @@ function stripe_civicrm_enable() {
<br />Webhook path to enter in Stripe:<br/><em>$webookhook_path</em>
<br />");
return _stripe_civix_civicrm_enable();
_stripe_civix_civicrm_enable();
}
/**
......@@ -149,7 +149,7 @@ function stripe_civicrm_managed(&$entities) {
),
);
return _stripe_civix_civicrm_managed($entities);
_stripe_civix_civicrm_managed($entities);
}
/**
......@@ -188,20 +188,6 @@ function stripe_civicrm_managed(&$entities) {
}
}
/**
* Implementation of hook_civicrm_alterContent
*
* Adding civicrm_stripe.js in a way that works for webforms and Civi forms.
*
* @return void
*/
function stripe_civicrm_alterContent( &$content, $context, $tplName, &$object ) {
if ($context == 'form' && !empty($object->_paymentProcessor['class_name'])) {
$stripeJSURL = CRM_Core_Resources::singleton()->getUrl('com.drastikbydesign.stripe', 'js/civicrm_stripe.js');
$content .= "<script src='{$stripeJSURL}'></script>";
}
}
/**
* Add stripe.js to forms, to generate stripe token
* @param $formName
......@@ -209,10 +195,8 @@ function stripe_civicrm_managed(&$entities) {
*/
function stripe_civicrm_buildForm($formName, &$form) {
if (!empty($form->_paymentProcessor['class_name'])) {
//CRM_Core_Resources::singleton()->addScriptUrl('https://js.stripe.com/v2/', 10, 'page-body');
}
if (/*$form->isBackOffice &&*/ !empty($form->_paymentProcessor['class_name'])) {
// civicrm_stripe.js is not included on backend form renewal unless we add it here.
CRM_Core_Resources::singleton()->addScriptUrl('https://js.stripe.com/v2/', 10, 'page-body');
CRM_Core_Resources::singleton()->addScriptFile('com.drastikbydesign.stripe', 'js/civicrm_stripe.js');
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment