From: deb.monish Date: Fri, 5 Aug 2016 12:09:55 +0000 (+0530) Subject: CRM-19172: on behalf form + user account creation attempts to create user for org X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0462a5b2c8da6975d4d9bb26987b76a589f31cff;hp=b9e0fe5404c28c564cd9c9325b94ec0bb452012c;p=civicrm-core.git CRM-19172: on behalf form + user account creation attempts to create user for org --- diff --git a/CRM/Contribute/BAO/Contribution/Utils.php b/CRM/Contribute/BAO/Contribution/Utils.php index 89fbfa3495..b4453256d8 100644 --- a/CRM/Contribute/BAO/Contribution/Utils.php +++ b/CRM/Contribute/BAO/Contribution/Utils.php @@ -327,7 +327,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = contrib.contact_id ) $created = TRUE; if (!empty($params['cms_create_account'])) { - $params['contactID'] = $contactID; + $params['contactID'] = !empty($params['onbehalf_contact_id']) ? $params['onbehalf_contact_id'] : $contactID; if (!CRM_Core_BAO_CMSUser::create($params, $mail)) { CRM_Core_Error::statusBounce(ts('Your profile is not saved and Account is not created.')); } diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 7b2f88e2da..a7beab3e01 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1211,6 +1211,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // required for mailing/template display ..etc $values['related_contact'] = $contactID; + //CRM-19172: Create CMS user for individual on whose behalf organization is doing contribution + $params['onbehalf_contact_id'] = $contactID; + //make this employee of relationship as current //employer / employee relationship, CRM-3532 if ($isNotCurrentEmployer &&