diff --git a/db/changes/10470-family/00-sample.sql b/db/changes/10470-family/00-sample.sql new file mode 100644 index 000000000..e0fa7ceac --- /dev/null +++ b/db/changes/10470-family/00-sample.sql @@ -0,0 +1,7 @@ +INSERT INTO `vn`.`sample` (code, description, isVisible, hasCompany, hasPreview, datepickerEnabled) +VALUES ('incoterms-authorization', 'Autorización de incoterms', 1, 0, 1, 0); + + +INSERT INTO vn.expedition (agencyModeFk, ticketFk, isBox, created, isRefund, isPickUp, itemFk, counter, checked, + workerFk, externalId, packagingFk, itemPackingTypeFk, hostFk, stateTypeFk) +VALUES (7, 11, 71, '2022-05-18 11:40:56', false, false, null, 1, 1, 18, null, '94', null, '', 3); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a44ba2da8..9e2b8989b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -224,5 +224,7 @@ "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", "date in the future": "Fecha en el futuro", "reference duplicated": "Referencia duplicada", - "This ticket is already a refund": "Este ticket ya es un abono" + "This ticket is already a refund": "Este ticket ya es un abono", + "isWithoutNegatives": "isWithoutNegatives", + "routeFk": "routeFk" } \ No newline at end of file diff --git a/print/methods/closure/closure.js b/print/methods/closure/closure.js index 2b58205e3..925eb6f67 100644 --- a/print/methods/closure/closure.js +++ b/print/methods/closure/closure.js @@ -89,6 +89,26 @@ module.exports = { const email = new Email('delivery-note-link', args); await email.send(); } + + // Incoterms authorization + const {firstOrder} = await db.findOne(` + SELECT COUNT(*) as firstOrder + FROM ticket t + WHERE t.clientFk = ? + AND NOT t.isDeleted + `, [ticket.clientFk]); + + if (firstOrder == 1) { + const args = Object.assign({ + ticketId: ticket.id, + recipientId: ticket.clientFk, + recipient: ticket.recipient, + replyTo: ticket.salesPersonEmail + }, reqArgs); + + const email = new Email('incoterms-authorization', args); + await email.send(); + } } catch (error) { // Domain not found if (error.responseCode == 450) diff --git a/print/templates/email/incoterms-authorization/assets/css/import.js b/print/templates/email/incoterms-authorization/assets/css/import.js new file mode 100644 index 000000000..b44d6bd37 --- /dev/null +++ b/print/templates/email/incoterms-authorization/assets/css/import.js @@ -0,0 +1,8 @@ +const Stylesheet = require(`${appPath}/core/stylesheet`); + +module.exports = new Stylesheet([ + `${appPath}/common/css/spacing.css`, + `${appPath}/common/css/misc.css`, + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/incoterms-authorization/attachments.json b/print/templates/email/incoterms-authorization/attachments.json new file mode 100644 index 000000000..9dfd945db --- /dev/null +++ b/print/templates/email/incoterms-authorization/attachments.json @@ -0,0 +1,6 @@ +[ + { + "filename": "incoterms-authorization.pdf", + "component": "incoterms-authorization" + } +] \ No newline at end of file diff --git a/print/templates/email/incoterms-authorization/incoterms-authorization.html b/print/templates/email/incoterms-authorization/incoterms-authorization.html new file mode 100644 index 000000000..e50a40c6d --- /dev/null +++ b/print/templates/email/incoterms-authorization/incoterms-authorization.html @@ -0,0 +1,56 @@ + + +
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('title') }}+{{$t('description.dear')}}, +{{$t('description.instructions')}} +
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+