From 517aeebe8bc4783df346c35851f5ba106d4c0439 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 18 Mar 2024 14:20:05 +0100 Subject: [PATCH 01/42] refs #7019 fix(createManualInvoice): add throw error --- loopback/locale/es.json | 3 +- .../methods/invoiceOut/createManualInvoice.js | 55 +++++++++---------- 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 7730d4a8c..a390707ad 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -348,5 +348,6 @@ "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", "The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas", "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", - "They're not your subordinate": "No es tu subordinado/a." + "They're not your subordinate": "No es tu subordinado/a.", + "Select ticket or client": "Elija un ticket o un client" } diff --git a/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js index 043dfbead..9803f20f7 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js +++ b/modules/invoiceOut/back/methods/invoiceOut/createManualInvoice.js @@ -46,12 +46,11 @@ module.exports = Self => { } }); - Self.createManualInvoice = async(ctx, options) => { + Self.createManualInvoice = async(ctx, clientFk, ticketFk, maxShipped, serial, taxArea, reference, options) => { + if (!clientFk && !ticketFk) throw new UserError(`Select ticket or client`); const models = Self.app.models; - const args = ctx.args; - - let tx; const myOptions = {userId: ctx.req.accessToken.userId}; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); @@ -61,18 +60,15 @@ module.exports = Self => { myOptions.transaction = tx; } - const ticketId = args.ticketFk; - let clientId = args.clientFk; - let maxShipped = args.maxShipped; let companyId; let newInvoice; let query; try { - if (ticketId) { - const ticket = await models.Ticket.findById(ticketId, null, myOptions); + if (ticketFk) { + const ticket = await models.Ticket.findById(ticketFk, null, myOptions); const company = await models.Company.findById(ticket.companyFk, null, myOptions); - clientId = ticket.clientFk; + clientFk = ticket.clientFk; maxShipped = ticket.shipped; companyId = ticket.companyFk; @@ -85,7 +81,7 @@ module.exports = Self => { throw new UserError(`A ticket with an amount of zero can't be invoiced`); // Validates ticket nagative base - const hasNegativeBase = await getNegativeBase(maxShipped, clientId, companyId, myOptions); + const hasNegativeBase = await getNegativeBase(maxShipped, clientFk, companyId, myOptions); if (hasNegativeBase && company.code == 'VNL') throw new UserError(`A ticket with a negative base can't be invoiced`); } else { @@ -95,7 +91,7 @@ module.exports = Self => { const company = await models.Ticket.findOne({ fields: ['companyFk'], where: { - clientFk: clientId, + clientFk: clientFk, shipped: {lte: maxShipped} } }, myOptions); @@ -103,7 +99,7 @@ module.exports = Self => { } // Validate invoiceable client - const isClientInvoiceable = await isInvoiceable(clientId, myOptions); + const isClientInvoiceable = await isInvoiceable(clientFk, myOptions); if (!isClientInvoiceable) throw new UserError(`This client is not invoiceable`); @@ -114,27 +110,27 @@ module.exports = Self => { if (maxShipped >= tomorrow) throw new UserError(`Can't invoice to future`); - const maxInvoiceDate = await getMaxIssued(args.serial, companyId, myOptions); + const maxInvoiceDate = await getMaxIssued(serial, companyId, myOptions); if (Date.vnNew() < maxInvoiceDate) throw new UserError(`Can't invoice to past`); - if (ticketId) { + if (ticketFk) { query = `CALL invoiceOut_newFromTicket(?, ?, ?, ?, @newInvoiceId)`; await Self.rawSql(query, [ - ticketId, - args.serial, - args.taxArea, - args.reference + ticketFk, + serial, + taxArea, + reference ], myOptions); } else { query = `CALL invoiceOut_newFromClient(?, ?, ?, ?, ?, ?, @newInvoiceId)`; await Self.rawSql(query, [ - clientId, - args.serial, + clientFk, + serial, maxShipped, companyId, - args.taxArea, - args.reference + taxArea, + reference ], myOptions); } @@ -146,26 +142,27 @@ module.exports = Self => { throw e; } - if (newInvoice.id) - await Self.createPdf(ctx, newInvoice.id); + if (!newInvoice.id) throw new UserError(`...`); + + await Self.createPdf(ctx, newInvoice.id); return newInvoice; }; - async function isInvoiceable(clientId, options) { + async function isInvoiceable(clientFk, options) { const models = Self.app.models; const query = `SELECT (hasToInvoice AND isTaxDataChecked) AS invoiceable FROM client WHERE id = ?`; - const [result] = await models.InvoiceOut.rawSql(query, [clientId], options); + const [result] = await models.InvoiceOut.rawSql(query, [clientFk], options); return result.invoiceable; } - async function getNegativeBase(maxShipped, clientId, companyId, options) { + async function getNegativeBase(maxShipped, clientFk, companyId, options) { const models = Self.app.models; await models.InvoiceOut.rawSql('CALL invoiceOut_exportationFromClient(?,?,?)', - [maxShipped, clientId, companyId], options + [maxShipped, clientFk, companyId], options ); const query = 'SELECT vn.hasAnyNegativeBase() AS base'; const [result] = await models.InvoiceOut.rawSql(query, [], options); From 2efd1945f882bd21cc509beb4d4f74a212e05f94 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 4 Apr 2024 07:27:27 +0200 Subject: [PATCH 02/42] feat: refs #4988 add agency --- modules/zone/back/models/agency.json | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/zone/back/models/agency.json b/modules/zone/back/models/agency.json index be262b670..18b315d9a 100644 --- a/modules/zone/back/models/agency.json +++ b/modules/zone/back/models/agency.json @@ -15,6 +15,22 @@ "name": { "type": "string", "required": false + }, + "warehouseFk": { + "type": "number", + "required": false + }, + "isOwn": { + "type": "boolean", + "required": false + }, + "workCenterFk": { + "type": "number", + "required": false + }, + "isAnyVolumeAllowed": { + "type": "boolean", + "required": false } }, "relations": { @@ -22,6 +38,16 @@ "type": "hasOne", "model": "SupplierAgencyTerm", "foreignKey": "agencyFk" - } + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "workCenter": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "workCenterFk" + } } } From 84997eacd5b42f923a4395dcc5bba9bce47c16ab Mon Sep 17 00:00:00 2001 From: jcasado Date: Mon, 8 Apr 2024 14:38:54 +0200 Subject: [PATCH 03/42] refs: 6697 remove claim quantity --- modules/claim/back/methods/claim/createFromSales.js | 2 +- modules/claim/back/models/claim-beginning.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/claim/back/methods/claim/createFromSales.js b/modules/claim/back/methods/claim/createFromSales.js index 30093e43d..e5022d57e 100644 --- a/modules/claim/back/methods/claim/createFromSales.js +++ b/modules/claim/back/methods/claim/createFromSales.js @@ -83,7 +83,7 @@ module.exports = Self => { const newClaimBeginning = models.ClaimBeginning.create({ saleFk: sale.id, claimFk: newClaim.id, - quantity: sale.quantity + }, myOptions); promises.push(newClaimBeginning); diff --git a/modules/claim/back/models/claim-beginning.json b/modules/claim/back/models/claim-beginning.json index d224586da..ba6e83808 100644 --- a/modules/claim/back/models/claim-beginning.json +++ b/modules/claim/back/models/claim-beginning.json @@ -16,8 +16,7 @@ "description": "Identifier" }, "quantity": { - "type": "number", - "required": true + "type": "number" } }, "relations": { From db8d48cceedcfcefcfe16d99c928b240b847951c Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 11 Apr 2024 14:13:25 +0200 Subject: [PATCH 04/42] refs #6976 changes sql --- .../templates/reports/supplier-campaign-metrics/sql/entries.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/print/templates/reports/supplier-campaign-metrics/sql/entries.sql b/print/templates/reports/supplier-campaign-metrics/sql/entries.sql index b48e99c23..8a3ebb915 100644 --- a/print/templates/reports/supplier-campaign-metrics/sql/entries.sql +++ b/print/templates/reports/supplier-campaign-metrics/sql/entries.sql @@ -6,3 +6,5 @@ SELECT FROM vn.entry e JOIN vn.travel t ON t.id = e.travelFk WHERE e.supplierFk = ? AND DATE(t.shipped) BETWEEN ? AND ? + ORDER BY + t.shipped DESC; From bc9149ec37981ca69fd0b0706d8f6faf502af445 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 11 Apr 2024 14:32:26 +0200 Subject: [PATCH 05/42] feat: tipo de cambio php to js --- back/methods/collection/exchangeRateUpdate.js | 66 +++++++++++++++++++ back/model-config.json | 5 +- back/models/collection.js | 1 + back/models/reference-rate.json | 40 +++++++++++ db/dump/fixtures.before.sql | 3 +- loopback/locale/es.json | 11 +++- 6 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 back/methods/collection/exchangeRateUpdate.js create mode 100644 back/models/reference-rate.json diff --git a/back/methods/collection/exchangeRateUpdate.js b/back/methods/collection/exchangeRateUpdate.js new file mode 100644 index 000000000..8525fa980 --- /dev/null +++ b/back/methods/collection/exchangeRateUpdate.js @@ -0,0 +1,66 @@ +const axios = require('axios'); +const {DOMParser} = require('xmldom'); +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethod('exchangeRateUpdate', { + description: 'Updates the exchange rates from an XML feed', + accessType: 'WRITE', + accepts: [], + http: { + path: '/exchangeRateUpdate', + verb: 'post' + }, + returns: { + arg: 'result', + type: 'object', + root: true + } + }); + + Self.exchangeRateUpdate = async() => { + const response = await axios.get('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml'); + const xmlData = response.data; + + const doc = new DOMParser().parseFromString(xmlData, 'text/xml'); + const cubes = doc.getElementsByTagName('Cube'); + + const models = Self.app.models; + + const maxDateRecord = await models.ReferenceRate.findOne({order: 'dated DESC'}); + let maxDate = maxDateRecord ? new Date(maxDateRecord.dated) : null; + + for (const cube of cubes) { + if (cube.attributes.getNamedItem('time')) { + const xmlDate = new Date(cube.getAttribute('time')); + if (!maxDate || maxDate < xmlDate) { + for (const rateCube of cube.childNodes) { + if (rateCube.nodeType === Node.ELEMENT_NODE) { + const currencyCode = rateCube.getAttribute('currency'); + const rate = rateCube.getAttribute('rate'); + if (['USD', 'CNY', 'GBP'].includes(currencyCode)) { + const currency = await models.Currency.findOne({where: {code: currencyCode}}); + if (!currency) throw new UserError(`Currency not found for code: ${currencyCode}`); + + try { + await models.ReferenceRate.upsertWithWhere( + {currencyFk: currency.id, dated: xmlDate}, + { + currencyFk: currency.id, + dated: xmlDate, + value: rate + } + ); + } catch (error) { + console.error(`Failed to upsert rate for ${currencyCode} on ${xmlDate}: ${error}`); + // Handle or throw the error accordingly + throw error; + } + } + } + } + } + } + } + }; +}; diff --git a/back/model-config.json b/back/model-config.json index f48ec11e6..10e606f3c 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -124,6 +124,9 @@ "Postcode": { "dataSource": "vn" }, + "ReferenceRate": { + "dataSource": "vn" + }, "SageWithholding": { "dataSource": "vn" }, @@ -175,4 +178,4 @@ "WorkerActivityType": { "dataSource": "vn" } -} \ No newline at end of file +} diff --git a/back/models/collection.js b/back/models/collection.js index f2c2f1566..68c0bd13e 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -5,4 +5,5 @@ module.exports = Self => { require('../methods/collection/getTickets')(Self); require('../methods/collection/assign')(Self); require('../methods/collection/getSales')(Self); + require('../methods/collection/exchangeRateUpdate')(Self); }; diff --git a/back/models/reference-rate.json b/back/models/reference-rate.json new file mode 100644 index 000000000..3553df5c5 --- /dev/null +++ b/back/models/reference-rate.json @@ -0,0 +1,40 @@ +{ + "name": "ReferenceRate", + "base": "PersistedModel", + "idInjection": false, + "options": { + "mysql": { + "table": "referenceRate" + } + }, + "properties": { + "currencyFk": { + "type": "number", + "required": true, + "id": 1, + "mysql": { + "dataType": "tinyint", + "dataLength": 3, + "unsigned": true, + "primaryKey": true + } + }, + "dated": { + "type": "date", + "required": true, + "id": 2 + }, + "value": { + "type": "number", + "required": true + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 6fb70cb58..c84a08f87 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -160,7 +160,8 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) (1, 'EUR', 'Euro', 1), (2, 'USD', 'Dollar USA', 1.4), (3, 'GBP', 'Libra', 1), - (4, 'JPY', 'Yen Japones', 1); + (4, 'JPY', 'Yen Japones', 1), + (5, 'CNY', 'Yuan Chino', 1.2); INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`) VALUES diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 8b02f3048..50cd305fa 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -352,5 +352,14 @@ "The line could not be marked": "La linea no puede ser marcada", "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "They're not your subordinate": "No es tu subordinado/a.", - "No results found": "No se han encontrado resultados" + "No results found": "No se han encontrado resultados", + "ReferenceError: app is not defined": "ReferenceError: app is not defined", + "TypeError: Cannot read properties of undefined (reading 'ReferenceRate')": "TypeError: Cannot read properties of undefined (reading 'ReferenceRate')", + "Error: ER_BAD_FIELD_ERROR: Unknown column 'date' in 'order clause'": "Error: ER_BAD_FIELD_ERROR: Unknown column 'date' in 'order clause'", + "ReferenceError: ReferenceRate is not defined": "ReferenceError: ReferenceRate is not defined", + "ValidationError: The `ReferenceRate` instance is not valid. Details: `currencyFk` can't be blank (value: NaN).": "ValidationError: The `ReferenceRate` instance is not valid. Details: `currencyFk` can't be blank (value: NaN).", + "ReferenceError: Currency is not defined": "ReferenceError: Currency is not defined", + "UserError: Currency not found for code: CNY": "UserError: Currency not found for code: CNY", + "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-03' for key 'PRIMARY'": "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-03' for key 'PRIMARY'", + "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-08' for key 'PRIMARY'": "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-08' for key 'PRIMARY'" } \ No newline at end of file From bb6ea31bf715e59f49a656fa505a722f50761010 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 12 Apr 2024 10:26:32 +0200 Subject: [PATCH 06/42] feat: funcional a falta de test --- back/methods/collection/exchangeRateUpdate.js | 41 ++++++++++--------- back/models/collection.json | 6 ++- back/models/reference-rate.json | 17 ++++---- db/versions/10992-goldenIvy/00-acl.sql | 2 + .../10992-goldenIvy/00-referenceRate.sql | 4 ++ 5 files changed, 40 insertions(+), 30 deletions(-) create mode 100644 db/versions/10992-goldenIvy/00-acl.sql create mode 100644 db/versions/10992-goldenIvy/00-referenceRate.sql diff --git a/back/methods/collection/exchangeRateUpdate.js b/back/methods/collection/exchangeRateUpdate.js index 8525fa980..093ee6e48 100644 --- a/back/methods/collection/exchangeRateUpdate.js +++ b/back/methods/collection/exchangeRateUpdate.js @@ -28,33 +28,36 @@ module.exports = Self => { const models = Self.app.models; const maxDateRecord = await models.ReferenceRate.findOne({order: 'dated DESC'}); - let maxDate = maxDateRecord ? new Date(maxDateRecord.dated) : null; - for (const cube of cubes) { - if (cube.attributes.getNamedItem('time')) { + const maxDate = maxDateRecord && maxDateRecord.dated ? new Date(maxDateRecord.dated) : null; + + for (let i = 0; i < cubes.length; i++) { + const cube = cubes[i]; + if (cube.nodeType === 1 && cube.attributes.getNamedItem('time')) { const xmlDate = new Date(cube.getAttribute('time')); - if (!maxDate || maxDate < xmlDate) { - for (const rateCube of cube.childNodes) { - if (rateCube.nodeType === Node.ELEMENT_NODE) { + const xmlDateWithoutTime = new Date(xmlDate.getFullYear(), xmlDate.getMonth(), xmlDate.getDate()); + if (!maxDate || maxDate < xmlDateWithoutTime) { + for (let j = 0; j < cube.childNodes.length; j++) { + const rateCube = cube.childNodes[j]; + if (rateCube.nodeType === doc.ELEMENT_NODE) { const currencyCode = rateCube.getAttribute('currency'); const rate = rateCube.getAttribute('rate'); if (['USD', 'CNY', 'GBP'].includes(currencyCode)) { const currency = await models.Currency.findOne({where: {code: currencyCode}}); if (!currency) throw new UserError(`Currency not found for code: ${currencyCode}`); + const existingRate = await models.ReferenceRate.findOne({ + where: {currencyFk: currency.id, dated: xmlDate} + }); - try { - await models.ReferenceRate.upsertWithWhere( - {currencyFk: currency.id, dated: xmlDate}, - { - currencyFk: currency.id, - dated: xmlDate, - value: rate - } - ); - } catch (error) { - console.error(`Failed to upsert rate for ${currencyCode} on ${xmlDate}: ${error}`); - // Handle or throw the error accordingly - throw error; + if (existingRate) { + if (existingRate.value !== rate) + await existingRate.updateAttributes({value: rate}); + } else { + await models.ReferenceRate.create({ + currencyFk: currency.id, + dated: xmlDate, + value: rate + }); } } } diff --git a/back/models/collection.json b/back/models/collection.json index 3e428ef60..cb8dc3d7c 100644 --- a/back/models/collection.json +++ b/back/models/collection.json @@ -1,6 +1,11 @@ { "name": "Collection", "base": "VnModel", + "options": { + "mysql": { + "table": "collection" + } + }, "acls": [{ "property": "validations", "accessType": "EXECUTE", @@ -9,4 +14,3 @@ "permission": "ALLOW" }] } - \ No newline at end of file diff --git a/back/models/reference-rate.json b/back/models/reference-rate.json index 3553df5c5..b77213b29 100644 --- a/back/models/reference-rate.json +++ b/back/models/reference-rate.json @@ -8,21 +8,18 @@ } }, "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, "currencyFk": { "type": "number", - "required": true, - "id": 1, - "mysql": { - "dataType": "tinyint", - "dataLength": 3, - "unsigned": true, - "primaryKey": true - } + "required": true }, "dated": { "type": "date", - "required": true, - "id": 2 + "required": true }, "value": { "type": "number", diff --git a/db/versions/10992-goldenIvy/00-acl.sql b/db/versions/10992-goldenIvy/00-acl.sql new file mode 100644 index 000000000..551905be1 --- /dev/null +++ b/db/versions/10992-goldenIvy/00-acl.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES ('Collection', 'exchangeRateUpdate', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/db/versions/10992-goldenIvy/00-referenceRate.sql b/db/versions/10992-goldenIvy/00-referenceRate.sql new file mode 100644 index 000000000..db53f328f --- /dev/null +++ b/db/versions/10992-goldenIvy/00-referenceRate.sql @@ -0,0 +1,4 @@ +ALTER TABLE vn.referenceRate DROP INDEX `PRIMARY`; +ALTER TABLE vn.referenceRate ADD id INT auto_increment PRIMARY KEY; +ALTER TABLE vn.referenceRate CHANGE id id int(11) auto_increment NOT NULL FIRST; +CREATE UNIQUE INDEX referenceRate_currencyFk_IDX USING BTREE ON vn.referenceRate (currencyFk,dated); From b706d1c1c6d461e28cde8272657a6fe95cb6d3c8 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 12 Apr 2024 14:26:28 +0200 Subject: [PATCH 07/42] refs #6976 changes back supplier consumption --- .../assets/css/style.css | 6 ++++- .../supplier-campaign-metrics.html | 5 +++- .../supplier-campaign-metrics.js | 26 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/supplier-campaign-metrics/assets/css/style.css b/print/templates/reports/supplier-campaign-metrics/assets/css/style.css index 32caeb43c..c0d1c19c4 100644 --- a/print/templates/reports/supplier-campaign-metrics/assets/css/style.css +++ b/print/templates/reports/supplier-campaign-metrics/assets/css/style.css @@ -17,4 +17,8 @@ h2 { .description strong { text-transform: uppercase; -} \ No newline at end of file +} + +.black { + color: black; +} diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html index 08b27d0bd..4a1978a37 100644 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html @@ -37,7 +37,10 @@

- {{$t('entry')}} {{entry.id}} + + {{$t('entry')}} + {{entry.id}} + {{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}} {{$t('reference')}} {{entry.reference}}

diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js index 32a7e9b0a..82cfaa5d3 100755 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js @@ -7,6 +7,8 @@ module.exports = { this.supplier = await this.findOneFromDef('supplier', [this.id]); this.checkMainEntity(this.supplier); let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]); + let totalEntry; + let total; const entriesId = []; @@ -29,6 +31,30 @@ module.exports = { } this.entries = entries; + + // for (let buy of entry.buys) + // total += buy.total; + + // getTotal(entry) { + // if (entry.buys) { + // let total = 0; + // for (let buy of entry.buys) + // total += buy.total; + + // return total; + // } + // console.log('total', total); + // }; + }, + getTotal(entry) { + if (entry.buys) { + let total = 0; + for (let buy of entry.buys) + total += buy.total; + + return total; + } + console.log('total', total); }, props: { id: { From e8001b72e464395d05a44cc1c437a255d4fa38fa Mon Sep 17 00:00:00 2001 From: jgallego Date: Sat, 13 Apr 2024 09:05:54 +0200 Subject: [PATCH 08/42] feat: minor changes --- back/methods/collection/exchangeRateUpdate.js | 13 +++---------- back/models/reference-rate.json | 1 - loopback/locale/es.json | 13 ++----------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/back/methods/collection/exchangeRateUpdate.js b/back/methods/collection/exchangeRateUpdate.js index 093ee6e48..b1272d73a 100644 --- a/back/methods/collection/exchangeRateUpdate.js +++ b/back/methods/collection/exchangeRateUpdate.js @@ -10,11 +10,6 @@ module.exports = Self => { http: { path: '/exchangeRateUpdate', verb: 'post' - }, - returns: { - arg: 'result', - type: 'object', - root: true } }); @@ -29,16 +24,14 @@ module.exports = Self => { const maxDateRecord = await models.ReferenceRate.findOne({order: 'dated DESC'}); - const maxDate = maxDateRecord && maxDateRecord.dated ? new Date(maxDateRecord.dated) : null; + const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null; - for (let i = 0; i < cubes.length; i++) { - const cube = cubes[i]; + for (const cube of Array.from(cubes)) { if (cube.nodeType === 1 && cube.attributes.getNamedItem('time')) { const xmlDate = new Date(cube.getAttribute('time')); const xmlDateWithoutTime = new Date(xmlDate.getFullYear(), xmlDate.getMonth(), xmlDate.getDate()); if (!maxDate || maxDate < xmlDateWithoutTime) { - for (let j = 0; j < cube.childNodes.length; j++) { - const rateCube = cube.childNodes[j]; + for (const rateCube of Array.from(cube.childNodes)) { if (rateCube.nodeType === doc.ELEMENT_NODE) { const currencyCode = rateCube.getAttribute('currency'); const rate = rateCube.getAttribute('rate'); diff --git a/back/models/reference-rate.json b/back/models/reference-rate.json index b77213b29..fe732f3ef 100644 --- a/back/models/reference-rate.json +++ b/back/models/reference-rate.json @@ -1,7 +1,6 @@ { "name": "ReferenceRate", "base": "PersistedModel", - "idInjection": false, "options": { "mysql": { "table": "referenceRate" diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 50cd305fa..18ead3769 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -352,14 +352,5 @@ "The line could not be marked": "La linea no puede ser marcada", "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "They're not your subordinate": "No es tu subordinado/a.", - "No results found": "No se han encontrado resultados", - "ReferenceError: app is not defined": "ReferenceError: app is not defined", - "TypeError: Cannot read properties of undefined (reading 'ReferenceRate')": "TypeError: Cannot read properties of undefined (reading 'ReferenceRate')", - "Error: ER_BAD_FIELD_ERROR: Unknown column 'date' in 'order clause'": "Error: ER_BAD_FIELD_ERROR: Unknown column 'date' in 'order clause'", - "ReferenceError: ReferenceRate is not defined": "ReferenceError: ReferenceRate is not defined", - "ValidationError: The `ReferenceRate` instance is not valid. Details: `currencyFk` can't be blank (value: NaN).": "ValidationError: The `ReferenceRate` instance is not valid. Details: `currencyFk` can't be blank (value: NaN).", - "ReferenceError: Currency is not defined": "ReferenceError: Currency is not defined", - "UserError: Currency not found for code: CNY": "UserError: Currency not found for code: CNY", - "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-03' for key 'PRIMARY'": "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-03' for key 'PRIMARY'", - "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-08' for key 'PRIMARY'": "Error: ER_DUP_ENTRY: Duplicate entry '2-2024-04-08' for key 'PRIMARY'" -} \ No newline at end of file + "No results found": "No se han encontrado resultados" +} From 336c3274ea40cb9c536b157684b0608b8bcfa5ab Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 16 Apr 2024 07:38:48 +0200 Subject: [PATCH 09/42] feat(agency): refs #4988 add summary --- back/models/agency-log.json | 9 ++++++++ .../vn/triggers/agency_afterInsert.sql | 1 + .../10995-navyErica/00-firstScript.sql | 2 ++ .../10995-navyErica/01-agencyLogCreate.sql | 23 +++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 back/models/agency-log.json create mode 100644 db/versions/10995-navyErica/00-firstScript.sql create mode 100644 db/versions/10995-navyErica/01-agencyLogCreate.sql diff --git a/back/models/agency-log.json b/back/models/agency-log.json new file mode 100644 index 000000000..04b0b2995 --- /dev/null +++ b/back/models/agency-log.json @@ -0,0 +1,9 @@ +{ + "name": "AgencyLog", + "base": "Log", + "options": { + "mysql": { + "table": "agencyLog" + } + } +} diff --git a/db/routines/vn/triggers/agency_afterInsert.sql b/db/routines/vn/triggers/agency_afterInsert.sql index 35670538b..cdd6401cd 100644 --- a/db/routines/vn/triggers/agency_afterInsert.sql +++ b/db/routines/vn/triggers/agency_afterInsert.sql @@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_afterInsert` AFTER INSERT ON `agency` FOR EACH ROW BEGIN + SET NEW.editorFk = account.myUser_getId(); INSERT INTO agencyMode(name,agencyFk) VALUES(NEW.name,NEW.id); END$$ DELIMITER ; diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/00-firstScript.sql new file mode 100644 index 000000000..15fcaeef6 --- /dev/null +++ b/db/versions/10995-navyErica/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +INSERT INTO salix.ACL (id, model, property, accessType, permission, principalType, principalId) VALUES(826, 'Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/versions/10995-navyErica/01-agencyLogCreate.sql b/db/versions/10995-navyErica/01-agencyLogCreate.sql new file mode 100644 index 000000000..ec0ae0bdd --- /dev/null +++ b/db/versions/10995-navyErica/01-agencyLogCreate.sql @@ -0,0 +1,23 @@ +-- vn.agencyLog definition +ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; + + +CREATE TABLE IF NOT EXISTS `agencyLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(11) DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete','select') NOT NULL, + `creationDate` timestamp NULL DEFAULT current_timestamp(), + `description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `changedModel` enum('agency','agencyMode') NOT NULL DEFAULT 'agency', + `oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)), + `newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)), + `changedModelId` int(11) NOT NULL, + `changedModelValue` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `logAgencyUserFk` (`userFk`), + KEY `agencyLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), + KEY `agencyLog_originFk` (`originFk`,`creationDate`), + CONSTRAINT `agencyOriginFk` FOREIGN KEY (`agency`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file From 77a1aa4de62f7e87804cbcf72b9a314ab9e710ac Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 16 Apr 2024 08:45:03 +0200 Subject: [PATCH 10/42] feat: @7108 test --- back/methods/collection/exchangeRateUpdate.js | 8 +-- .../spec/exchangeRateUpdate.spec.js | 52 +++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 back/methods/collection/spec/exchangeRateUpdate.spec.js diff --git a/back/methods/collection/exchangeRateUpdate.js b/back/methods/collection/exchangeRateUpdate.js index b1272d73a..3ad06b242 100644 --- a/back/methods/collection/exchangeRateUpdate.js +++ b/back/methods/collection/exchangeRateUpdate.js @@ -17,8 +17,10 @@ module.exports = Self => { const response = await axios.get('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml'); const xmlData = response.data; - const doc = new DOMParser().parseFromString(xmlData, 'text/xml'); - const cubes = doc.getElementsByTagName('Cube'); + const doc = new DOMParser({errorHandler: {warning: () => {}}})?.parseFromString(xmlData, 'text/xml'); + const cubes = doc?.getElementsByTagName('Cube'); + if (!cubes || cubes.length === 0) + throw new UserError('No cubes found. Exiting the method.'); const models = Self.app.models; @@ -27,7 +29,7 @@ module.exports = Self => { const maxDate = maxDateRecord?.dated ? new Date(maxDateRecord.dated) : null; for (const cube of Array.from(cubes)) { - if (cube.nodeType === 1 && cube.attributes.getNamedItem('time')) { + if (cube.nodeType === doc.ELEMENT_NODE && cube.attributes.getNamedItem('time')) { const xmlDate = new Date(cube.getAttribute('time')); const xmlDateWithoutTime = new Date(xmlDate.getFullYear(), xmlDate.getMonth(), xmlDate.getDate()); if (!maxDate || maxDate < xmlDateWithoutTime) { diff --git a/back/methods/collection/spec/exchangeRateUpdate.spec.js b/back/methods/collection/spec/exchangeRateUpdate.spec.js new file mode 100644 index 000000000..7086c37a3 --- /dev/null +++ b/back/methods/collection/spec/exchangeRateUpdate.spec.js @@ -0,0 +1,52 @@ +describe('exchangeRateUpdate functionality', function() { + const axios = require('axios'); + const models = require('vn-loopback/server/server').models; + + beforeEach(function() { + spyOn(axios, 'get').and.returnValue(Promise.resolve({ + data: ` + + + + + ` + })); + }); + + it('should process XML data and update or create rates in the database', async function() { + spyOn(models.ReferenceRate, 'findOne').and.returnValue(Promise.resolve(null)); + spyOn(models.ReferenceRate, 'create').and.returnValue(Promise.resolve()); + + await models.Collection.exchangeRateUpdate(); + + expect(models.ReferenceRate.create).toHaveBeenCalledTimes(2); + }); + + it('should not create or update rates when no XML data is available', async function() { + axios.get.and.returnValue(Promise.resolve({})); + spyOn(models.ReferenceRate, 'create'); + + let thrownError = null; + try { + await models.Collection.exchangeRateUpdate(); + } catch (error) { + thrownError = error; + } + + expect(thrownError.message).toBe('No cubes found. Exiting the method.'); + }); + + it('should handle errors gracefully', async function() { + axios.get.and.returnValue(Promise.reject(new Error('Network error'))); + let error; + + try { + await models.Collection.exchangeRateUpdate(); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + expect(error.message).toBe('Network error'); + }); +}); From d0dfdc668b313dea77ba828947f8d43f21659c90 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 16 Apr 2024 16:25:27 +0200 Subject: [PATCH 11/42] feat(agency): refs #4988 add new agency --- back/model-config.json | 3 +++ db/routines/vn/triggers/agency_afterInsert.sql | 1 - db/routines/vn/triggers/agency_beforeInsert.sql | 8 ++++++++ db/versions/10995-navyErica/00-firstScript.sql | 5 ++++- db/versions/10995-navyErica/01-agencyLogCreate.sql | 10 +++++----- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 db/routines/vn/triggers/agency_beforeInsert.sql diff --git a/back/model-config.json b/back/model-config.json index ebcdb7bce..739a7965a 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -177,5 +177,8 @@ }, "ProductionConfig": { "dataSource": "vn" + }, + "AgencyLog": { + "dataSource": "vn" } } \ No newline at end of file diff --git a/db/routines/vn/triggers/agency_afterInsert.sql b/db/routines/vn/triggers/agency_afterInsert.sql index cdd6401cd..35670538b 100644 --- a/db/routines/vn/triggers/agency_afterInsert.sql +++ b/db/routines/vn/triggers/agency_afterInsert.sql @@ -3,7 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_afterInsert` AFTER INSERT ON `agency` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); INSERT INTO agencyMode(name,agencyFk) VALUES(NEW.name,NEW.id); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/agency_beforeInsert.sql b/db/routines/vn/triggers/agency_beforeInsert.sql new file mode 100644 index 000000000..8ff3958e1 --- /dev/null +++ b/db/routines/vn/triggers/agency_beforeInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`agency_beforeInsert` + BEFORE INSERT ON `agency` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/00-firstScript.sql index 15fcaeef6..104d1c322 100644 --- a/db/versions/10995-navyErica/00-firstScript.sql +++ b/db/versions/10995-navyErica/00-firstScript.sql @@ -1,2 +1,5 @@ -- Place your SQL code here -INSERT INTO salix.ACL (id, model, property, accessType, permission, principalType, principalId) VALUES(826, 'Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); diff --git a/db/versions/10995-navyErica/01-agencyLogCreate.sql b/db/versions/10995-navyErica/01-agencyLogCreate.sql index ec0ae0bdd..bfb1f83a8 100644 --- a/db/versions/10995-navyErica/01-agencyLogCreate.sql +++ b/db/versions/10995-navyErica/01-agencyLogCreate.sql @@ -2,9 +2,9 @@ ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; -CREATE TABLE IF NOT EXISTS `agencyLog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(11) DEFAULT NULL, +CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `originFk` smallint(5) unsigned DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `action` set('insert','update','delete','select') NOT NULL, `creationDate` timestamp NULL DEFAULT current_timestamp(), @@ -18,6 +18,6 @@ CREATE TABLE IF NOT EXISTS `agencyLog` ( KEY `logAgencyUserFk` (`userFk`), KEY `agencyLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`), KEY `agencyLog_originFk` (`originFk`,`creationDate`), - CONSTRAINT `agencyOriginFk` FOREIGN KEY (`agency`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyOriginFk` FOREIGN KEY (`originFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agencyUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file From 77f7348acbb25862b27e8f0c6d217c891be49ed7 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 18 Apr 2024 09:02:01 +0200 Subject: [PATCH 12/42] feat(workcenter): refs #4988 add workcenter config menu --- back/model-config.json | 3 ++ back/models/agency-workCenter.json | 36 +++++++++++++++++++ .../10995-navyErica/00-firstScript.sql | 4 +++ .../10995-navyErica/02-createTable.sql | 17 +++++++++ 4 files changed, 60 insertions(+) create mode 100644 back/models/agency-workCenter.json create mode 100644 db/versions/10995-navyErica/02-createTable.sql diff --git a/back/model-config.json b/back/model-config.json index 739a7965a..db43f89b2 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -180,5 +180,8 @@ }, "AgencyLog": { "dataSource": "vn" + }, + "AgencyWorkCenter": { + "dataSource": "vn" } } \ No newline at end of file diff --git a/back/models/agency-workCenter.json b/back/models/agency-workCenter.json new file mode 100644 index 000000000..cd1b295b4 --- /dev/null +++ b/back/models/agency-workCenter.json @@ -0,0 +1,36 @@ +{ + "name": "AgencyWorkCenter", + "base": "VnModel", + "options": { + "mysql": { + "table": "agencyWorkCenter" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "forceId": false + }, + "agencyFk": { + "type": "number", + "required": false + }, + "workCenterFk": { + "type": "number", + "required": false + } + }, + "relations": { + "agency": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "agencyFk" + }, + "workCenter": { + "type": "belongsTo", + "model": "WorkCenter", + "foreignKey": "workCenterFk" + } + } +} diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/00-firstScript.sql index 104d1c322..1b692301e 100644 --- a/db/versions/10995-navyErica/00-firstScript.sql +++ b/db/versions/10995-navyErica/00-firstScript.sql @@ -3,3 +3,7 @@ INSERT INTO salix.ACL (model, property, accessType, permission, principalType, p VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); + +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant'); + diff --git a/db/versions/10995-navyErica/02-createTable.sql b/db/versions/10995-navyErica/02-createTable.sql new file mode 100644 index 000000000..063e210fb --- /dev/null +++ b/db/versions/10995-navyErica/02-createTable.sql @@ -0,0 +1,17 @@ +CREATE TABLE IF NOT EXISTS vn.agencyWorkCenter ( + id INT UNSIGNED auto_increment NOT NULL, + agencyFk smallint(5) unsigned NULL, + workCenterFk int(11) NULL, + CONSTRAINT agencyWorkCenter_pk PRIMARY KEY (id), + CONSTRAINT agencyWorkCenter_agency_FK FOREIGN KEY (agencyFk) REFERENCES vn.agency(id) ON DELETE CASCADE, + CONSTRAINT agencyWorkCenter_workCenter_FK FOREIGN KEY (workCenterFk) REFERENCES vn.workCenter(id) +) +ENGINE=InnoDB +DEFAULT CHARSET=utf8mb3 +COLLATE=utf8mb3_unicode_ci +COMMENT='refs #4988'; + +INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) + SELECT id, workCenterFk + FROM vn.agency + WHERE workCenterFk IS NOT NULL; From b0c4f7fd3c1052bec05c9a11f86d935aaf3ed1ee Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 22 Apr 2024 11:45:58 +0200 Subject: [PATCH 13/42] feat: moved files to invoiceIn --- back/models/collection.js | 1 - loopback/locale/en.json | 433 +++++++++--------- .../methods/invoice-in}/exchangeRateUpdate.js | 0 .../specs}/exchangeRateUpdate.spec.js | 6 +- modules/invoiceIn/back/models/invoice-in.js | 1 + 5 files changed, 221 insertions(+), 220 deletions(-) rename {back/methods/collection => modules/invoiceIn/back/methods/invoice-in}/exchangeRateUpdate.js (100%) rename {back/methods/collection/spec => modules/invoiceIn/back/methods/invoice-in/specs}/exchangeRateUpdate.spec.js (90%) diff --git a/back/models/collection.js b/back/models/collection.js index 68c0bd13e..f2c2f1566 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -5,5 +5,4 @@ module.exports = Self => { require('../methods/collection/getTickets')(Self); require('../methods/collection/assign')(Self); require('../methods/collection/getSales')(Self); - require('../methods/collection/exchangeRateUpdate')(Self); }; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index a0e60550f..9a3a1f52a 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -1,217 +1,217 @@ { - "State cannot be blank": "State cannot be blank", - "Cannot be blank": "Cannot be blank", - "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", - "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero", - "Invalid email": "Invalid email", - "Name cannot be blank": "Name cannot be blank", - "Phone cannot be blank": "Phone cannot be blank", - "Description should have maximum of 45 characters": "Description should have maximum of 45 characters", - "Period cannot be blank": "Period cannot be blank", - "Sample type cannot be blank": "Sample type cannot be blank", - "That payment method requires an IBAN": "That payment method requires an IBAN", - "That payment method requires a BIC": "That payment method requires a BIC", - "The default consignee can not be unchecked": "The default consignee can not be unchecked", - "Enter an integer different to zero": "Enter an integer different to zero", - "Package cannot be blank": "Package cannot be blank", - "The price of the item changed": "The price of the item changed", - "The sales of this ticket can't be modified": "The sales of this ticket can't be modified", - "Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF", - "You can't create an order for a frozen client": "You can't create an order for a frozen client", - "This address doesn't exist": "This address doesn't exist", - "Warehouse cannot be blank": "Warehouse cannot be blank", - "Agency cannot be blank": "Agency cannot be blank", - "The IBAN does not have the correct format": "The IBAN does not have the correct format", - "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows", - "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client", - "Worker cannot be blank": "Worker cannot be blank", - "You must delete the claim id %d first": "You must delete the claim id %d first", - "You don't have enough privileges": "You don't have enough privileges", - "Tag value cannot be blank": "Tag value cannot be blank", - "A client with that Web User name already exists": "A client with that Web User name already exists", - "The warehouse can't be repeated": "The warehouse can't be repeated", - "Barcode must be unique": "Barcode must be unique", - "You don't have enough privileges to do that": "You don't have enough privileges to do that", - "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client", - "can't be blank": "can't be blank", - "Street cannot be empty": "Street cannot be empty", - "City cannot be empty": "City cannot be empty", - "EXTENSION_INVALID_FORMAT": "Invalid extension", - "The secret can't be blank": "The secret can't be blank", - "Invalid TIN": "Invalid Tax number", - "This ticket can't be invoiced": "This ticket can't be invoiced", - "The value should be a number": "The value should be a number", - "The current ticket can't be modified": "The current ticket can't be modified", - "Extension format is invalid": "Extension format is invalid", - "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS", - "This client can't be invoiced": "This client can't be invoiced", - "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice", - "The introduced hour already exists": "The introduced hour already exists", - "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket", - "Concept cannot be blank": "Concept cannot be blank", - "Ticket id cannot be blank": "Ticket id cannot be blank", - "Weekday cannot be blank": "Weekday cannot be blank", - "This ticket can not be modified": "This ticket can not be modified", - "You can't delete a confirmed order": "You can't delete a confirmed order", - "Value has an invalid format": "Value has an invalid format", - "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", - "Swift / BIC can't be empty": "Swift / BIC can't be empty", - "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", - "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", - "Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale quantity": "I have changed the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}* of the ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})", - "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", - "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", - "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}", - "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked, with the pickup type *{{claimPickup}}*", - "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*", - "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", - "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member", - "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", - "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", - "NOT_ZONE_WITH_THIS_PARAMETERS": "There's no zone available for this day", - "Created absence": "The worker {{author}} has added an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", - "Deleted absence": "The worker {{author}} has deleted an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", - "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})", - "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})", - "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "The grade must be similar to the last one": "The grade must be similar to the last one", - "agencyModeFk": "Agency", - "clientFk": "Client", - "zoneFk": "Zone", - "warehouseFk": "Warehouse", - "shipped": "Shipped", - "landed": "Landed", - "addressFk": "Address", - "companyFk": "Company", - "agency": "Agency", - "delivery": "Delivery", - "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data", - "The social name cannot be empty": "The social name cannot be empty", - "The nif cannot be empty": "The nif cannot be empty", - "Amount cannot be zero": "Amount cannot be zero", - "Company has to be official": "Company has to be official", - "Unable to clone this travel": "Unable to clone this travel", - "The observation type can't be repeated": "The observation type can't be repeated", - "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*", - "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*", - "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})", - "Swift / BIC cannot be empty": "Swift / BIC cannot be empty", - "Role name must be written in camelCase": "Role name must be written in camelCase", - "Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})", - "None": "None", - "error densidad = 0": "error densidad = 0", - "This document already exists on this ticket": "This document already exists on this ticket", - "serial non editable": "This serial doesn't allow to set a reference", - "nickname": "nickname", - "State": "State", - "regular": "regular", - "reserved": "reserved", - "Global invoicing failed": "[Global invoicing] Wasn't able to invoice some of the clients", - "A ticket with a negative base can't be invoiced": "A ticket with a negative base can't be invoiced", - "This client is not invoiceable": "This client is not invoiceable", - "INACTIVE_PROVIDER": "Inactive provider", - "reference duplicated": "reference duplicated", - "The PDF document does not exist": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option", - "This item is not available": "This item is not available", - "Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}", - "The type of business must be filled in basic data": "The type of business must be filled in basic data", - "The worker has hours recorded that day": "The worker has hours recorded that day", - "isWithoutNegatives": "isWithoutNegatives", - "routeFk": "routeFk", - "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data", - "Can't change the password of another worker": "Can't change the password of another worker", - "No hay un contrato en vigor": "There is no existing contract", - "No está permitido trabajar": "Not allowed to work", - "Dirección incorrecta": "Wrong direction", - "No se permite fichar a futuro": "It is not allowed to sign in the future", - "Descanso diario 12h.": "Daily rest 12h.", - "Fichadas impares": "Odd signs", - "Descanso diario 9h.": "Daily rest 9h.", - "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.", - "Verify email": "Verify email", - "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it", - "Password does not meet requirements": "Password does not meet requirements", - "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", - "Not enough privileges to edit a client": "Not enough privileges to edit a client", - "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", - "You don't have grant privilege": "You don't have grant privilege", - "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", - "Email verify": "Email verify", - "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", - "App locked": "App locked by user {{userId}}", - "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", - "Receipt's bank was not found": "Receipt's bank was not found", - "This receipt was not compensated": "This receipt was not compensated", - "Client's email was not found": "Client's email was not found", - "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d", - "It is not possible to modify tracked sales": "It is not possible to modify tracked sales", - "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", - "It is not possible to modify cloned sales": "It is not possible to modify cloned sales", - "Warehouse inventory not set": "Almacén inventario no está establecido", - "Component cost not set": "Componente coste no está estabecido", - "Description cannot be blank": "Description cannot be blank", - "company": "Company", - "country": "Country", - "clientId": "Id client", - "clientSocialName": "Client", - "amount": "Amount", - "taxableBase": "Taxable base", - "ticketFk": "Id ticket", - "isActive": "Active", - "hasToInvoice": "Invoice", - "isTaxDataChecked": "Data checked", - "comercialId": "Id Comercial", - "comercialName": "Comercial", - "Added observation": "Added observation", - "Comment added to client": "Comment added to client", - "This ticket is already a refund": "This ticket is already a refund", - "A claim with that sale already exists": "A claim with that sale already exists", - "Pass expired": "The password has expired, change it from Salix", - "Can't transfer claimed sales": "Can't transfer claimed sales", - "Invalid quantity": "Invalid quantity", - "Failed to upload delivery note": "Error to upload delivery note {{id}}", - "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", - "The renew period has not been exceeded": "The renew period has not been exceeded", - "You can not use the same password": "You can not use the same password", - "Valid priorities": "Valid priorities: %d", - "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}", - "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}", - "This ticket cannot be left empty.": "This ticket cannot be left empty. %s", - "Social name should be uppercase": "Social name should be uppercase", - "Street should be uppercase": "Street should be uppercase", - "You don't have enough privileges.": "You don't have enough privileges.", - "This ticket is locked": "This ticket is locked", - "This ticket is not editable.": "This ticket is not editable.", - "The ticket doesn't exist.": "The ticket doesn't exist.", - "The sales do not exists": "The sales do not exists", - "Ticket without Route": "Ticket without route", - "Select a different client": "Select a different client", - "Fill all the fields": "Fill all the fields", - "Error while generating PDF": "Error while generating PDF", - "Can't invoice to future": "Can't invoice to future", - "This ticket is already invoiced": "This ticket is already invoiced", - "Negative basis of tickets: 23": "Negative basis of tickets: 23", - "Booking completed": "Booking complete", - "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", - "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets", - "Bank entity must be specified": "Bank entity must be specified", - "Try again": "Try again", - "keepPrice": "keepPrice", - "Cannot past travels with entries": "Cannot past travels with entries", - "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", - "Incorrect pin": "Incorrect pin.", - "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", - "Name should be uppercase": "Name should be uppercase", - "You cannot update these fields": "You cannot update these fields", - "CountryFK cannot be empty": "Country cannot be empty", - "You are not allowed to modify the alias": "You are not allowed to modify the alias", - "You already have the mailAlias": "You already have the mailAlias", + "State cannot be blank": "State cannot be blank", + "Cannot be blank": "Cannot be blank", + "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", + "The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero", + "Invalid email": "Invalid email", + "Name cannot be blank": "Name cannot be blank", + "Phone cannot be blank": "Phone cannot be blank", + "Description should have maximum of 45 characters": "Description should have maximum of 45 characters", + "Period cannot be blank": "Period cannot be blank", + "Sample type cannot be blank": "Sample type cannot be blank", + "That payment method requires an IBAN": "That payment method requires an IBAN", + "That payment method requires a BIC": "That payment method requires a BIC", + "The default consignee can not be unchecked": "The default consignee can not be unchecked", + "Enter an integer different to zero": "Enter an integer different to zero", + "Package cannot be blank": "Package cannot be blank", + "The price of the item changed": "The price of the item changed", + "The sales of this ticket can't be modified": "The sales of this ticket can't be modified", + "Cannot check Equalization Tax in this NIF/CIF": "Cannot check Equalization Tax in this NIF/CIF", + "You can't create an order for a frozen client": "You can't create an order for a frozen client", + "This address doesn't exist": "This address doesn't exist", + "Warehouse cannot be blank": "Warehouse cannot be blank", + "Agency cannot be blank": "Agency cannot be blank", + "The IBAN does not have the correct format": "The IBAN does not have the correct format", + "You can't make changes on the basic data of an confirmed order or with rows": "You can't make changes on the basic data of an confirmed order or with rows", + "You can't create a ticket for an inactive client": "You can't create a ticket for an inactive client", + "Worker cannot be blank": "Worker cannot be blank", + "You must delete the claim id %d first": "You must delete the claim id %d first", + "You don't have enough privileges": "You don't have enough privileges", + "Tag value cannot be blank": "Tag value cannot be blank", + "A client with that Web User name already exists": "A client with that Web User name already exists", + "The warehouse can't be repeated": "The warehouse can't be repeated", + "Barcode must be unique": "Barcode must be unique", + "You don't have enough privileges to do that": "You don't have enough privileges to do that", + "You can't create a ticket for a frozen client": "You can't create a ticket for a frozen client", + "can't be blank": "can't be blank", + "Street cannot be empty": "Street cannot be empty", + "City cannot be empty": "City cannot be empty", + "EXTENSION_INVALID_FORMAT": "Invalid extension", + "The secret can't be blank": "The secret can't be blank", + "Invalid TIN": "Invalid Tax number", + "This ticket can't be invoiced": "This ticket can't be invoiced", + "The value should be a number": "The value should be a number", + "The current ticket can't be modified": "The current ticket can't be modified", + "Extension format is invalid": "Extension format is invalid", + "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS", + "This client can't be invoiced": "This client can't be invoiced", + "You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice", + "The introduced hour already exists": "The introduced hour already exists", + "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket", + "Concept cannot be blank": "Concept cannot be blank", + "Ticket id cannot be blank": "Ticket id cannot be blank", + "Weekday cannot be blank": "Weekday cannot be blank", + "This ticket can not be modified": "This ticket can not be modified", + "You can't delete a confirmed order": "You can't delete a confirmed order", + "Value has an invalid format": "Value has an invalid format", + "The postcode doesn't exist. Please enter a correct one": "The postcode doesn't exist. Please enter a correct one", + "Swift / BIC can't be empty": "Swift / BIC can't be empty", + "Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", + "Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", + "Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale quantity": "I have changed the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}* of the ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})", + "MESSAGE_INSURANCE_CHANGE": "I have changed the insurence credit of client [{{clientName}} ({{clientId}})]({{{url}}}) to *{{credit}} €*", + "Changed client paymethod": "I have changed the pay method for client [{{clientName}} ({{clientId}})]({{{url}}})", + "Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}", + "Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked, with the pickup type *{{claimPickup}}*", + "Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*", + "Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member", + "Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member", + "Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}", + "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", + "NOT_ZONE_WITH_THIS_PARAMETERS": "There's no zone available for this day", + "Created absence": "The worker {{author}} has added an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", + "Deleted absence": "The worker {{author}} has deleted an absence of type '{{absenceType}}' to {{employee}} for day {{dated}}.", + "I have deleted the ticket id": "I have deleted the ticket id [{{id}}]({{{url}}})", + "I have restored the ticket id": "I have restored the ticket id [{{id}}]({{{url}}})", + "Changed this data from the ticket": "I have changed the data from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "The grade must be similar to the last one": "The grade must be similar to the last one", + "agencyModeFk": "Agency", + "clientFk": "Client", + "zoneFk": "Zone", + "warehouseFk": "Warehouse", + "shipped": "Shipped", + "landed": "Landed", + "addressFk": "Address", + "companyFk": "Company", + "agency": "Agency", + "delivery": "Delivery", + "You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data", + "The social name cannot be empty": "The social name cannot be empty", + "The nif cannot be empty": "The nif cannot be empty", + "Amount cannot be zero": "Amount cannot be zero", + "Company has to be official": "Company has to be official", + "Unable to clone this travel": "Unable to clone this travel", + "The observation type can't be repeated": "The observation type can't be repeated", + "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*", + "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*", + "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})", + "Swift / BIC cannot be empty": "Swift / BIC cannot be empty", + "Role name must be written in camelCase": "Role name must be written in camelCase", + "Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})", + "None": "None", + "error densidad = 0": "error densidad = 0", + "This document already exists on this ticket": "This document already exists on this ticket", + "serial non editable": "This serial doesn't allow to set a reference", + "nickname": "nickname", + "State": "State", + "regular": "regular", + "reserved": "reserved", + "Global invoicing failed": "[Global invoicing] Wasn't able to invoice some of the clients", + "A ticket with a negative base can't be invoiced": "A ticket with a negative base can't be invoiced", + "This client is not invoiceable": "This client is not invoiceable", + "INACTIVE_PROVIDER": "Inactive provider", + "reference duplicated": "reference duplicated", + "The PDF document does not exist": "The PDF document does not exists. Try regenerating it from 'Regenerate invoice PDF' option", + "This item is not available": "This item is not available", + "Deny buy request": "Purchase request for ticket id [{{ticketId}}]({{{url}}}) has been rejected. Reason: {{observation}}", + "The type of business must be filled in basic data": "The type of business must be filled in basic data", + "The worker has hours recorded that day": "The worker has hours recorded that day", + "isWithoutNegatives": "isWithoutNegatives", + "routeFk": "routeFk", + "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data", + "Can't change the password of another worker": "Can't change the password of another worker", + "No hay un contrato en vigor": "There is no existing contract", + "No está permitido trabajar": "Not allowed to work", + "Dirección incorrecta": "Wrong direction", + "No se permite fichar a futuro": "It is not allowed to sign in the future", + "Descanso diario 12h.": "Daily rest 12h.", + "Fichadas impares": "Odd signs", + "Descanso diario 9h.": "Daily rest 9h.", + "Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.", + "Verify email": "Verify email", + "Click on the following link to verify this email. If you haven't requested this email, just ignore it": "Click on the following link to verify this email. If you haven't requested this email, just ignore it", + "Password does not meet requirements": "Password does not meet requirements", + "You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies", + "Not enough privileges to edit a client": "Not enough privileges to edit a client", + "Claim pickup order sent": "Claim pickup order sent [{{claimId}}]({{{claimUrl}}}) to client *{{clientName}}*", + "You don't have grant privilege": "You don't have grant privilege", + "You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user", + "Email verify": "Email verify", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) merged with [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "App locked": "App locked by user {{userId}}", + "The sales of the receiver ticket can't be modified": "The sales of the receiver ticket can't be modified", + "Receipt's bank was not found": "Receipt's bank was not found", + "This receipt was not compensated": "This receipt was not compensated", + "Client's email was not found": "Client's email was not found", + "Tickets with associated refunds": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº %d", + "It is not possible to modify tracked sales": "It is not possible to modify tracked sales", + "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", + "It is not possible to modify cloned sales": "It is not possible to modify cloned sales", + "Warehouse inventory not set": "Almacén inventario no está establecido", + "Component cost not set": "Componente coste no está estabecido", + "Description cannot be blank": "Description cannot be blank", + "company": "Company", + "country": "Country", + "clientId": "Id client", + "clientSocialName": "Client", + "amount": "Amount", + "taxableBase": "Taxable base", + "ticketFk": "Id ticket", + "isActive": "Active", + "hasToInvoice": "Invoice", + "isTaxDataChecked": "Data checked", + "comercialId": "Id Comercial", + "comercialName": "Comercial", + "Added observation": "Added observation", + "Comment added to client": "Comment added to client", + "This ticket is already a refund": "This ticket is already a refund", + "A claim with that sale already exists": "A claim with that sale already exists", + "Pass expired": "The password has expired, change it from Salix", + "Can't transfer claimed sales": "Can't transfer claimed sales", + "Invalid quantity": "Invalid quantity", + "Failed to upload delivery note": "Error to upload delivery note {{id}}", + "Mail not sent": "There has been an error sending the invoice to the client [{{clientId}}]({{{clientUrl}}}), please check the email address", + "The renew period has not been exceeded": "The renew period has not been exceeded", + "You can not use the same password": "You can not use the same password", + "Valid priorities": "Valid priorities: %d", + "hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}", + "hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}", + "This ticket cannot be left empty.": "This ticket cannot be left empty. %s", + "Social name should be uppercase": "Social name should be uppercase", + "Street should be uppercase": "Street should be uppercase", + "You don't have enough privileges.": "You don't have enough privileges.", + "This ticket is locked": "This ticket is locked", + "This ticket is not editable.": "This ticket is not editable.", + "The ticket doesn't exist.": "The ticket doesn't exist.", + "The sales do not exists": "The sales do not exists", + "Ticket without Route": "Ticket without route", + "Select a different client": "Select a different client", + "Fill all the fields": "Fill all the fields", + "Error while generating PDF": "Error while generating PDF", + "Can't invoice to future": "Can't invoice to future", + "This ticket is already invoiced": "This ticket is already invoiced", + "Negative basis of tickets: 23": "Negative basis of tickets: 23", + "Booking completed": "Booking complete", + "The ticket is in preparation": "The ticket [{{ticketId}}]({{{ticketUrl}}}) of the sales person {{salesPersonId}} is in preparation", + "You can only add negative amounts in refund tickets": "You can only add negative amounts in refund tickets", + "Bank entity must be specified": "Bank entity must be specified", + "Try again": "Try again", + "keepPrice": "keepPrice", + "Cannot past travels with entries": "Cannot past travels with entries", + "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", + "Incorrect pin": "Incorrect pin.", + "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", + "Name should be uppercase": "Name should be uppercase", + "You cannot update these fields": "You cannot update these fields", + "CountryFK cannot be empty": "Country cannot be empty", + "You are not allowed to modify the alias": "You are not allowed to modify the alias", + "You already have the mailAlias": "You already have the mailAlias", "This machine is already in use.": "This machine is already in use.", "the plate does not exist": "The plate {{plate}} does not exist", "We do not have availability for the selected item": "We do not have availability for the selected item", @@ -223,6 +223,7 @@ "printerNotExists": "The printer does not exist", "There are not picking tickets": "There are not picking tickets", "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", - "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", - "They're not your subordinate": "They're not your subordinate" -} + "This password can only be changed by the user themselves": "This password can only be changed by the user themselves", + "They're not your subordinate": "They're not your subordinate", + "InvoiceIn is already booked": "InvoiceIn is already booked" +} \ No newline at end of file diff --git a/back/methods/collection/exchangeRateUpdate.js b/modules/invoiceIn/back/methods/invoice-in/exchangeRateUpdate.js similarity index 100% rename from back/methods/collection/exchangeRateUpdate.js rename to modules/invoiceIn/back/methods/invoice-in/exchangeRateUpdate.js diff --git a/back/methods/collection/spec/exchangeRateUpdate.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/exchangeRateUpdate.spec.js similarity index 90% rename from back/methods/collection/spec/exchangeRateUpdate.spec.js rename to modules/invoiceIn/back/methods/invoice-in/specs/exchangeRateUpdate.spec.js index 7086c37a3..0fd7ea165 100644 --- a/back/methods/collection/spec/exchangeRateUpdate.spec.js +++ b/modules/invoiceIn/back/methods/invoice-in/specs/exchangeRateUpdate.spec.js @@ -17,7 +17,7 @@ describe('exchangeRateUpdate functionality', function() { spyOn(models.ReferenceRate, 'findOne').and.returnValue(Promise.resolve(null)); spyOn(models.ReferenceRate, 'create').and.returnValue(Promise.resolve()); - await models.Collection.exchangeRateUpdate(); + await models.InvoiceIn.exchangeRateUpdate(); expect(models.ReferenceRate.create).toHaveBeenCalledTimes(2); }); @@ -28,7 +28,7 @@ describe('exchangeRateUpdate functionality', function() { let thrownError = null; try { - await models.Collection.exchangeRateUpdate(); + await models.InvoiceIn.exchangeRateUpdate(); } catch (error) { thrownError = error; } @@ -41,7 +41,7 @@ describe('exchangeRateUpdate functionality', function() { let error; try { - await models.Collection.exchangeRateUpdate(); + await models.InvoiceIn.exchangeRateUpdate(); } catch (e) { error = e; } diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js index af5efbcdf..31cdc1abe 100644 --- a/modules/invoiceIn/back/models/invoice-in.js +++ b/modules/invoiceIn/back/models/invoice-in.js @@ -10,6 +10,7 @@ module.exports = Self => { require('../methods/invoice-in/invoiceInEmail')(Self); require('../methods/invoice-in/getSerial')(Self); require('../methods/invoice-in/corrective')(Self); + require('../methods/invoice-in/exchangeRateUpdate')(Self); Self.rewriteDbError(function(err) { if (err.code === 'ER_ROW_IS_REFERENCED_2' && err.sqlMessage.includes('vehicleInvoiceIn')) From 0537a3eca36d70a455f0d533e448b71e4d486741 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 22 Apr 2024 12:54:48 +0200 Subject: [PATCH 14/42] refs #6976 entity quantity price --- .../supplier-campaign-metrics/sql/entries.sql | 3 +-- .../supplier-campaign-metrics.html | 2 ++ .../supplier-campaign-metrics.js | 22 +++---------------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/print/templates/reports/supplier-campaign-metrics/sql/entries.sql b/print/templates/reports/supplier-campaign-metrics/sql/entries.sql index 8a3ebb915..60ef0fed3 100644 --- a/print/templates/reports/supplier-campaign-metrics/sql/entries.sql +++ b/print/templates/reports/supplier-campaign-metrics/sql/entries.sql @@ -6,5 +6,4 @@ SELECT FROM vn.entry e JOIN vn.travel t ON t.id = e.travelFk WHERE e.supplierFk = ? AND DATE(t.shipped) BETWEEN ? AND ? - ORDER BY - t.shipped DESC; + ORDER BY t.shipped DESC; diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html index 4a1978a37..fd04deab1 100644 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html @@ -65,6 +65,8 @@ {{buy.tag5}} {{buy.value5}} {{buy.tag6}} {{buy.value6}} {{buy.tag7}} {{buy.value7}} +
{{total.quantity}}
+ diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js index 82cfaa5d3..dfc91cc3c 100755 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.js @@ -7,9 +7,7 @@ module.exports = { this.supplier = await this.findOneFromDef('supplier', [this.id]); this.checkMainEntity(this.supplier); let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]); - let totalEntry; - let total; - + this.total = {quantity: 0, price: 0}; const entriesId = []; for (let entry of entries) @@ -25,26 +23,13 @@ module.exports = { const entry = entriesMap.get(buy.entryFk); if (entry) { if (!entry.buys) entry.buys = []; - + this.total.quantity = this.total.quantity + buy.quantity; + this.total.price = this.total.price + (buy.price * buy.quantity); entry.buys.push(buy); } } this.entries = entries; - - // for (let buy of entry.buys) - // total += buy.total; - - // getTotal(entry) { - // if (entry.buys) { - // let total = 0; - // for (let buy of entry.buys) - // total += buy.total; - - // return total; - // } - // console.log('total', total); - // }; }, getTotal(entry) { if (entry.buys) { @@ -54,7 +39,6 @@ module.exports = { return total; } - console.log('total', total); }, props: { id: { From adc3b413f5ede3342ca052377e404a001e80295f Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 22 Apr 2024 17:17:17 +0200 Subject: [PATCH 15/42] feat: refs #4988 agency add module --- back/models/agency-workCenter.json | 5 +++++ .../10995-navyErica/01-agencyLogCreate.sql | 1 + .../02-agencyWorkCenterCreate.sql | 18 ++++++++++++++++++ db/versions/10995-navyErica/02-createTable.sql | 17 ----------------- .../{00-firstScript.sql => 03-tableAcl.sql} | 14 ++++++++++++-- 5 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql delete mode 100644 db/versions/10995-navyErica/02-createTable.sql rename db/versions/10995-navyErica/{00-firstScript.sql => 03-tableAcl.sql} (50%) diff --git a/back/models/agency-workCenter.json b/back/models/agency-workCenter.json index cd1b295b4..adf1e5bcb 100644 --- a/back/models/agency-workCenter.json +++ b/back/models/agency-workCenter.json @@ -32,5 +32,10 @@ "model": "WorkCenter", "foreignKey": "workCenterFk" } + }, + "scope": { + "include":{ + "relation": "workCenter" + } } } diff --git a/db/versions/10995-navyErica/01-agencyLogCreate.sql b/db/versions/10995-navyErica/01-agencyLogCreate.sql index bfb1f83a8..0b8a1ed87 100644 --- a/db/versions/10995-navyErica/01-agencyLogCreate.sql +++ b/db/versions/10995-navyErica/01-agencyLogCreate.sql @@ -1,6 +1,7 @@ -- vn.agencyLog definition ALTER TABLE vn.agency ADD IF NOT EXISTS editorFk int(10) unsigned DEFAULT NULL NULL; +ALTER TABLE vn.agency ADD CONSTRAINT agency_user_FK FOREIGN KEY (editorFk) REFERENCES `account`.`user`(id); CREATE TABLE IF NOT EXISTS `vn`.`agencyLog` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql new file mode 100644 index 000000000..1d716ee9c --- /dev/null +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS `agencyWorkCenter` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `agencyFk` smallint(5) unsigned NOT NULL, + `workCenterFk` int(11) NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `agencyWorkCenter_unique` (`agencyFk`,`workCenterFk`), + KEY `agencyWorkCenter_workCenter_FK` (`workCenterFk`), + KEY `agencyWorkCenter_user_FK` (`editorFk`), + CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE, + CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988'; + +INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) + SELECT id, workCenterFk + FROM vn.agency + WHERE workCenterFk IS NOT NULL; diff --git a/db/versions/10995-navyErica/02-createTable.sql b/db/versions/10995-navyErica/02-createTable.sql deleted file mode 100644 index 063e210fb..000000000 --- a/db/versions/10995-navyErica/02-createTable.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE IF NOT EXISTS vn.agencyWorkCenter ( - id INT UNSIGNED auto_increment NOT NULL, - agencyFk smallint(5) unsigned NULL, - workCenterFk int(11) NULL, - CONSTRAINT agencyWorkCenter_pk PRIMARY KEY (id), - CONSTRAINT agencyWorkCenter_agency_FK FOREIGN KEY (agencyFk) REFERENCES vn.agency(id) ON DELETE CASCADE, - CONSTRAINT agencyWorkCenter_workCenter_FK FOREIGN KEY (workCenterFk) REFERENCES vn.workCenter(id) -) -ENGINE=InnoDB -DEFAULT CHARSET=utf8mb3 -COLLATE=utf8mb3_unicode_ci -COMMENT='refs #4988'; - -INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) - SELECT id, workCenterFk - FROM vn.agency - WHERE workCenterFk IS NOT NULL; diff --git a/db/versions/10995-navyErica/00-firstScript.sql b/db/versions/10995-navyErica/03-tableAcl.sql similarity index 50% rename from db/versions/10995-navyErica/00-firstScript.sql rename to db/versions/10995-navyErica/03-tableAcl.sql index 1b692301e..f3fc4d336 100644 --- a/db/versions/10995-navyErica/00-firstScript.sql +++ b/db/versions/10995-navyErica/03-tableAcl.sql @@ -1,9 +1,19 @@ -- Place your SQL code here -INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) - VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('AgencyLog','*','READ','ALLOW','ROLE','employee'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('AgencyWorkCenter','*','READ','ALLOW','ROLE','employee'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('AgencyMode', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('Agency', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('Agency','*','WRITE','ALLOW','ROLE','deliveryAssistant'); +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('AgencyWorkCenter','*','WRITE','ALLOW','ROLE','deliveryAssistant'); + From 34bb0e905294bbff71e2ffbbadff59b06484009c Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 23 Apr 2024 10:07:40 +0200 Subject: [PATCH 16/42] refs #6976 fix pdf --- .../supplier-campaign-metrics/assets/css/style.css | 5 +++++ .../supplier-campaign-metrics.html | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/supplier-campaign-metrics/assets/css/style.css b/print/templates/reports/supplier-campaign-metrics/assets/css/style.css index c0d1c19c4..dae6b8c64 100644 --- a/print/templates/reports/supplier-campaign-metrics/assets/css/style.css +++ b/print/templates/reports/supplier-campaign-metrics/assets/css/style.css @@ -22,3 +22,8 @@ h2 { .black { color: black; } + +.totalFootpage { + margin: 20px; + background-color: blue; +} diff --git a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html index fd04deab1..95b913bc5 100644 --- a/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html +++ b/print/templates/reports/supplier-campaign-metrics/supplier-campaign-metrics.html @@ -65,13 +65,18 @@ {{buy.tag5}} {{buy.value5}} {{buy.tag6}} {{buy.value6}} {{buy.tag7}} {{buy.value7}} -
{{total.quantity}}
-
+ + + + + + +
{{$t('total')}}{{total.price | currency('EUR', $i18n.locale)}}