refactor code
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
79e9edcee9
commit
574f2757f4
|
@ -63,6 +63,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
let invoiceId;
|
||||
let invoiceOut;
|
||||
try {
|
||||
const client = await models.Client.findById(args.clientId, {
|
||||
fields: ['id', 'hasToInvoiceByAddress']
|
||||
|
@ -119,25 +120,24 @@ module.exports = Self => {
|
|||
await notifyFailures(ctx, failedClient, myOptions);
|
||||
}
|
||||
|
||||
invoiceOut = await models.InvoiceOut.findById(invoiceId, {
|
||||
include: {
|
||||
relation: 'client'
|
||||
}
|
||||
}, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
|
||||
const invoiceOut = await models.InvoiceOut.findById(invoiceId, {
|
||||
include: {
|
||||
relation: 'client'
|
||||
}
|
||||
});
|
||||
ctx.args = {
|
||||
reference: invoiceOut.ref,
|
||||
recipientId: invoiceOut.clientFk,
|
||||
recipient: invoiceOut.client().email
|
||||
};
|
||||
try {
|
||||
await models.InvoiceOut.invoiceEmail(ctx);
|
||||
} catch (err) {}
|
||||
await models.InvoiceOut.invoiceEmail(ctx);
|
||||
|
||||
return invoiceId;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue