Skip to content

Commit

Permalink
invoices.ts:
Browse files Browse the repository at this point in the history
recreated peppol xml on invoice update
  • Loading branch information
JochemVH1 committed Jul 3, 2024
1 parent aa049fc commit e238fee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/src/controllers/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ export const updateInvoiceController = async (req: ConfacRequest, res: Response)
.findOneAndUpdate({_id: new ObjectID(_id)}, {$set: {pdf: updatedPdfBuffer}});
}

if (!invoice.isQuotation) {
const updateXmlBuffer = Buffer.from(createXml({_id, ...invoice}));
await req.db.collection<IAttachment>(CollectionNames.ATTACHMENTS)
.findOneAndUpdate({_id: new ObjectID(_id)}, {$set: {xml: updateXmlBuffer}});
}

if (!invoice.projectMonth) {
// Makes sure projectMonth is overwritten in the db if already present there
invoice.projectMonth = undefined;
Expand Down

0 comments on commit e238fee

Please sign in to comment.