* Create a new batch.
*
* @param array $params
- * @param array $ids
- * Associated array of ids.
- * @param string $context
- * String.
*
* @return object
* $batch batch object
*/
- public static function create(&$params, $ids = NULL, $context = NULL) {
+ public static function create(&$params) {
if (empty($params['id'])) {
$params['name'] = CRM_Utils_String::titleToVar($params['title']);
}
-
$batch = new CRM_Batch_DAO_Batch();
$batch->copyValues($params);
- if ($context == 'financialBatch' && !empty($ids['batchID'])) {
- $batch->id = $ids['batchID'];
- }
$batch->save();
return $batch;
$batchParams['modified_id'] = $session->get('userID');
$batchParams['status_id'] = $this->_exportStatusId;
- $ids = array();
foreach ($batchIds as $batchId) {
- $batchParams['id'] = $ids['batchID'] = $batchId;
+ $batchParams['id'] = $batchId;
// Update totals
$batchParams = array_merge($batchParams, $totals[$batchId]);
- CRM_Batch_BAO_Batch::create($batchParams, $ids, 'financialBatch');
+ CRM_Batch_BAO_Batch::create($batchParams);
}
CRM_Batch_BAO_Batch::exportFinancialBatch($batchIds, $this->_exportFormat);
*/
public function postProcess() {
$session = CRM_Core_Session::singleton();
- $ids = array();
$params = $this->exportValues();
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
if ($this->_id) {
- $ids['batchID'] = $this->_id;
$params['id'] = $this->_id;
}
$activityTypeName = 'Edit Batch';
}
- $batch = CRM_Batch_BAO_Batch::create($params, $ids, 'financialBatch');
+ $batch = CRM_Batch_BAO_Batch::create($params);
$activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name');
if ($recordClass[0] == 'CRM' && count($recordClass) >= 3) {
foreach ($records as $recordID) {
$params = array();
- $ids = NULL;
switch ($op) {
case 'assign':
case 'remove':
$params = $totals[$recordID];
case 'reopen':
$status = $op == 'close' ? 'Closed' : 'Reopened';
- $ids['batchID'] = $recordID;
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id', array('labelColumn' => 'name'));
$params['status_id'] = CRM_Utils_Array::key($status, $batchStatus);
$session = CRM_Core_Session::singleton();
$params['modified_date'] = date('YmdHis');
$params['modified_id'] = $session->get('userID');
$params['id'] = $recordID;
- $context = "financialBatch";
break;
case 'export':
case 'delete':
$params = $recordID;
- $context = "financialBatch";
break;
}
if (method_exists($recordBAO, $methods[$op]) & !empty($params)) {
- if (isset($context)) {
- $updated = call_user_func_array(array($recordBAO, $methods[$op]), array(&$params, $ids, $context));
- }
- else {
- $updated = call_user_func_array(array($recordBAO, $methods[$op]), array(&$params, $ids));
- }
+ $updated = call_user_func_array(array($recordBAO, $methods[$op]), array(&$params));
if ($updated) {
$redirectStatus = $updated->status_id;
if ($batchStatus[$updated->status_id] == "Reopened") {