CRM-20575, allow custom code to set created_id
authorPradeep Nayak <pradpnayak@gmail.com>
Mon, 15 May 2017 01:10:01 +0000 (06:40 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Mon, 15 May 2017 07:08:16 +0000 (12:38 +0530)
----------------------------------------
* 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

index c64287de4d137225bb48fbba62fc266568902780..b150d03f7a74cf39ce292ff12b75eacf057a0b12 100644 (file)
@@ -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.