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