mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
fix(server): shouldn't write GL entries when save transaction as draft.
This commit is contained in:
@@ -63,14 +63,17 @@ export class DeliverSaleInvoice {
|
||||
|
||||
// Record the delivered at on the storage.
|
||||
const saleInvoice = await SaleInvoice.query(trx)
|
||||
.where({ id: saleInvoiceId })
|
||||
.update({ deliveredAt: moment().toMySqlDateTime() });
|
||||
.patchAndFetchById(saleInvoiceId, {
|
||||
deliveredAt: moment().toMySqlDateTime(),
|
||||
})
|
||||
.withGraphFetched('entries');
|
||||
|
||||
// Triggers `onSaleInvoiceDelivered` event.
|
||||
await this.eventPublisher.emitAsync(events.saleInvoice.onDelivered, {
|
||||
tenantId,
|
||||
saleInvoiceId,
|
||||
saleInvoice,
|
||||
trx,
|
||||
} as ISaleInvoiceEventDeliveredPayload);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ export class CloseSaleReceipt {
|
||||
} as ISaleReceiptEventClosingPayload);
|
||||
|
||||
// Mark the sale receipt as closed on the storage.
|
||||
const saleReceipt = await SaleReceipt.query(trx)
|
||||
.findById(saleReceiptId)
|
||||
.patch({
|
||||
const saleReceipt = await SaleReceipt.query(trx).patchAndFetchById(
|
||||
saleReceiptId,
|
||||
{
|
||||
closedAt: moment().toMySqlDateTime(),
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
// Triggers `onSaleReceiptClosed` event.
|
||||
await this.eventPublisher.emitAsync(events.saleReceipt.onClosed, {
|
||||
saleReceiptId,
|
||||
|
||||
Reference in New Issue
Block a user