Commit 582ab628 authored by rubofvil's avatar rubofvil
Browse files

Webform civicrm, consider more cases of parameters available

parent af1689b8
......@@ -118,16 +118,24 @@ class CRM_Core_Payment_Redsys extends CRM_Core_Payment {
CRM_Core_Error::fatal(E::ts('Component is invalid'));
}
if (array_key_exists('webform_redirect_success', $params)) {
$returnURL = $params['webform_redirect_success'];
$cancelURL = $params['webform_redirect_cancel'];
}
elseif (!empty($this->successUrl)) {
$config = CRM_Core_Config::singleton();
$returnURL = (strpos($this->successUrl, '/') === 0) ? $config->userFrameworkBaseURL . $this->successUrl : $this->successUrl;
$cancelURL = (strpos($this->cancelUrl, '/') === 0) ? $config->userFrameworkBaseURL . $this->cancelUrl : $this->cancelUrl;
// Drupal Webform CiviCRM workflow
if (!empty($this->successUrl) || !empty($params['webform_redirect_success'])) {
if ((!empty($this->successUrl) && !empty($this->successUrl)) ||
(!empty($params['webform_redirect_success']) && !empty($params['webform_redirect_cancel']))
) {
$returnURL = $this->successUrl ? $this->successUrl : $params['webform_redirect_success'];
$cancelURL = $this->cancelUrl ? $this->cancelUrl : $params['webform_redirect_cancel'];
// Avoid issues with relative paths
$config = CRM_Core_Config::singleton();
$returnURL = (strpos($returnURL, '/') === 0) ? $config->userFrameworkBaseURL . $returnURL : $returnURL;
$cancelURL = (strpos($returnURL, '/') === 0) ? $config->userFrameworkBaseURL . $cancelURL : $cancelURL;
}
else {
throw new CRM_Core_Exception(E::ts("Redsys payment processor - Missing vars to launch process of redirects."));
}
}
// CiviCRM Core Workflow, Contribution Pages / Events
else {
$url = ($component == 'event') ? 'civicrm/event/register' : 'civicrm/contribute/transact';
$cancel = ($component == 'event') ? '_qf_Register_display' : '_qf_Main_display';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment