mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 14:20:31 +00:00
fix(server): shouldn't write GL entries when save transaction as draft.
This commit is contained in:
@@ -20,6 +20,10 @@ export class BillGLEntriesSubscriber {
|
||||
events.bill.onCreated,
|
||||
this.handlerWriteJournalEntriesOnCreate
|
||||
);
|
||||
bus.subscribe(
|
||||
events.bill.onOpened,
|
||||
this.handlerWriteJournalEntriesOnCreate
|
||||
);
|
||||
bus.subscribe(
|
||||
events.bill.onEdited,
|
||||
this.handleOverwriteJournalEntriesOnEdit
|
||||
@@ -34,8 +38,11 @@ export class BillGLEntriesSubscriber {
|
||||
private handlerWriteJournalEntriesOnCreate = async ({
|
||||
tenantId,
|
||||
billId,
|
||||
bill,
|
||||
trx,
|
||||
}: IBillCreatedPayload) => {
|
||||
if (!bill.openedAt) return null;
|
||||
|
||||
await this.billGLEntries.writeBillGLEntries(tenantId, billId, trx);
|
||||
};
|
||||
|
||||
@@ -46,8 +53,11 @@ export class BillGLEntriesSubscriber {
|
||||
private handleOverwriteJournalEntriesOnEdit = async ({
|
||||
tenantId,
|
||||
billId,
|
||||
bill,
|
||||
trx,
|
||||
}: IBillEditedPayload) => {
|
||||
if (!bill.openedAt) return null;
|
||||
|
||||
await this.billGLEntries.rewriteBillGLEntries(tenantId, billId, trx);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user