CI =& get_instance(); $this->CI->load->library('JournalService'); $this->CI->load->model('JournalModel', 'postingJournalModel'); } public function post(array $header, array $lines, $manageTransaction = true, $preventDuplicateSource = true) { if ($preventDuplicateSource && !empty($header['ref_type']) && isset($header['ref_id'])) { if ($this->CI->postingJournalModel->sourceExists($header['ref_type'], $header['ref_id'])) { throw new BusinessException('Transaksi sumber ini sudah pernah diposting ke jurnal.'); } } $header['status'] = 'posted'; $header['posted_at'] = isset($header['posted_at']) ? $header['posted_at'] : date('Y-m-d H:i:s'); $header['posted_by'] = isset($header['posted_by']) ? $header['posted_by'] : $header['created_by']; return $this->CI->journalservice->create($header, $lines, $manageTransaction); } }