From: Pradeep Nayak Date: Mon, 15 May 2017 01:10:01 +0000 (+0530) Subject: CRM-20575, allow custom code to set created_id X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d3d30c96c21b0678a0c7b2225f3dc3820e035038;p=civicrm-core.git CRM-20575, allow custom code to set created_id ---------------------------------------- * CRM-20575: Allow user to set created_id field for batch https://issues.civicrm.org/jira/browse/CRM-20575 CRM-20575, removed white space ---------------------------------------- * CRM-20575: Allow user to set created_id field for batch https://issues.civicrm.org/jira/browse/CRM-20575 --- diff --git a/CRM/Financial/Form/FinancialBatch.php b/CRM/Financial/Form/FinancialBatch.php index c64287de4d..b150d03f7a 100644 --- a/CRM/Financial/Form/FinancialBatch.php +++ b/CRM/Financial/Form/FinancialBatch.php @@ -216,7 +216,9 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { $params['mode_id'] = CRM_Utils_Array::key('Manual Batch', $batchMode); $params['status_id'] = CRM_Utils_Array::key('Open', $batchStatus); $params['created_date'] = date('YmdHis'); - $params['created_id'] = $session->get('userID'); + if (empty($params['created_id'])) { + $params['created_id'] = $session->get('userID'); + } $details = "{$params['title']} batch has been created by this contact."; $activityTypeName = 'Create Batch'; } @@ -230,6 +232,9 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form { $batch = CRM_Batch_BAO_Batch::create($params, $ids, 'financialBatch'); + //set batch id + $this->_id = $batch->id; + $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'); // create activity.