From d3d30c96c21b0678a0c7b2225f3dc3820e035038 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Mon, 15 May 2017 06:40:01 +0530 Subject: [PATCH] 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 --- CRM/Financial/Form/FinancialBatch.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. -- 2.25.1