本文整理汇总了PHP中CRM_Batch_BAO_Batch::getBatchStatuses方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Batch_BAO_Batch::getBatchStatuses方法的具体用法?PHP CRM_Batch_BAO_Batch::getBatchStatuses怎么用?PHP CRM_Batch_BAO_Batch::getBatchStatuses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Batch_BAO_Batch
的用法示例。
在下文中一共展示了CRM_Batch_BAO_Batch::getBatchStatuses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
// this mean it's a batch action
if (!$this->_id) {
if (!empty($_GET['batch_id'])) {
// validate batch ids
$batchIds = explode(',', $_GET['batch_id']);
foreach ($batchIds as $batchId) {
CRM_Utils_Type::validate($batchId, 'Positive');
}
$this->_batchIds = $_GET['batch_id'];
$this->set('batchIds', $this->_batchIds);
} else {
$this->_batchIds = $this->get('batchIds');
}
if (!empty($_GET['export_format']) && in_array($_GET['export_format'], array('IIF', 'CSV'))) {
$this->_exportFormat = $_GET['export_format'];
}
} else {
$this->_batchIds = $this->_id;
}
$allBatchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
$this->_exportStatusId = CRM_Utils_Array::key('Exported', $allBatchStatus);
// check if batch status is valid, do not allow exported batches to export again
$batchStatus = CRM_Batch_BAO_Batch::getBatchStatuses($this->_batchIds);
foreach ($batchStatus as $batchStatusId) {
if ($batchStatusId == $this->_exportStatusId) {
CRM_Core_Error::fatal(ts('You cannot exported the batches which were exported earlier.'));
}
}
$session = CRM_Core_Session::singleton();
$session->replaceUserContext(CRM_Utils_System::url('civicrm/financial/financialbatches', "reset=1&batchStatus={$this->_exportStatusId}"));
}