refs #6176 book entry deleted
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
27a9881a6a
commit
40468b70e6
|
@ -0,0 +1,14 @@
|
|||
|
||||
INSERT IGNORE INTO util.`notification` (id, `name`, description)
|
||||
SELECT MAX(id) + 1, 'book-entry-deleted', 'accounting entries deleted'
|
||||
FROM util.`notification`;
|
||||
|
||||
INSERT IGNORE INTO util.`notificationAcl` (notificationFk, roleFk)
|
||||
VALUES(
|
||||
(SELECT id FROM util.`notification` WHERE `name` = 'book-entry-deleted'),
|
||||
(SELECT id FROM vn.`role` r WHERE `name` = 'administrative'));
|
||||
|
||||
INSERT IGNORE INTO util.`notificationSubscription` (notificationFk, userFk)
|
||||
VALUES(
|
||||
(SELECT id FROM util.`notification` WHERE `name` = 'book-entry-deleted'),
|
||||
(SELECT id FROM account.`user` WHERE `name` = 'admon'));
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
module.exports = Self => {
|
||||
export default Self => {
|
||||
Self.remoteMethod('delete', {
|
||||
description: 'Delete a invoiceOut',
|
||||
accessType: 'WRITE',
|
||||
|
@ -37,7 +36,12 @@ module.exports = Self => {
|
|||
const tickets = await Self.app.models.Ticket.find({
|
||||
where: {refFk: invoiceOut.ref}
|
||||
}, myOptions);
|
||||
|
||||
const bookEntry = await Self.app.models.XDiario.find({
|
||||
where: {
|
||||
SERIE: invoiceOut.ref[0],
|
||||
FACTURA: invoiceOut.miCadena.slice(1)
|
||||
}
|
||||
}, myOptions);
|
||||
const promises = [];
|
||||
|
||||
for (let ticket of tickets)
|
||||
|
@ -47,6 +51,20 @@ module.exports = Self => {
|
|||
|
||||
await invoiceOut.destroy(myOptions);
|
||||
|
||||
if (bookEntry) {
|
||||
const params = {
|
||||
bookEntries: bookEntry.ASIEN,
|
||||
invoiceOutRef: invoiceOut.ref
|
||||
};
|
||||
|
||||
await Self.rawSql('SELECT util.notification_send(?, ?, NULL)',
|
||||
'book-entry-deleted',
|
||||
params,
|
||||
myOptions);
|
||||
|
||||
await bookEntry.destroy(myOptions);
|
||||
}
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return tickets;
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||
|
||||
const path = require('path');
|
||||
const vnPrintPath = path.resolve('print');
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${vnPrintPath}/common/css/spacing.css`,
|
||||
`${vnPrintPath}/common/css/misc.css`,
|
||||
`${vnPrintPath}/common/css/layout.css`,
|
||||
`${vnPrintPath}/common/css/email.css`])
|
||||
.mergeStyles();
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<email-body v-bind="$props">
|
||||
<div class="grid-row">
|
||||
<div class="grid-block vn-pa-ml">
|
||||
<h1>{{ $t('title') }}</h1>
|
||||
<p v-html="$t('description', [bookEntry], [invoiceOutRef])"></p>
|
||||
</div>
|
||||
</div>
|
||||
</email-body>
|
|
@ -0,0 +1,19 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const emailBody = new Component();
|
||||
|
||||
module.exports = {
|
||||
name: 'book-entries-deleted',
|
||||
components: {
|
||||
'email-body': emailBody.build(),
|
||||
},
|
||||
props: {
|
||||
bookEntries: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
invoiceOutRef: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,5 @@
|
|||
Subject: Linked Accounting Entry Deleted
|
||||
Title: Linked Accounting Entry Deleted
|
||||
Description: The linked accounting entry that was associated with SAGE has been deleted. <br/><br/>
|
||||
Entry No. {0} <br/><br/>
|
||||
This entry has been deleted because the associated invoice {0} has been removed.
|
|
@ -0,0 +1,5 @@
|
|||
subject: Asiento contable enlazado eliminado
|
||||
title: Asiento contable enlazado eliminado
|
||||
description: Se ha borrado el asiento contable que se encuentraba enlazado a SAGE <br/><br/>
|
||||
Asientos nº {0} <br/><br/>
|
||||
Este asiento se ha borrado porque se ha eliminado la factura asociada {0}
|
Loading…
Reference in New Issue