diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index a6557ff89..3f4433fa1 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2736,7 +2736,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`) (1, 'print-email', 'notification fixture one'), (2, 'invoice-electronic', 'A electronic invoice has been generated'), (3, 'not-main-printer-configured', 'A printer distinct than main has been configured'), - (4, 'supplier-pay-method-update', 'A supplier pay method has been updated'); + (4, 'supplier-pay-method-update', 'A supplier pay method has been updated'), + (5, 'modified-entry', 'An entry has been modified'); INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) VALUES diff --git a/modules/entry/back/methods/entry/addFromBuy.js b/modules/entry/back/methods/entry/addFromBuy.js index f7e1b637e..bfbd1b416 100644 --- a/modules/entry/back/methods/entry/addFromBuy.js +++ b/modules/entry/back/methods/entry/addFromBuy.js @@ -46,7 +46,7 @@ module.exports = Self => { } try { - let buy = await models.Buy.findOne({where: {entryFk: args.id}}, myOptions); + let buy = await models.Buy.findOne({where: {entryFk: args.id, itemFk: args.item}}, myOptions); if (buy) await buy.updateAttribute('printedStickers', args.printedStickers, myOptions); else { diff --git a/modules/supplier/back/methods/supplier/getItemsPackaging.js b/modules/supplier/back/methods/supplier/getItemsPackaging.js index 8ef80529b..c06195a55 100644 --- a/modules/supplier/back/methods/supplier/getItemsPackaging.js +++ b/modules/supplier/back/methods/supplier/getItemsPackaging.js @@ -26,14 +26,14 @@ module.exports = Self => { Self.getItemsPackaging = async(id, entry) => { return Self.rawSql(` WITH entryTmp AS ( - SELECT i.id, SUM(b.quantity) quantity + SELECT i.id, SUM(b.quantity) quantity, SUM(b.printedStickers) printedStickers FROM vn.entry e JOIN vn.buy b ON b.entryFk = e.id JOIN vn.supplier s ON s.id = e.supplierFk JOIN vn.item i ON i.id = b.itemFk WHERE e.id = ? AND e.supplierFk = ? GROUP BY i.id - ) SELECT i.id, i.name, et.quantity, SUM(b.quantity) quantityTotal + ) SELECT i.id, i.name, et.quantity, SUM(b.quantity) quantityTotal, et.printedStickers FROM vn.buy b JOIN vn.item i ON i.id = b.itemFk JOIN vn.entry e ON e.id = b.entryFk diff --git a/print/templates/email/modified-entry/assets/css/import.js b/print/templates/email/modified-entry/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/modified-entry/assets/css/import.js @@ -0,0 +1,11 @@ +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(); diff --git a/print/templates/email/modified-entry/locale/en.yml b/print/templates/email/modified-entry/locale/en.yml new file mode 100644 index 000000000..7bdfa15ff --- /dev/null +++ b/print/templates/email/modified-entry/locale/en.yml @@ -0,0 +1,3 @@ +subject: Modified entry +title: Modified entry +description: From Warehouse the following packaging entry has been created/modified diff --git a/print/templates/email/modified-entry/locale/es.yml b/print/templates/email/modified-entry/locale/es.yml new file mode 100644 index 000000000..5a00307f9 --- /dev/null +++ b/print/templates/email/modified-entry/locale/es.yml @@ -0,0 +1,3 @@ +subject: Entrada modificada +title: Entrada modificada +description: Desde Almacén se ha creado/modificado la siguiente entrada de embalajes diff --git a/print/templates/email/modified-entry/modified-entry.html b/print/templates/email/modified-entry/modified-entry.html new file mode 100644 index 000000000..869d019a4 --- /dev/null +++ b/print/templates/email/modified-entry/modified-entry.html @@ -0,0 +1,11 @@ + +
+
+

{{ $t('title') }}

+

+ {{ $t('description') }}: + {{ url }} +

+
+
+
diff --git a/print/templates/email/modified-entry/modified-entry.js b/print/templates/email/modified-entry/modified-entry.js new file mode 100755 index 000000000..35474a12f --- /dev/null +++ b/print/templates/email/modified-entry/modified-entry.js @@ -0,0 +1,16 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'modified-entry', + components: { + 'email-body': emailBody.build(), + }, + props: { + url: { + type: String, + required: true + } + } +}; +