protected function addPaypalExpressCode(&$form) {
// @todo use $this->isBackOffice() instead, test.
if (empty($form->isBackOffice)) {
- $form->_expressButtonName = $form->getButtonName('upload', 'express');
+ /*
+ if payment method selected using ajax call then form object is of 'CRM_Financial_Form_Payment',
+ instead of 'CRM_Contribute_Form_Contribution_Main' so it generate wrong button name
+ and then clicking on express button it redirect to confirm screen rather than PayPal Express form
+ */
+ if ('CRM_Financial_Form_Payment' == get_class($form) && $form->_formName) {
+ $form->_expressButtonName = '_qf_'.$form->_formName.'_upload_express';
+ }
+ else {
+ $form->_expressButtonName = $form->getButtonName('upload', 'express');
+ }
$form->assign('expressButtonName', $form->_expressButtonName);
$form->add(
'image',
*/
public $isBackOffice = FALSE;
+ /**
+ * @var String
+ */
+ public $_formName = '';
+
/**
* Set variables up before form is built.
*/
public function preProcess() {
parent::preProcess();
+ $this->_formName = CRM_Utils_Request::retrieve('formName', 'String', $this);
+
$this->_values['custom_pre_id'] = CRM_Utils_Request::retrieve('pre_profile_id', 'Integer', $this);
$this->_paymentProcessorID = CRM_Utils_Request::retrieve('processor_id', 'Integer', CRM_Core_DAO::$_nullObject,
var payment_instrument_id = $('#payment_instrument_id').val();
- var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="¤cy=`$currency`&`$urlPathVar``$isBackOfficePathVar``$profilePathVar``$contributionPageID``$preProfileID`processor_id="}" + type;
+ var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="&formName=`$form.formName`¤cy=`$currency`&`$urlPathVar``$isBackOfficePathVar``$profilePathVar``$contributionPageID``$preProfileID`processor_id="}" + type;
{literal}
if (typeof(CRM.vars) != "undefined") {
if (typeof(CRM.vars.coreForm) != "undefined") {