From ff459ea3be23e076474551f90d18a0fdaf158e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 13 Mar 2024 12:18:43 +0100 Subject: [PATCH 1/7] fix: closeTicket idem salix refs #6549 --- db/routines/vn/procedures/invoiceOut_new.sql | 9 ++- .../10949-limeLaurel/00-firstScript.sql | 5 ++ .../ticket/back/methods/ticket/closeAll.js | 67 +++++++++++++++++++ .../assets/css/import.js | 11 +++ .../invoice-ticket-closure.html | 13 ++++ .../invoice-ticket-closure.js | 19 ++++++ .../invoice-ticket-closure/locale/en.yml | 5 ++ .../invoice-ticket-closure/locale/es.yml | 4 ++ 8 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 db/versions/10949-limeLaurel/00-firstScript.sql create mode 100644 print/templates/email/invoice-ticket-closure/assets/css/import.js create mode 100644 print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html create mode 100644 print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js create mode 100644 print/templates/email/invoice-ticket-closure/locale/en.yml create mode 100644 print/templates/email/invoice-ticket-closure/locale/es.yml diff --git a/db/routines/vn/procedures/invoiceOut_new.sql b/db/routines/vn/procedures/invoiceOut_new.sql index 8c35ce75f..1b486df86 100644 --- a/db/routines/vn/procedures/invoiceOut_new.sql +++ b/db/routines/vn/procedures/invoiceOut_new.sql @@ -68,16 +68,21 @@ BEGIN DELETE ti.* FROM tmp.ticketToInvoice ti JOIN ticket t ON t.id = ti.id + LEFT JOIN address a ON a.id = t.addressFk JOIN sale s ON s.ticketFk = t.id JOIN item i ON i.id = s.itemFk JOIN supplier su ON su.id = t.companyFk JOIN client c ON c.id = t.clientFk - LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = su.countryFk WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted) OR c.isTaxDataChecked = FALSE OR t.isDeleted OR c.hasToInvoice = FALSE - OR itc.id IS NULL; + OR itc.id IS NULL + OR a.id IS NULL + OR (vTaxArea = 'WORLD' + AND (a.customsAgentFk IS NULL OR a.incotermsFk IS NULL)); SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 INTO vIsAnySaleToInvoice diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql new file mode 100644 index 000000000..0e2fdaf0c --- /dev/null +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -0,0 +1,5 @@ +INSERT INTO util.notification (id, name, description) + SELECT MAX(id) + 1, + 'invoice-ticket-closure', + 'Tickets not invoiced during the nightly closure ticket process' + FROM util.notification; diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 46c45aa92..829889e9c 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -58,6 +58,73 @@ module.exports = Self => { GROUP BY t.id `, [toDate, toDate]); + await Self.rawSql(` + WITH ticketNotInvoiceable AS( + SELECT JSON_OBJECT( + 'tickets', + JSON_ARRAYAGG( + JSON_OBJECT( + 'ticketId', ticketFk, + 'reason', + LEFT(reason,LENGTH(reason) - 2) + ) + ))errors + FROM ( + SELECT ticketFk, + CONCAT_WS('', + IF(hasErrorToInvoice, 'Facturar, ', ''), + IF(hasErrorTaxDataChecked, 'Datos comprobados, ', ''), + IF(hasErrorDeleted, 'Eliminado, ', ''), + IF(hasErrorItemTaxCountry, 'Impuesto no informado, ', ''), + IF(hasErrorAddress, 'Sin dirección, ', ''), + IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones, ', '')) reason + FROM ( + SELECT t.id ticketFk, + SUM(NOT c.hasToInvoice) hasErrorToInvoice, + SUM(NOT c.isTaxDataChecked) hasErrorTaxDataChecked, + SUM(t.isDeleted) hasErrorDeleted, + SUM(itc.id IS NULL) hasErrorItemTaxCountry, + SUM(a.id IS NULL) hasErrorAddress, + SUM(ios.code IS NOT NULL + AND(ad.customsAgentFk IS NULL + OR ad.incotermsFk IS NULL)) hasErrorInfoTaxAreaWorld + FROM ticket t + LEFT JOIN address ad ON ad.id = t.addressFk + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN warehouse wh ON wh.id = t.warehouseFk AND wh.hasComission + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN alertLevel al ON al.id = ts.alertLevel + JOIN client c ON c.id = t.clientFk + JOIN province p ON p.id = c.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + JOIN country co ON co.id = p.countryFk + LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = su.countryFk + LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD' + AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M') + WHERE (al.code = 'PACKED' + OR (am.code = 'refund' AND al.code != 'delivered')) + AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + AND t.refFk IS NULL + AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice) + GROUP BY ticketFk + HAVING hasErrorToInvoice + OR NOT hasErrorTaxDataChecked + OR hasErrorDeleted + OR hasErrorItemTaxCountry + OR hasErrorAddress + OR hasErrorInfoTaxAreaWorld + )sub + )sub2 + ) SELECT IF(errors = '{"tickets": null}', + 'No errors', + util.notification_send('invoice-ticket-closure', errors, NULL)) + FROM ticketNotInvoiceable`, [toDate, toDate]); + await closure(ctx, Self, tickets); await Self.rawSql(` diff --git a/print/templates/email/invoice-ticket-closure/assets/css/import.js b/print/templates/email/invoice-ticket-closure/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/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/invoice-ticket-closure/invoice-ticket-closure.html b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html new file mode 100644 index 000000000..051fa2cf8 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html @@ -0,0 +1,13 @@ + +
+
+

{{ $t('title') }} {{ $t('total') }}: {{tickets.length}}

+
+
+
+

{{ $t('ticketId') }}: {{ticket.ticketId}}

+

{{ $t('description') }}: {{ticket.description}}

+
+
+
+
\ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js new file mode 100644 index 000000000..6d12aa247 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js @@ -0,0 +1,19 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component(); + +module.exports = { + name: 'invoice-ticket-closure', + components: { + 'email-body': emailBody.build(), + }, + props: { + ticketId: { + type: Number, + required: true + }, + description: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/invoice-ticket-closure/locale/en.yml b/print/templates/email/invoice-ticket-closure/locale/en.yml new file mode 100644 index 000000000..70345dc81 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/locale/en.yml @@ -0,0 +1,5 @@ + +subject: Nightly ticket closing process report +title: Nightly ticket closing process report +description: Description +ticketId: Ticket No \ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/locale/es.yml b/print/templates/email/invoice-ticket-closure/locale/es.yml new file mode 100644 index 000000000..e21332f1b --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/locale/es.yml @@ -0,0 +1,4 @@ +subject: Informe proceso de cierre de tickets nocturno +title: Informe proceso de cierre de tickets nocturno +description: Descripción +ticketId: Ticket nº \ No newline at end of file -- 2.40.1 From 77d1a38a87eac61c3ce19fc217b3aaf2aaa29636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 13 Mar 2024 18:51:11 +0100 Subject: [PATCH 2/7] fix: closeTicket idem salix refs #6549 --- db/versions/10949-limeLaurel/00-firstScript.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index 0e2fdaf0c..7b1758285 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -3,3 +3,12 @@ INSERT INTO util.notification (id, name, description) 'invoice-ticket-closure', 'Tickets not invoiced during the nightly closure ticket process' FROM util.notification; + +INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) + SELECT MAX(id), 108 + FROM util.notification; + +INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) + SELECT MAX(id), 108 + FROM util.notification; + \ No newline at end of file -- 2.40.1 From 1315a854a93fc7be7c02c9eab7cf7cca503871d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 18 Mar 2024 18:15:05 +0100 Subject: [PATCH 3/7] fix: closeTicket idem salix Refs: #6549 --- db/versions/10949-limeLaurel/00-firstScript.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index 7b1758285..ca221501e 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -1,14 +1,14 @@ -INSERT INTO util.notification (id, name, description) - SELECT MAX(id) + 1, - 'invoice-ticket-closure', + INSERT INTO util.notification ( name, description) + SELECT 'invoice-ticket-closure', 'Tickets not invoiced during the nightly closure ticket process' FROM util.notification; + +SET @notificationFk =LAST_INSERT_ID(); INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) - SELECT MAX(id), 108 + SELECT @notificationFk, 108 FROM util.notification; INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) - SELECT MAX(id), 108 - FROM util.notification; - \ No newline at end of file + SELECT @notificationFk, 108 + FROM util.notification; \ No newline at end of file -- 2.40.1 From 75a4d6947fe07eb3a35da93086eb8ba2b1c66fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 14:20:55 +0200 Subject: [PATCH 4/7] fix: closeTicket idem salix Refs: #6549 --- .../invoice-ticket-closure/invoice-ticket-closure.html | 4 ++-- .../invoice-ticket-closure/invoice-ticket-closure.js | 10 +++------- .../email/invoice-ticket-closure/locale/en.yml | 3 +-- .../email/invoice-ticket-closure/locale/es.yml | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html index 051fa2cf8..2effa8917 100644 --- a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html @@ -1,12 +1,12 @@
-

{{ $t('title') }} {{ $t('total') }}: {{tickets.length}}

+

{{ $t('title') }}


{{ $t('ticketId') }}: {{ticket.ticketId}}

-

{{ $t('description') }}: {{ticket.description}}

+

{{ $t('reason') }}: {{ticket.reason}}


diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js index 6d12aa247..31690ecbd 100644 --- a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js @@ -1,5 +1,5 @@ const Component = require(`vn-print/core/component`); -const emailBody = new Component(); +const emailBody = new Component('email-body'); module.exports = { name: 'invoice-ticket-closure', @@ -7,13 +7,9 @@ module.exports = { 'email-body': emailBody.build(), }, props: { - ticketId: { - type: Number, + tickets: { + type: Array, required: true }, - description: { - type: String, - required: true - } } }; diff --git a/print/templates/email/invoice-ticket-closure/locale/en.yml b/print/templates/email/invoice-ticket-closure/locale/en.yml index 70345dc81..844dada7a 100644 --- a/print/templates/email/invoice-ticket-closure/locale/en.yml +++ b/print/templates/email/invoice-ticket-closure/locale/en.yml @@ -1,5 +1,4 @@ - subject: Nightly ticket closing process report title: Nightly ticket closing process report -description: Description +reason: Reason ticketId: Ticket No \ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/locale/es.yml b/print/templates/email/invoice-ticket-closure/locale/es.yml index e21332f1b..a8e67f18f 100644 --- a/print/templates/email/invoice-ticket-closure/locale/es.yml +++ b/print/templates/email/invoice-ticket-closure/locale/es.yml @@ -1,4 +1,4 @@ subject: Informe proceso de cierre de tickets nocturno title: Informe proceso de cierre de tickets nocturno -description: Descripción +reason: Motivo ticketId: Ticket nº \ No newline at end of file -- 2.40.1 From 9fcad457a70fb0d127669e49980350e0236395bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 14:46:51 +0200 Subject: [PATCH 5/7] fix: closeTicket idem salix Refs: #6549 --- .../ticket/back/methods/ticket/closeAll.js | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 61de1cd04..c14f33346 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -62,14 +62,15 @@ module.exports = Self => { await Self.rawSql(` WITH ticketNotInvoiceable AS( SELECT JSON_OBJECT( - 'tickets', - JSON_ARRAYAGG( - JSON_OBJECT( - 'ticketId', ticketFk, - 'reason', - LEFT(reason,LENGTH(reason) - 2) + 'tickets', + JSON_ARRAYAGG( + JSON_OBJECT( + 'ticketId', ticketFk, + 'reason', + LEFT(reason,LENGTH(reason) - 2) + ) ) - ))errors + )errors FROM ( SELECT ticketFk, CONCAT_WS('', @@ -87,8 +88,8 @@ module.exports = Self => { SUM(itc.id IS NULL) hasErrorItemTaxCountry, SUM(a.id IS NULL) hasErrorAddress, SUM(ios.code IS NOT NULL - AND(ad.customsAgentFk IS NULL - OR ad.incotermsFk IS NULL)) hasErrorInfoTaxAreaWorld + AND(ad.customsAgentFk IS NULL + OR ad.incotermsFk IS NULL)) hasErrorInfoTaxAreaWorld FROM ticket t LEFT JOIN address ad ON ad.id = t.addressFk JOIN sale s ON s.ticketFk = t.id @@ -107,14 +108,13 @@ module.exports = Self => { AND itc.countryFk = su.countryFk LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD' AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M') - WHERE (al.code = 'PACKED' - OR (am.code = 'refund' AND al.code != 'delivered')) - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) + AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND t.refFk IS NULL AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice) GROUP BY ticketFk HAVING hasErrorToInvoice - OR NOT hasErrorTaxDataChecked + OR hasErrorTaxDataChecked OR hasErrorDeleted OR hasErrorItemTaxCountry OR hasErrorAddress @@ -130,12 +130,12 @@ module.exports = Self => { await Self.rawSql(` UPDATE ticket t - JOIN ticketState ts ON t.id = ts.ticketFk - JOIN alertLevel al ON al.id = ts.alertLevel - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - JOIN zone z ON z.id = t.zoneFk - SET t.routeFk = NULL + JOIN ticketState ts ON t.id = ts.ticketFk + JOIN alertLevel al ON al.id = ts.alertLevel + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN zone z ON z.id = t.zoneFk + SET t.routeFk = NULL WHERE DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND al.code NOT IN('DELIVERED','PACKED') -- 2.40.1 From fe0afe30bf91c78a5629fcc071de3fd40c99f73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 17:50:39 +0200 Subject: [PATCH 6/7] fix: closeTicket idem salix Refs: #6549 --- .../10949-limeLaurel/00-firstScript.sql | 12 +++++---- .../ticket/back/methods/ticket/closeAll.js | 26 +++++++++---------- .../invoice-ticket-closure/locale/en.yml | 2 +- .../invoice-ticket-closure/locale/es.yml | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index ca221501e..58d50e125 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -6,9 +6,11 @@ SET @notificationFk =LAST_INSERT_ID(); INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) - SELECT @notificationFk, 108 - FROM util.notification; - + SELECT @notificationFk,id + FROM account.role + WHERE name ='administrative'; + INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) - SELECT @notificationFk, 108 - FROM util.notification; \ No newline at end of file + SELECT @notificationFk, id + FROM account.`user` + WHERE `name` = 'admon'; diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index c14f33346..3e35c5ebc 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -53,8 +53,8 @@ module.exports = Self => { JOIN province p ON p.id = c.provinceFk JOIN country co ON co.id = p.countryFk LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk - WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')) - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) + AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) AND t.refFk IS NULL GROUP BY t.id `, [toDate, toDate]); @@ -66,20 +66,19 @@ module.exports = Self => { JSON_ARRAYAGG( JSON_OBJECT( 'ticketId', ticketFk, - 'reason', - LEFT(reason,LENGTH(reason) - 2) + 'reason', reason ) ) )errors FROM ( SELECT ticketFk, - CONCAT_WS('', - IF(hasErrorToInvoice, 'Facturar, ', ''), - IF(hasErrorTaxDataChecked, 'Datos comprobados, ', ''), - IF(hasErrorDeleted, 'Eliminado, ', ''), - IF(hasErrorItemTaxCountry, 'Impuesto no informado, ', ''), - IF(hasErrorAddress, 'Sin dirección, ', ''), - IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones, ', '')) reason + CONCAT_WS(', ', + IF(hasErrorToInvoice, 'Facturar', NULL), + IF(hasErrorTaxDataChecked, 'Datos comprobados', NULL), + IF(hasErrorDeleted, 'Eliminado', NULL), + IF(hasErrorItemTaxCountry, 'Impuesto no informado', NULL), + IF(hasErrorAddress, 'Sin dirección', NULL), + IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones', NULL)) reason FROM ( SELECT t.id ticketFk, SUM(NOT c.hasToInvoice) hasErrorToInvoice, @@ -109,7 +108,7 @@ module.exports = Self => { LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD' AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M') WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) AND t.refFk IS NULL AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice) GROUP BY ticketFk @@ -136,8 +135,7 @@ module.exports = Self => { JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk JOIN zone z ON z.id = t.zoneFk SET t.routeFk = NULL - WHERE DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) - AND util.dayEnd(?) + WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) AND al.code NOT IN('DELIVERED','PACKED') AND t.routeFk AND z.name LIKE '%MADRID%'`, [toDate, toDate], {userId: ctx.req.accessToken.userId}); diff --git a/print/templates/email/invoice-ticket-closure/locale/en.yml b/print/templates/email/invoice-ticket-closure/locale/en.yml index 844dada7a..fef73d23f 100644 --- a/print/templates/email/invoice-ticket-closure/locale/en.yml +++ b/print/templates/email/invoice-ticket-closure/locale/en.yml @@ -1,4 +1,4 @@ subject: Nightly ticket closing process report title: Nightly ticket closing process report reason: Reason -ticketId: Ticket No \ No newline at end of file +ticketId: Ticket \ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/locale/es.yml b/print/templates/email/invoice-ticket-closure/locale/es.yml index a8e67f18f..7d146b83d 100644 --- a/print/templates/email/invoice-ticket-closure/locale/es.yml +++ b/print/templates/email/invoice-ticket-closure/locale/es.yml @@ -1,4 +1,4 @@ subject: Informe proceso de cierre de tickets nocturno title: Informe proceso de cierre de tickets nocturno reason: Motivo -ticketId: Ticket nº \ No newline at end of file +ticketId: Ticket \ No newline at end of file -- 2.40.1 From cedfdbb421f2dbfacc1855a5bf4d12092551d008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 5 Apr 2024 13:22:54 +0200 Subject: [PATCH 7/7] fix: closeTicket idem salix Refs: #6549 --- .../10949-limeLaurel/00-firstScript.sql | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index 58d50e125..cc0bcc96b 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -1,16 +1,15 @@ - INSERT INTO util.notification ( name, description) - SELECT 'invoice-ticket-closure', - 'Tickets not invoiced during the nightly closure ticket process' - FROM util.notification; - -SET @notificationFk =LAST_INSERT_ID(); + INSERT INTO util.notification ( name, description) + SELECT 'invoice-ticket-closure', + 'Tickets not invoiced during the nightly closure ticket process'; + + SET @notificationFk =LAST_INSERT_ID(); -INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) - SELECT @notificationFk,id - FROM account.role - WHERE name ='administrative'; + INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) + SELECT @notificationFk,id + FROM account.role + WHERE name ='administrative'; -INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) - SELECT @notificationFk, id - FROM account.`user` - WHERE `name` = 'admon'; + INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) + SELECT @notificationFk, id + FROM account.`user` + WHERE `name` = 'admon'; -- 2.40.1