$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.'));
}
// 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 &&