CRM-19172: on behalf form + user account creation attempts to create user for org
authordeb.monish <monish.deb@webaccessglobal.com>
Fri, 5 Aug 2016 12:09:55 +0000 (17:39 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Fri, 5 Aug 2016 12:15:05 +0000 (17:45 +0530)
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/Form/Contribution/Confirm.php

index 89fbfa3495f07ba92df6acc668b3360de0a85fe0..b4453256d856ed81241b1135b53a7326654ac583 100644 (file)
@@ -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.'));
       }
index 7b2f88e2da3e1f02e159b4648e5620de9e43d64d..a7beab3e013a2a30b57fb5edb8a30eedf3c126f3 100644 (file)
@@ -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 &&