From 0462a5b2c8da6975d4d9bb26987b76a589f31cff Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Fri, 5 Aug 2016 17:39:55 +0530 Subject: [PATCH] CRM-19172: on behalf form + user account creation attempts to create user for org --- CRM/Contribute/BAO/Contribution/Utils.php | 2 +- CRM/Contribute/Form/Contribution/Confirm.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 && -- 2.25.1