mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix(server): wirte GL entries only when publish transaction
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
IBillCreatedPayload,
|
||||
IBillEditedPayload,
|
||||
IBIllEventDeletedPayload,
|
||||
IBillOpenedPayload,
|
||||
} from '@/interfaces';
|
||||
import { BillGLEntries } from './BillGLEntries';
|
||||
|
||||
@@ -37,13 +38,12 @@ export class BillGLEntriesSubscriber {
|
||||
*/
|
||||
private handlerWriteJournalEntriesOnCreate = async ({
|
||||
tenantId,
|
||||
billId,
|
||||
bill,
|
||||
trx,
|
||||
}: IBillCreatedPayload) => {
|
||||
}: IBillCreatedPayload | IBillOpenedPayload) => {
|
||||
if (!bill.openedAt) return null;
|
||||
|
||||
await this.billGLEntries.writeBillGLEntries(tenantId, billId, trx);
|
||||
await this.billGLEntries.writeBillGLEntries(tenantId, bill.id, trx);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user