Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.1
-
Fix Version/s: 2.1.2
-
Component/s: CiviContribute
-
Labels:None
Description
Contribution pages with CMS user sign-up and 'On Behalf Of' incorrectly link CMS user to the Organization rather than Individual.
To recreate:
1. Create a contribution form with 'On Behalf Of' enabled, and include a profile that enables CMS user sign-up.
2. Complete the contribution form selecting On Behalf Of, and selecting Create CMS User.
3. Log into the CMS using the new user account and observe that the contact dashboard is for the Organization rather than the individual.
Desire behaviour:
New CMS users are created for the Individual completing the form, rather than the Organization.
My fix (sorry for hand written patch):
CRM/Contribute/Form/Contribution.php Near line 447
if ( $processMembership ) {
require_once 'CRM/Core/Payment/Form.php';
CRM_Core_Payment_Form::mapParams( $this->_bltID, $this->_params, $membershipParams, true );
require_once 'CRM/Member/BAO/Membership.php';
+ // added new parameter for cms user contact id, needed to distinguish behaviour for on behalf of sign-ups
+ if ( isset($this->_params['related_contact']) )
+ else
{ + $membershipParams['cms_contactID'] = $contactID; + }
CRM_Member_BAO_Membership::postProcessMembership( $membershipParams, $contactID,
$this, $premiumParams );
}
Line 780:
require_once "CRM/Contribute/BAO/Contribution/Utils.php";
+ // the parameter cms_contactID should always be set, but to be safe use original contactID as backup
+ if ( isset($params['cms_contactID']) )
+ else
{ + $cms_contactID = $contactID; + }
+ CRM_Contribute_BAO_Contribution_Utils::createCMSUser( $params,$cms_contactID, 'email-' . $form->_bltID );
- CRM_Contribute_BAO_Contribution_Utils::createCMSUser( $params,$contactID, 'email-' . $form->_bltID );
CMR/Member/BAO/Membership.php, near line 845
if ( $form->_amount > 0.0 )
{ $result = CRM_Contribute_BAO_Contribution_Utils::processConfirm( $form, $membershipParams, $premiumParams, $contactID, $contributionTypeId, 'membership' ); }else
{ // create the CMS contact here since we normally do this under processConfirm + CRM_Contribute_BAO_Contribution_Utils::createCMSUser( $membershipParams, $membershipParams['cms_contactID'], 'email-' . $form->_bltID ); - CRM_Contribute_BAO_Contribution_Utils::createCMSUser( $membershipParams, $contactID, 'email-' . $form->_bltID ); }