From 8fd133c5e8a10edb4b35b3796887be898d6ff442 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 27 Nov 2024 12:51:09 +0100 Subject: [PATCH 01/16] feat: refs #6818 define prefix model --- back/model-config.json | 3 +++ back/models/prefix.json | 27 +++++++++++++++++++ modules/client/back/methods/client/summary.js | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 back/models/prefix.json diff --git a/back/model-config.json b/back/model-config.json index b543071c9..e0bc92200 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -133,6 +133,9 @@ "Postcode": { "dataSource": "vn" }, + "Prefix": { + "dataSource": "vn" + }, "ReferenceRate": { "dataSource": "vn" }, diff --git a/back/models/prefix.json b/back/models/prefix.json new file mode 100644 index 000000000..762354caa --- /dev/null +++ b/back/models/prefix.json @@ -0,0 +1,27 @@ +{ + "name": "Prefix", + "base": "VnModel", + "options": { + "mysql": { + "table": "pbx.prefix" + } + }, + "properties": { + "country": { + "type": "string", + "id": true + }, + "prefix": { + "type": "string" + } + }, + "acls": [ + { + "property": "*", + "accessType": "READ", + "principalType": "ROLE", + "principalId": "employee", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 9242fbd44..9c1420b61 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -54,7 +54,7 @@ module.exports = Self => { { relation: 'country', scope: { - fields: ['id', 'name'], + fields: ['id', 'name', 'code'], include: { relation: 'saySimpleCountry', } From 2231add129128bfb8c6c9645ac298e7d0d172253 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 27 Nov 2024 12:58:32 +0100 Subject: [PATCH 02/16] fix: refs #7266 Minor changes --- print/templates/reports/buy-label-barcode/assets/css/style.css | 3 +++ .../templates/reports/buy-label-barcode/buy-label-barcode.html | 2 +- print/templates/reports/buy-label-barcode/buy-label-barcode.js | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/buy-label-barcode/assets/css/style.css b/print/templates/reports/buy-label-barcode/assets/css/style.css index fabecd28e..eece20acb 100644 --- a/print/templates/reports/buy-label-barcode/assets/css/style.css +++ b/print/templates/reports/buy-label-barcode/assets/css/style.css @@ -32,6 +32,9 @@ td { .md-txt { font-size: 26px; } +.lg-txt { + font-size: 32px; +} .xl-txt { font-size: 50px; } diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.html b/print/templates/reports/buy-label-barcode/buy-label-barcode.html index c787942c4..c1725f5c0 100644 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.html +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.html @@ -36,7 +36,7 @@ - +
{{formatNumber(buy.itemFk)}}
diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.js b/print/templates/reports/buy-label-barcode/buy-label-barcode.js index 509d9f502..8e9f186b5 100755 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.js +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.js @@ -21,7 +21,7 @@ module.exports = { format: 'code128', displayValue: false, width: 3.8, - height: 85, + height: 80, margin: 0 }); return new XMLSerializer().serializeToString(svgNode); From 9c495ada133537f28ca87b5309e6b8b1790d8dab Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 27 Nov 2024 12:59:27 +0100 Subject: [PATCH 03/16] fix: refs #7266 Minor changes x2 --- print/templates/reports/buy-label-barcode/buy-label-barcode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.js b/print/templates/reports/buy-label-barcode/buy-label-barcode.js index 8e9f186b5..a0359acc9 100755 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.js +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.js @@ -21,7 +21,7 @@ module.exports = { format: 'code128', displayValue: false, width: 3.8, - height: 80, + height: 75, margin: 0 }); return new XMLSerializer().serializeToString(svgNode); From 15c755087c929a58f90a8cfcc57d675e4f65e8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 27 Nov 2024 14:28:50 +0100 Subject: [PATCH 04/16] fix: refs #8221 duaInvoiceIn unique --- db/versions/11369-azureChrysanthemum/00-firstScript.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/versions/11369-azureChrysanthemum/00-firstScript.sql diff --git a/db/versions/11369-azureChrysanthemum/00-firstScript.sql b/db/versions/11369-azureChrysanthemum/00-firstScript.sql new file mode 100644 index 000000000..3a86c0c59 --- /dev/null +++ b/db/versions/11369-azureChrysanthemum/00-firstScript.sql @@ -0,0 +1,5 @@ +ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaFk_UNIQUE; +ALTER TABLE vn.duaInvoiceIn DROP KEY IF EXISTS duaInvoiceIn_unique; +ALTER TABLE vn.duaInvoiceIn ADD CONSTRAINT duaInvoiceIn_unique + UNIQUE KEY (invoiceInFk); + From d872f164fda67e1803c538863014c3fc3b6261de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 27 Nov 2024 14:55:30 +0000 Subject: [PATCH 05/16] Actualizar modules/entry/back/models/entry.js --- modules/entry/back/models/entry.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 8ca79f531..49c3d2ec3 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -12,6 +12,7 @@ module.exports = Self => { require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); require('../methods/entry/print')(Self); + require('../methods/entry/buyLabelSupplier')(Self); Self.observe('before save', async function(ctx, options) { if (ctx.isNewInstance) return; From 30cc7a49a0f859e9c1d254a3a12d654a9dca045e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 27 Nov 2024 15:38:50 +0000 Subject: [PATCH 06/16] Actualizar modules/entry/back/methods/entry/print.js --- modules/entry/back/methods/entry/print.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/print.js index 5b9de9a69..b604adce6 100644 --- a/modules/entry/back/methods/entry/print.js +++ b/modules/entry/back/methods/entry/print.js @@ -48,6 +48,7 @@ module.exports = Self => { for (const buy of buys) { if (buy.stickers < 1) continue; ctx.args.id = buy.id; + ctx.args.copies = buy.stickers; const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions); await merger.add(new Uint8Array(pdfBuffer[0])); } From 93388461d184de74a0fe01df4083c48b79fc37ae Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 28 Nov 2024 08:59:08 +0100 Subject: [PATCH 07/16] fix: refs #7266 Changed method name and corrections --- .../back/methods/entry/{print.js => labelSupplier.js} | 8 ++++---- modules/entry/back/models/entry.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) rename modules/entry/back/methods/entry/{print.js => labelSupplier.js} (89%) diff --git a/modules/entry/back/methods/entry/print.js b/modules/entry/back/methods/entry/labelSupplier.js similarity index 89% rename from modules/entry/back/methods/entry/print.js rename to modules/entry/back/methods/entry/labelSupplier.js index b604adce6..32d80c427 100644 --- a/modules/entry/back/methods/entry/print.js +++ b/modules/entry/back/methods/entry/labelSupplier.js @@ -1,6 +1,6 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('print', { + Self.remoteMethodCtx('labelSupplier', { description: 'Print stickers of all entries', accessType: 'READ', accepts: [ @@ -28,13 +28,13 @@ module.exports = Self => { } ], http: { - path: '/:id/print', + path: '/:id/labelSupplier', verb: 'GET' }, accessScopes: ['DEFAULT', 'read:multimedia'] }); - Self.print = async function(ctx, id, options) { + Self.labelSupplier = async function(ctx, id, options) { const models = Self.app.models; const myOptions = {}; if (typeof options == 'object') @@ -49,7 +49,7 @@ module.exports = Self => { if (buy.stickers < 1) continue; ctx.args.id = buy.id; ctx.args.copies = buy.stickers; - const pdfBuffer = await models.Entry.buyLabel(ctx, myOptions); + const pdfBuffer = await models.Entry.buyLabelSupplier(ctx, myOptions); await merger.add(new Uint8Array(pdfBuffer[0])); } diff --git a/modules/entry/back/models/entry.js b/modules/entry/back/models/entry.js index 49c3d2ec3..dc5022ada 100644 --- a/modules/entry/back/models/entry.js +++ b/modules/entry/back/models/entry.js @@ -11,7 +11,7 @@ module.exports = Self => { require('../methods/entry/addFromPackaging')(Self); require('../methods/entry/addFromBuy')(Self); require('../methods/entry/buyLabel')(Self); - require('../methods/entry/print')(Self); + require('../methods/entry/labelSupplier')(Self); require('../methods/entry/buyLabelSupplier')(Self); Self.observe('before save', async function(ctx, options) { From 51d96a89c590ecd93ee41f3f589ca67a8f10b902 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 28 Nov 2024 11:15:58 +0100 Subject: [PATCH 08/16] fix: refs #7266 Increased size item id buy-label --- .../templates/reports/buy-label-barcode/assets/css/style.css | 4 +++- .../reports/buy-label-barcode/buy-label-barcode.html | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/print/templates/reports/buy-label-barcode/assets/css/style.css b/print/templates/reports/buy-label-barcode/assets/css/style.css index eece20acb..ce1924878 100644 --- a/print/templates/reports/buy-label-barcode/assets/css/style.css +++ b/print/templates/reports/buy-label-barcode/assets/css/style.css @@ -33,7 +33,9 @@ td { font-size: 26px; } .lg-txt { - font-size: 32px; + font-size: 40px; + padding: 0px; + line-height: 1; } .xl-txt { font-size: 50px; diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.html b/print/templates/reports/buy-label-barcode/buy-label-barcode.html index c1725f5c0..ebddb60ec 100644 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.html +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.html @@ -36,12 +36,12 @@ - +
{{formatNumber(buy.itemFk)}}
- +
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
From 00e5f8602064fe6c9ecf49d829ab9ecf97aeea37 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 28 Nov 2024 11:18:09 +0100 Subject: [PATCH 09/16] fix: refs #7404 add debug logging for cancelShipment and deleteExpeditions methods --- back/methods/mrw-config/cancelShipment.js | 4 ++-- modules/ticket/back/methods/expedition/deleteExpeditions.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 98aa8be39..608797d8f 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -30,6 +30,8 @@ module.exports = Self => { const clientType = await models.MrwConfig.getClientType(expeditionFk); const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8'); const renderedXml = ejs.render(template, {mrw, externalId, clientType}); + + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]); const response = await axios.post(mrw.url, renderedXml, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' @@ -40,8 +42,6 @@ module.exports = Self => { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]); - const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; return result.toLowerCase().includes('se ha cancelado correctamente'); }; diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js index 75993a485..ff4a2bbad 100644 --- a/modules/ticket/back/methods/expedition/deleteExpeditions.js +++ b/modules/ticket/back/methods/expedition/deleteExpeditions.js @@ -52,7 +52,8 @@ module.exports = Self => { const deletedExpedition = await models.Expedition.destroyById(expeditionId); deletedExpeditions.push(deletedExpedition); - } catch (e) { + } catch (error) { + await Self.rawSql('CALL util.debugAdd(?,?);', ['deleteExpeditions', error]); notDeletedExpeditions.push(expeditionId); } } From 5923916cda07176dc3e05f97eb2e5cf58f3e8e14 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 28 Nov 2024 11:31:38 +0100 Subject: [PATCH 10/16] fix: change debugAdd to console.error --- modules/ticket/back/methods/expedition/deleteExpeditions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/expedition/deleteExpeditions.js b/modules/ticket/back/methods/expedition/deleteExpeditions.js index ff4a2bbad..267811d25 100644 --- a/modules/ticket/back/methods/expedition/deleteExpeditions.js +++ b/modules/ticket/back/methods/expedition/deleteExpeditions.js @@ -53,7 +53,7 @@ module.exports = Self => { const deletedExpedition = await models.Expedition.destroyById(expeditionId); deletedExpeditions.push(deletedExpedition); } catch (error) { - await Self.rawSql('CALL util.debugAdd(?,?);', ['deleteExpeditions', error]); + console.error('error: ', error); notDeletedExpeditions.push(expeditionId); } } From e730b5d4a14a00b47e0993e558eb539230e321e7 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 28 Nov 2024 11:53:42 +0100 Subject: [PATCH 11/16] fix: add debugAdd response axios --- back/methods/mrw-config/cancelShipment.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 608797d8f..cd80fe4bb 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -42,6 +42,8 @@ module.exports = Self => { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlDoc]); + const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; return result.toLowerCase().includes('se ha cancelado correctamente'); }; From 6785779fe5338ca259d051792e4135909fa86ab0 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 28 Nov 2024 12:26:03 +0100 Subject: [PATCH 12/16] fix: add console log --- back/methods/mrw-config/cancelShipment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index cd80fe4bb..0e12909ba 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -42,7 +42,7 @@ module.exports = Self => { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlDoc]); + console.log('xmlDoc', xmlDoc); const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; return result.toLowerCase().includes('se ha cancelado correctamente'); From 838296e74463c9361c3280d9f1b8f50e00a7ff66 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 28 Nov 2024 13:02:58 +0100 Subject: [PATCH 13/16] fix: add expected message result --- back/methods/mrw-config/cancelShipment.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 0e12909ba..bd483fc58 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -24,7 +24,6 @@ module.exports = Self => { Self.cancelShipment = async expeditionFk => { const models = Self.app.models; - const mrw = await models.MrwConfig.findOne(); const {externalId} = await models.Expedition.findById(expeditionFk); const clientType = await models.MrwConfig.getClientType(expeditionFk); @@ -39,12 +38,11 @@ module.exports = Self => { }); const xmlString = response.data; + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlString]); const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - console.log('xmlDoc', xmlDoc); - const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; - return result.toLowerCase().includes('se ha cancelado correctamente'); + return ['no se ha encontrado', 'se ha cancelado correctamente'].some(r => r.includes(result.toLowerCase())); }; }; From d6a849727e0b5dc4a60266ec5b00fb48eb20c8e4 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 28 Nov 2024 13:11:43 +0100 Subject: [PATCH 14/16] fix: fix result test --- back/methods/mrw-config/cancelShipment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index bd483fc58..e96d6d694 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -43,6 +43,6 @@ module.exports = Self => { const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; - return ['no se ha encontrado', 'se ha cancelado correctamente'].some(r => r.includes(result.toLowerCase())); + return ['no se ha encontrado', 'se ha cancelado correctamente'].some(res => result.toLowerCase().includes(res)); }; }; From 009b4ab7b9171f48f1c12a4efa526e71740e7a14 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 29 Nov 2024 11:31:31 +0100 Subject: [PATCH 15/16] fix: refs #7920 refs#7920 itemShelvingLogs --- modules/item/back/methods/item-shelving/getListItemNewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item-shelving/getListItemNewer.js b/modules/item/back/methods/item-shelving/getListItemNewer.js index 5c4ca277d..c806c0a7e 100644 --- a/modules/item/back/methods/item-shelving/getListItemNewer.js +++ b/modules/item/back/methods/item-shelving/getListItemNewer.js @@ -51,7 +51,7 @@ module.exports = Self => { JOIN vn.productionConfig pc WHERE sh.code = ? AND s.code = pc.sectorFromCode ), tItemInSector AS ( - SELECT is2.itemFk, is2.created, is2.shelvingFk + SELECT is2.itemFk, is2.created, sh.code FROM vn.itemShelving is2 JOIN vn.shelving sh ON sh.id = is2.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk @@ -59,7 +59,7 @@ module.exports = Self => { JOIN vn.productionConfig pc WHERE sh.code <> ? AND s.code = pc.sectorFromCode) - SELECT ti.itemFK, tis.shelvingFk + SELECT ti.itemFK, tis.code shelvingFk FROM tItemShelving ti JOIN tItemInSector tis ON tis.itemFk = ti.itemFk JOIN vn.productionConfig pc From a17e434df1068c8333bb3ab080d3e160f20b1542 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 06:59:01 +0100 Subject: [PATCH 16/16] fix: refs #7266 Buy label barcode, minor barcode width --- print/templates/reports/buy-label-barcode/buy-label-barcode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/buy-label-barcode/buy-label-barcode.js b/print/templates/reports/buy-label-barcode/buy-label-barcode.js index a0359acc9..37b618f09 100755 --- a/print/templates/reports/buy-label-barcode/buy-label-barcode.js +++ b/print/templates/reports/buy-label-barcode/buy-label-barcode.js @@ -20,7 +20,7 @@ module.exports = { xmlDocument: document, format: 'code128', displayValue: false, - width: 3.8, + width: 3.5, height: 75, margin: 0 });