function batchSave() { // save in cache table $batchId = CRM_Utils_Type::escape($_POST['batch_id'], 'Positive'); $cacheKeyString = CRM_Core_BAO_Batch::getCacheKeyForBatch($batchId); // check if we can retrieve from database cache unset($_POST['qfKey']); CRM_Core_BAO_Cache::setItem($_POST, 'batch entry', $cacheKeyString); // return true if saved correctly CRM_Utils_System::civiExit(); }
/** * process the form after the input has been submitted and validated * * @access public * * @return None */ public function postProcess() { $params = $this->controller->exportValues($this->_name); $params['actualBatchTotal'] = 0; // get the profile information if ($this->_batchInfo['type_id'] == 1) { $this->processContribution($params); } else { $this->processMembership($params); } // update batch to close status $paramValues = array('id' => $this->_batchId, 'status_id' => 2, 'total' => $params['actualBatchTotal']); CRM_Core_BAO_Batch::create($paramValues); // delete from cache table $cacheKeyString = CRM_Core_BAO_Batch::getCacheKeyForBatch($this->_batchId); CRM_Core_BAO_Cache::deleteGroup('batch entry', $cacheKeyString, FALSE); // set success status CRM_Core_Session::setStatus("Your batch has been processed."); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/batch', 'reset=1&status=2')); }
/** * function to delete batch entry * * @param int $batchId batch id * * @return void * @access public */ static function deleteBatch($batchId) { //delete batch entries from cache $cacheKeyString = CRM_Core_BAO_Batch::getCacheKeyForBatch($batchId); CRM_Core_BAO_Cache::deleteGroup('batch entry', $cacheKeyString, FALSE); // delete entry from batch table $batch = new CRM_Core_DAO_Batch(); $batch->id = $batchId; $batch->delete(); }