Skip to content
Snippets Groups Projects
Commit b24bc18b authored by mattwire's avatar mattwire Committed by mattwire
Browse files

Check for isBackOffice instead of individual forms

parent 2016de7b
Branches
Tags
No related merge requests found
......@@ -277,14 +277,18 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
if (empty($form->_paymentProcessor)) {
return;
}
// Determine if we are dealing with a webform in CiviCRM 4.7. Those don't have a
// _paymentProcessors array and only have one payprocesssor.
if (in_array(get_class($form), array('CRM_Financial_Form_Payment', 'CRM_Contribute_Form_Contribution'))) {
// When called from admin backend (eg via CRM_Contribute_Form_Contribution, CRM_Member_Form_Membership)
// the isBackOffice flag will be set to true.
// But if called via webform in CiviCRM 4.7: isBackOffice=NULL and for is of class CRM_Financial_Form_Payment or CRM_Contribute_Form_Contribution
// Those don't have a _paymentProcessors array and only have one payprocesssor.
if (!empty($form->isBackOffice)
|| (in_array(get_class($form), array('CRM_Financial_Form_Payment', 'CRM_Contribute_Form_Contribution')))) {
return $stripe_ppid = $form->_paymentProcessor['id'];
}
else {
// Find a Stripe pay processor ascociated with this Civi form and find the ID.
// $payProcessors = $form->_paymentProcessors;
// $payProcessors = $form->_paymentProcessors;
$payProcessors = CRM_Core_Form_Stripe::get_ppids($form);
foreach ($payProcessors as $payProcessor) {
if ($payProcessor['class_name'] == 'Payment_Stripe') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment