Update besar apk finance
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . 'exceptions/BusinessException.php';
|
||||
|
||||
class PostingService
|
||||
{
|
||||
private $CI;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user