CRM-13074 - Failure on CMS user deletes contribution
authoreileen <eileen@fuzion.co.nz>
Thu, 18 Jul 2013 05:34:33 +0000 (17:34 +1200)
committereileen <eileen@fuzion.co.nz>
Thu, 18 Jul 2013 05:35:30 +0000 (17:35 +1200)
CRM/Contribute/Form/Contribution/Confirm.php

index 997ad8ac2328852f2b47b0f3a5508e1e34f49170..1b821460911edaaa5102327a25415d238fd8b6b6 100644 (file)
@@ -1453,10 +1453,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     elseif (isset($params['cms_contactID'])) {
       $contactID = $params['cms_contactID'];
     }
-    CRM_Contribute_BAO_Contribution_Utils::createCMSUser($params,
-      $contactID,
-      'email-' . $form->_bltID
-    );
 
     //create contribution activity w/ individual and target
     //activity w/ organisation contact id when onbelf, CRM-4027
@@ -1472,6 +1468,12 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
 
     $transaction->commit();
+    // CRM-13074 - create the CMSUser after the transaction is completed as it
+    // is not appropriate to delete a valid contribution if a user create problem occurs
+    CRM_Contribute_BAO_Contribution_Utils::createCMSUser($params,
+    $contactID,
+    'email-' . $form->_bltID
+    );
     return $contribution;
   }