diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js index 121e96778..3dae2d47d 100644 --- a/back/methods/edi/updateData.js +++ b/back/methods/edi/updateData.js @@ -200,6 +200,31 @@ module.exports = Self => { const toTable = table.toTable; const baseName = table.fileName; + const firstEntry = entries[0]; + const entryName = firstEntry.entryName; + const startIndex = (entryName.length - 10); + const endIndex = (entryName.length - 4); + const dateString = entryName.substring(startIndex, endIndex); + + const lastUpdated = new Date(); + + let updated = null; + if (file.updated) { + updated = new Date(file.updated); + updated.setHours(0, 0, 0, 0); + } + + // Format string date to a date object + lastUpdated.setFullYear(`20${dateString.substring(4, 6)}`); + lastUpdated.setMonth(parseInt(dateString.substring(2, 4)) - 1); + lastUpdated.setDate(dateString.substring(0, 2)); + lastUpdated.setHours(0, 0, 0, 0); + + if (updated && lastUpdated <= updated) { + console.debug(`Table ${toTable} already updated, skipping...`); + return; + } + const tx = await Self.beginTransaction({}); try { diff --git a/db/changes/10470-family/00-aclMdb.sql b/db/changes/10470-family/00-aclMdb.sql index c57f60eb3..b02ddc451 100644 --- a/db/changes/10470-family/00-aclMdb.sql +++ b/db/changes/10470-family/00-aclMdb.sql @@ -1,14 +1,14 @@ -CREATE TABLE `vn`.`mdbBranch` ( +CREATE TABLE IF NOT EXISTS `vn`.`mdbBranch` ( `name` VARCHAR(255), PRIMARY KEY(`name`) ); -CREATE TABLE `vn`.`mdbVersion` ( +CREATE TABLE IF NOT EXISTS `vn`.`mdbVersion` ( `app` VARCHAR(255) NOT NULL, `branchFk` VARCHAR(255) NOT NULL, `version` INT, CONSTRAINT `mdbVersion_branchFk` FOREIGN KEY (`branchFk`) REFERENCES `vn`.`mdbBranch` (`name`) ON DELETE CASCADE ON UPDATE CASCADE ); -INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES('MdbVersion', '*', '*', 'ALLOW', 'ROLE', 'developer'); +INSERT IGNORE INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES(318, 'MdbVersion', '*', '*', 'ALLOW', 'ROLE', 'developer'); diff --git a/modules/invoiceOut/front/main/index.html b/modules/invoiceOut/front/main/index.html index 7f3e67f35..ab3fce9ea 100644 --- a/modules/invoiceOut/front/main/index.html +++ b/modules/invoiceOut/front/main/index.html @@ -2,7 +2,7 @@ vn-id="model" url="InvoiceOuts/filter" limit="20" - order="issued DESC"> + order="issued DESC, id DESC"> { salesIds.push(null); const servicesIds = []; - if (services) { + if (services && services.length) { for (let service of services) servicesIds.push(service.id); } else diff --git a/modules/ticket/front/weekly/index.html b/modules/ticket/front/weekly/index.html index 9ea35d92e..3c739d5f9 100644 --- a/modules/ticket/front/weekly/index.html +++ b/modules/ticket/front/weekly/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" limit="20" data="weeklies" - order="ticketFk" + order="weekDay, ticketFk" primary-key="ticketFk" auto-load="true"> diff --git a/print/methods/closure/closure.js b/print/methods/closure/closure.js index 2b58205e3..10d707b10 100644 --- a/print/methods/closure/closure.js +++ b/print/methods/closure/closure.js @@ -136,7 +136,8 @@ module.exports = { const body = `No se ha podido enviar el albarán ${ticket.id} al cliente ${ticket.clientFk} - ${ticket.clientName} - porque la dirección de email "${ticket.recipient}" no es correcta o no está disponible.

+ porque la dirección de email "${ticket.recipient}" no es correcta + o no está disponible.

Para evitar que se repita este error, se ha eliminado la dirección de email de la ficha del cliente. Actualiza la dirección de email con una correcta.`;