mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
Merge branch 'feature/manual-journals' of https://github.com/abouolia/Ratteb
This commit is contained in:
@@ -433,11 +433,15 @@ export default {
|
||||
errors: [{ type: 'MANUAL.JOURNAL.NOT.FOUND', code: 100 }],
|
||||
});
|
||||
}
|
||||
if (!manualJournal.status) {
|
||||
if (manualJournal.status) {
|
||||
return res.status(400).send({
|
||||
errors: [{ type: 'MANUAL.JOURNAL.PUBLISHED.ALREADY', code: 200 }],
|
||||
});
|
||||
}
|
||||
const updateJournalTransactionOper = ManualJournal.query()
|
||||
.where('id', manualJournal.id)
|
||||
.update({ status: 1 });
|
||||
|
||||
const transactions = await AccountTransaction.query()
|
||||
.whereIn('reference_type', ['Journal', 'ManualJournal'])
|
||||
.where('reference_id', manualJournal.id)
|
||||
@@ -452,6 +456,7 @@ export default {
|
||||
.update({ draft: 0 });
|
||||
|
||||
await Promise.all([
|
||||
updateJournalTransactionOper,
|
||||
updateAccountsTransactionsOper,
|
||||
journal.saveBalance(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user