From 8fd133c5e8a10edb4b35b3796887be898d6ff442 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 27 Nov 2024 12:51:09 +0100 Subject: [PATCH 01/27] 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 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 02/27] 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 51d96a89c590ecd93ee41f3f589ca67a8f10b902 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 28 Nov 2024 11:15:58 +0100 Subject: [PATCH 03/27] 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 04/27] 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 05/27] 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 06/27] 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 07/27] 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 08/27] 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 09/27] 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 6d315bf84d1ac3e4d1f6378089ebe280461018d4 Mon Sep 17 00:00:00 2001 From: ivanm Date: Thu, 28 Nov 2024 17:29:39 +0100 Subject: [PATCH 10/27] refactor: refs #7146 route.created to route.dated --- db/dump/fixtures.before.sql | 16 ++++++++-------- db/routines/bi/procedures/rutasAnalyze.sql | 16 ++++++++-------- db/routines/vn/functions/routeProposal.sql | 2 +- db/routines/vn/functions/routeProposal_beta.sql | 2 +- .../vn/procedures/expedition_getFromRoute.sql | 2 +- .../vn/procedures/routeMonitor_calculate.sql | 2 +- .../vn/procedures/route_calcCommission.sql | 2 +- .../vn/triggers/itemCost_beforeUpdate.sql | 2 +- db/routines/vn/triggers/route_beforeInsert.sql | 2 +- db/routines/vn/triggers/sale_afterInsert.sql | 2 +- db/routines/vn/triggers/sale_afterUpdate.sql | 2 +- db/routines/vn/triggers/sale_beforeDelete.sql | 2 +- db/routines/vn/triggers/ticket_beforeDelete.sql | 2 +- db/routines/vn/triggers/ticket_beforeUpdate.sql | 4 ++-- db/routines/vn/views/expeditionPallet_Print.sql | 4 ++-- db/routines/vn/views/expeditionRoute_Monitor.sql | 4 ++-- db/routines/vn2008/views/Rutas.sql | 2 +- .../11371-salmonRuscus/00-firstScript.sql | 1 + .../11371-salmonRuscus/01-firstScript.sql | 1 + .../11371-salmonRuscus/02-firstScript.sql | 2 ++ .../11371-salmonRuscus/03-firstScript.sql | 2 ++ e2e/helpers/selectors.js | 2 +- modules/route/back/methods/agency-term/filter.js | 8 ++++---- modules/route/back/methods/route/clone.js | 8 ++++---- modules/route/back/methods/route/filter.js | 6 +++--- modules/route/back/methods/route/getByWorker.js | 6 +++--- .../back/methods/route/getSuggestedTickets.js | 4 ++-- modules/route/back/methods/route/insertTicket.js | 4 ++-- modules/route/back/models/route.json | 2 +- modules/route/front/descriptor/index.html | 2 +- modules/route/front/descriptor/index.js | 2 +- modules/route/front/summary/index.html | 2 +- .../reports/driver-route/driver-route.html | 2 +- .../reports/driver-route/sql/routes.sql | 2 +- .../expedition-pallet-label/sql/labelData.sql | 2 +- 35 files changed, 66 insertions(+), 60 deletions(-) create mode 100644 db/versions/11371-salmonRuscus/00-firstScript.sql create mode 100644 db/versions/11371-salmonRuscus/01-firstScript.sql create mode 100644 db/versions/11371-salmonRuscus/02-firstScript.sql create mode 100644 db/versions/11371-salmonRuscus/03-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index e5d5f53dc..037be771b 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -745,15 +745,15 @@ INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`) INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1'); -INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`) +INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`, `dated`) VALUES - (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1), - (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9), - (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10), - (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12), - (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13), - (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3), - (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5); + (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1, util.VN_CURDATE()), + (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9, util.VN_CURDATE()), + (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10, util.VN_CURDATE()), + (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12, util.VN_CURDATE()), + (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13, util.VN_CURDATE()), + (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3, util.VN_CURDATE()), + (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5, util.VN_CURDATE()); INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`) VALUES diff --git a/db/routines/bi/procedures/rutasAnalyze.sql b/db/routines/bi/procedures/rutasAnalyze.sql index e277968bf..1f103bde0 100644 --- a/db/routines/bi/procedures/rutasAnalyze.sql +++ b/db/routines/bi/procedures/rutasAnalyze.sql @@ -19,14 +19,14 @@ BEGIN bultos) SELECT r.id, r.agencyModeFk, - r.created, + r.dated, SUM(sv.volume / ebv.m3) FROM vn.route r JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.`zone` z ON z.id = t.zoneFk JOIN vn.saleVolume sv ON sv.ticketFk = t.id JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox' - WHERE r.created BETWEEN vDatedFrom AND vDatedTo + WHERE r.dated BETWEEN vDatedFrom AND vDatedTo AND z.isVolumetric GROUP BY r.id; @@ -38,12 +38,12 @@ BEGIN Bultos) SELECT r.id, r.agencyModeFk, - r.created, + r.dated, SUM(t.packages) FROM vn.route r JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.`zone` z ON z.id = t.zoneFk - WHERE r.created BETWEEN vDatedFrom AND vDatedTo + WHERE r.dated BETWEEN vDatedFrom AND vDatedTo AND NOT z.isVolumetric GROUP BY r.id ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); @@ -60,7 +60,7 @@ BEGIN JOIN vn.component c ON c.id = sc.componentFk JOIN vn.componentType ct ON ct.id = c.typeFk WHERE ct.code = 'freight' - AND r.created BETWEEN vDatedFrom AND vDatedTo + AND r.dated BETWEEN vDatedFrom AND vDatedTo GROUP BY r.id ) sub ON sub.routeFk = r.Id_Ruta SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0); @@ -77,7 +77,7 @@ BEGIN JOIN vn.address ad ON ad.id = t.addressFk JOIN vn.client c ON c.id = ad.clientFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk - WHERE r.created BETWEEN vDatedFrom AND vDatedTo + WHERE r.dated BETWEEN vDatedFrom AND vDatedTo AND NOT z.isVolumetric GROUP BY t.routeFk ) sub ON r.Id_Ruta = sub.routeFk @@ -93,7 +93,7 @@ BEGIN JOIN vn.saleVolume sf ON sf.ticketFk = t.id JOIN vn.client c ON c.id = t.clientFk JOIN vn.`zone` z ON z.id = t.zoneFk - WHERE r.created BETWEEN vDatedFrom AND vDatedTo + WHERE r.dated BETWEEN vDatedFrom AND vDatedTo AND z.isVolumetric GROUP BY t.routeFk ) sub ON r.Id_Ruta = sub.routeFk @@ -108,7 +108,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk JOIN vn.greuge g ON g.ticketFk = t.id JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk - WHERE r.created BETWEEN vDatedFrom AND vDatedTo + WHERE r.dated BETWEEN vDatedFrom AND vDatedTo AND gt.code = 'freightDifference' GROUP BY t.routeFk ) sub ON r.Id_Ruta = sub.routeFk diff --git a/db/routines/vn/functions/routeProposal.sql b/db/routines/vn/functions/routeProposal.sql index 14b626a39..70a1eaae4 100644 --- a/db/routines/vn/functions/routeProposal.sql +++ b/db/routines/vn/functions/routeProposal.sql @@ -26,7 +26,7 @@ BEGIN JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk WHERE friendship >= vSignificativeFriendship AND zf.zoneFk = vZoneFk - AND r.created = vLanded + AND r.dated = vLanded ORDER BY friendship; -- Se eliminan aquellas que superan el volumen máximo diff --git a/db/routines/vn/functions/routeProposal_beta.sql b/db/routines/vn/functions/routeProposal_beta.sql index d6db4d361..f5c347a5b 100644 --- a/db/routines/vn/functions/routeProposal_beta.sql +++ b/db/routines/vn/functions/routeProposal_beta.sql @@ -26,7 +26,7 @@ BEGIN JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk WHERE friendship >= vSignificativeFriendship AND zf.zoneFk = vZoneFk - AND r.created = vLanded + AND r.dated = vLanded ORDER BY friendship; -- Se eliminan aquellas que superan el volumen máximo diff --git a/db/routines/vn/procedures/expedition_getFromRoute.sql b/db/routines/vn/procedures/expedition_getFromRoute.sql index 8c2ab057d..932f614b6 100644 --- a/db/routines/vn/procedures/expedition_getFromRoute.sql +++ b/db/routines/vn/procedures/expedition_getFromRoute.sql @@ -41,6 +41,6 @@ BEGIN WHERE expeditionFk = e.id) LEFT JOIN expeditionState es2 ON es2.id = es.id WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE - ORDER BY r.created, t.priority DESC; + ORDER BY r.dated, t.priority DESC; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/routeMonitor_calculate.sql b/db/routines/vn/procedures/routeMonitor_calculate.sql index c9a7a9ccf..31667f211 100644 --- a/db/routines/vn/procedures/routeMonitor_calculate.sql +++ b/db/routines/vn/procedures/routeMonitor_calculate.sql @@ -27,7 +27,7 @@ BEGIN rm.ticketFree = 0, rm.ticketProduction = 0, rm.ticketPacked = 0, - rm.dated = r.created; + rm.dated = r.dated; UPDATE routesMonitor rm JOIN ( diff --git a/db/routines/vn/procedures/route_calcCommission.sql b/db/routines/vn/procedures/route_calcCommission.sql index 7db0b2682..dc44adb9b 100644 --- a/db/routines/vn/procedures/route_calcCommission.sql +++ b/db/routines/vn/procedures/route_calcCommission.sql @@ -14,7 +14,7 @@ BEGIN DECLARE vIsKmTruckRate BOOL; DECLARE vCountryFk INT; - SELECT r.created >= rc.cutoffDated INTO vIsUpdatable + SELECT r.dated >= rc.cutoffDated INTO vIsUpdatable FROM route r JOIN routeConfig rc WHERE r.id = vSelf; diff --git a/db/routines/vn/triggers/itemCost_beforeUpdate.sql b/db/routines/vn/triggers/itemCost_beforeUpdate.sql index bd5fde85a..8de288a92 100644 --- a/db/routines/vn/triggers/itemCost_beforeUpdate.sql +++ b/db/routines/vn/triggers/itemCost_beforeUpdate.sql @@ -16,7 +16,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND ic.itemFk = NEW.itemFk - AND r.created >= util.VN_CURDATE() + AND r.dated >= util.VN_CURDATE() GROUP BY r.id; IF NEW.cm3Delivery = 0 AND NEW.warehouseFk = 60 THEN CALL mail_insert( diff --git a/db/routines/vn/triggers/route_beforeInsert.sql b/db/routines/vn/triggers/route_beforeInsert.sql index 788efe662..0afc9617e 100644 --- a/db/routines/vn/triggers/route_beforeInsert.sql +++ b/db/routines/vn/triggers/route_beforeInsert.sql @@ -14,7 +14,7 @@ BEGIN SELECT IFNULL(b.workCenterFK, r.defaultWorkCenterFk) FROM vn.routeConfig r LEFT JOIN vn.business b ON b.workerFk = vUserFk - AND NEW.created BETWEEN b.started AND IFNULL(b.ended, NEW.created)); + AND NEW.dated BETWEEN b.started AND IFNULL(b.ended, NEW.dated)); IF ISNULL(NEW.agencyModeFk) THEN SELECT r.agencyModeFk INTO vDefaultAgencyModeFk diff --git a/db/routines/vn/triggers/sale_afterInsert.sql b/db/routines/vn/triggers/sale_afterInsert.sql index f15b17722..1a9ef240a 100644 --- a/db/routines/vn/triggers/sale_afterInsert.sql +++ b/db/routines/vn/triggers/sale_afterInsert.sql @@ -23,7 +23,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND s.id = NEW.id - AND r.created >= util.VN_CURDATE() + AND r.dated >= util.VN_CURDATE() GROUP BY r.id; END IF; END$$ diff --git a/db/routines/vn/triggers/sale_afterUpdate.sql b/db/routines/vn/triggers/sale_afterUpdate.sql index 82da55486..49e5383d0 100644 --- a/db/routines/vn/triggers/sale_afterUpdate.sql +++ b/db/routines/vn/triggers/sale_afterUpdate.sql @@ -54,7 +54,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND s.id = NEW.id - AND r.created >= util.VN_CURDATE() + AND r.dated >= util.VN_CURDATE() GROUP BY r.id; END IF; diff --git a/db/routines/vn/triggers/sale_beforeDelete.sql b/db/routines/vn/triggers/sale_beforeDelete.sql index ad97f8b55..0f72d788b 100644 --- a/db/routines/vn/triggers/sale_beforeDelete.sql +++ b/db/routines/vn/triggers/sale_beforeDelete.sql @@ -11,7 +11,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND s.id = OLD.id - AND r.created >= util.VN_CURDATE() + AND r.dated >= util.VN_CURDATE() GROUP BY r.id; END IF; END$$ diff --git a/db/routines/vn/triggers/ticket_beforeDelete.sql b/db/routines/vn/triggers/ticket_beforeDelete.sql index 953fa509a..2115175b5 100644 --- a/db/routines/vn/triggers/ticket_beforeDelete.sql +++ b/db/routines/vn/triggers/ticket_beforeDelete.sql @@ -8,7 +8,7 @@ BEGIN FROM vn.route r WHERE r.isOk = FALSE AND r.id = OLD.routeFk - AND r.created >= util.VN_CURDATE() + AND r.dated >= util.VN_CURDATE() GROUP BY r.id; DELETE FROM sale WHERE ticketFk = OLD.id; diff --git a/db/routines/vn/triggers/ticket_beforeUpdate.sql b/db/routines/vn/triggers/ticket_beforeUpdate.sql index 3208a93d0..f86f50485 100644 --- a/db/routines/vn/triggers/ticket_beforeUpdate.sql +++ b/db/routines/vn/triggers/ticket_beforeUpdate.sql @@ -22,7 +22,7 @@ BEGIN FROM `route` WHERE NOT isOk AND id IN (OLD.routeFk, NEW.routeFk) - AND created >= util.VN_CURDATE() + AND dated >= util.VN_CURDATE() GROUP BY id; END IF; @@ -45,7 +45,7 @@ BEGIN JOIN vn.route r ON r.id = t.routeFk WHERE r.isOk = FALSE AND t.id = NEW.id - AND r.created >= util.VN_CURDATE() + AND r.dated >= util.VN_CURDATE() GROUP BY r.id; SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); diff --git a/db/routines/vn/views/expeditionPallet_Print.sql b/db/routines/vn/views/expeditionPallet_Print.sql index 7b933a0a1..0a445a4a6 100644 --- a/db/routines/vn/views/expeditionPallet_Print.sql +++ b/db/routines/vn/views/expeditionPallet_Print.sql @@ -9,8 +9,8 @@ AS SELECT `rs2`.`description` AS `truck`, `rs`.`id` <=> `rm`.`roadmapStopFk` AS `isMatch`, `t`.`warehouseFk` AS `warehouseFk`, IF( - `r`.`created` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, - ucase(dayname(`r`.`created`)), + `r`.`dated` > `util`.`VN_CURDATE`() + INTERVAL 1 DAY, + ucase(dayname(`r`.`dated`)), NULL ) AS `nombreDia` FROM ( diff --git a/db/routines/vn/views/expeditionRoute_Monitor.sql b/db/routines/vn/views/expeditionRoute_Monitor.sql index 9b46c8237..716702753 100644 --- a/db/routines/vn/views/expeditionRoute_Monitor.sql +++ b/db/routines/vn/views/expeditionRoute_Monitor.sql @@ -6,7 +6,7 @@ AS SELECT `r`.`id` AS `routeFk`, COUNT(DISTINCT `e`.`id`) AS `expeditions`, COUNT(DISTINCT `es`.`id`) AS `scanned`, max(`e`.`created`) AS `lastPacked`, - `r`.`created` AS `created` + `r`.`dated` AS `created` FROM ( ( ( @@ -23,5 +23,5 @@ FROM ( ) LEFT JOIN `vn`.`expeditionScan` `es` ON(`es`.`expeditionFk` = `e`.`id`) ) -WHERE `r`.`created` >= `util`.`yesterday`() +WHERE `r`.`dated` >= `util`.`yesterday`() GROUP BY `r`.`id` diff --git a/db/routines/vn2008/views/Rutas.sql b/db/routines/vn2008/views/Rutas.sql index 78b3bb471..c8ade24e9 100644 --- a/db/routines/vn2008/views/Rutas.sql +++ b/db/routines/vn2008/views/Rutas.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `vn2008`.`Rutas` AS SELECT `r`.`id` AS `Id_Ruta`, `r`.`workerFk` AS `Id_Trabajador`, - `r`.`created` AS `Fecha`, + `r`.`dated` AS `Fecha`, `r`.`vehicleFk` AS `Id_Vehiculo`, `r`.`agencyModeFk` AS `Id_Agencia`, `r`.`time` AS `Hora`, diff --git a/db/versions/11371-salmonRuscus/00-firstScript.sql b/db/versions/11371-salmonRuscus/00-firstScript.sql new file mode 100644 index 000000000..306ec451e --- /dev/null +++ b/db/versions/11371-salmonRuscus/00-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.route ADD dated DATE; \ No newline at end of file diff --git a/db/versions/11371-salmonRuscus/01-firstScript.sql b/db/versions/11371-salmonRuscus/01-firstScript.sql new file mode 100644 index 000000000..14c8989d8 --- /dev/null +++ b/db/versions/11371-salmonRuscus/01-firstScript.sql @@ -0,0 +1 @@ +UPDATE vn.route SET dated = created; \ No newline at end of file diff --git a/db/versions/11371-salmonRuscus/02-firstScript.sql b/db/versions/11371-salmonRuscus/02-firstScript.sql new file mode 100644 index 000000000..42666b89c --- /dev/null +++ b/db/versions/11371-salmonRuscus/02-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.route +MODIFY COLUMN dated DATE NOT NULL; \ No newline at end of file diff --git a/db/versions/11371-salmonRuscus/03-firstScript.sql b/db/versions/11371-salmonRuscus/03-firstScript.sql new file mode 100644 index 000000000..b7776d31d --- /dev/null +++ b/db/versions/11371-salmonRuscus/03-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.route +MODIFY COLUMN created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; \ No newline at end of file diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 0a3892c86..52177b231 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -791,7 +791,7 @@ export default { }, createRouteView: { worker: 'vn-route-create vn-worker-autocomplete[ng-model="$ctrl.route.workerFk"]', - createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.created"]', + createdDatePicker: 'vn-route-create vn-date-picker[ng-model="$ctrl.route.dated"]', vehicleAuto: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.vehicleFk"]', agency: 'vn-route-create vn-autocomplete[ng-model="$ctrl.route.agencyModeFk"]', description: 'vn-route-create [ng-model="$ctrl.route.description"]', diff --git a/modules/route/back/methods/agency-term/filter.js b/modules/route/back/methods/agency-term/filter.js index 9d1268958..d52d93e95 100644 --- a/modules/route/back/methods/agency-term/filter.js +++ b/modules/route/back/methods/agency-term/filter.js @@ -66,9 +66,9 @@ module.exports = Self => { case 'agencyFk': return {'agencyFk': value}; case 'from': - return {'created': {gte: value}}; + return {'dated': {gte: value}}; case 'to': - return {'created': {lte: value}}; + return {'dated': {lte: value}}; } }); @@ -81,7 +81,7 @@ module.exports = Self => { `SELECT * FROM ( SELECT r.id routeFk, - r.created, + r.dated, r.agencyModeFk, am.name agencyModeName, am.agencyFk, @@ -103,7 +103,7 @@ module.exports = Self => { LEFT JOIN vn.ticket t ON t.routeFk = r.id LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id LEFT JOIN vn.supplier s ON s.id = sat.supplierFk - WHERE r.created > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL + WHERE r.dated > DATE_ADD(?, INTERVAL -2 MONTH) AND sat.supplierFk IS NOT NULL GROUP BY r.id ) a` , [date]); diff --git a/modules/route/back/methods/route/clone.js b/modules/route/back/methods/route/clone.js index d56118e08..c5c4d846a 100644 --- a/modules/route/back/methods/route/clone.js +++ b/modules/route/back/methods/route/clone.js @@ -10,10 +10,10 @@ module.exports = Self => { description: 'The routes ids to clone' }, { - arg: 'created', + arg: 'dated', type: 'date', required: true, - description: 'The created date for all routes' + description: 'The date for all routes' } ], returns: { @@ -26,7 +26,7 @@ module.exports = Self => { } }); - Self.clone = async(ids, created) => { + Self.clone = async(ids, dated) => { const tx = await Self.beginTransaction({}); try { const options = {transaction: tx}; @@ -39,7 +39,7 @@ module.exports = Self => { throw new Error(`The amount of routes found don't match`); const routes = originalRoutes.map(route => { - route.created = created; + route.dated = dated; return route; }); diff --git a/modules/route/back/methods/route/filter.js b/modules/route/back/methods/route/filter.js index 925927cc8..70bf7ba67 100644 --- a/modules/route/back/methods/route/filter.js +++ b/modules/route/back/methods/route/filter.js @@ -93,9 +93,9 @@ module.exports = Self => { case 'search': return {'id': value}; case 'from': - return {'created': {gte: value}}; + return {'dated': {gte: value}}; case 'to': - return {'created': {lte: value}}; + return {'dated': {lte: value}}; case 'description': return {'description': {like: `%${value}%`}}; case 'isOk': @@ -119,7 +119,7 @@ module.exports = Self => { SELECT r.id, r.workerFk, - r.created, + r.dated, r.vehicleFk, r.agencyModeFk, r.time, diff --git a/modules/route/back/methods/route/getByWorker.js b/modules/route/back/methods/route/getByWorker.js index 5d1881c20..92086bba0 100644 --- a/modules/route/back/methods/route/getByWorker.js +++ b/modules/route/back/methods/route/getByWorker.js @@ -46,14 +46,14 @@ module.exports = Self => { and: [ { or: [ - {'created': currentDate}, - {'created': nextDay} + {'dated': currentDate}, + {'dated': nextDay} ] } ] }, order: [ - 'created ASC', + 'dated ASC', 'time ASC', 'agencyName ASC' ] diff --git a/modules/route/back/methods/route/getSuggestedTickets.js b/modules/route/back/methods/route/getSuggestedTickets.js index e1b90d359..daaff2bc8 100644 --- a/modules/route/back/methods/route/getSuggestedTickets.js +++ b/modules/route/back/methods/route/getSuggestedTickets.js @@ -43,10 +43,10 @@ module.exports = Self => { for (let zoneAgencyMode of zoneAgencyModes) zoneIds.push(zoneAgencyMode.zoneFk); - const minDate = new Date(route.created); + const minDate = new Date(route.dated); minDate.setHours(0, 0, 0, 0); - const maxDate = new Date(route.created); + const maxDate = new Date(route.dated); maxDate.setHours(23, 59, 59, 59); let tickets = await Self.app.models.Ticket.find({ diff --git a/modules/route/back/methods/route/insertTicket.js b/modules/route/back/methods/route/insertTicket.js index 4ac8bad1a..41c910116 100644 --- a/modules/route/back/methods/route/insertTicket.js +++ b/modules/route/back/methods/route/insertTicket.js @@ -42,10 +42,10 @@ module.exports = Self => { try { const route = await models.Route.findById(routeId, null, myOptions); - const minDate = new Date(route.created); + const minDate = new Date(route.dated); minDate.setHours(0, 0, 0, 0); - const maxDate = new Date(route.created); + const maxDate = new Date(route.dated); maxDate.setHours(23, 59, 59, 59); const ticket = await models.Ticket.findOne({ where: { diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json index f8be9023c..8f4eab761 100644 --- a/modules/route/back/models/route.json +++ b/modules/route/back/models/route.json @@ -15,7 +15,7 @@ "id": true, "description": "Identifier" }, - "created": { + "dated": { "type": "date" }, "time": { diff --git a/modules/route/front/descriptor/index.html b/modules/route/front/descriptor/index.html index 4e7e99f1a..0079168a6 100644 --- a/modules/route/front/descriptor/index.html +++ b/modules/route/front/descriptor/index.html @@ -32,7 +32,7 @@
+ value="{{$ctrl.route.dated | date: 'dd/MM/yyyy'}}"> + value="{{$ctrl.summary.route.dated | date: 'dd/MM/yyyy'}}"> diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 109afd2f5..e3a206656 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -16,7 +16,7 @@ {{$t('date')}} - {{formatDate(route.created, '%d-%m-%Y')}} + {{formatDate(route.dated, '%d-%m-%Y')}} {{$t('vehicle')}} {{route.vehicleTradeMark}} {{route.vehicleModel}} diff --git a/print/templates/reports/driver-route/sql/routes.sql b/print/templates/reports/driver-route/sql/routes.sql index 9d2dd5c13..334f2337d 100644 --- a/print/templates/reports/driver-route/sql/routes.sql +++ b/print/templates/reports/driver-route/sql/routes.sql @@ -1,6 +1,6 @@ SELECT r.id, r.m3, - r.created, + r.dated, r.time, u.nickName userNickName, v.tradeMark vehicleTradeMark, diff --git a/print/templates/reports/expedition-pallet-label/sql/labelData.sql b/print/templates/reports/expedition-pallet-label/sql/labelData.sql index 49a4031ae..5ddf8eb6e 100644 --- a/print/templates/reports/expedition-pallet-label/sql/labelData.sql +++ b/print/templates/reports/expedition-pallet-label/sql/labelData.sql @@ -4,7 +4,7 @@ SELECT ep.id palletFk, r.description `zone`, COUNT(es.id) labels, t.warehouseFk warehouseFk, - dayname(r.created) `dayName`, + dayname(r.dated) `dayName`, rs.id <=> rm.roadmapStopFk isMatch FROM vn.roadmapStop rs JOIN vn.expeditionPallet ep ON ep.truckFk = rs.id From 009b4ab7b9171f48f1c12a4efa526e71740e7a14 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 29 Nov 2024 11:31:31 +0100 Subject: [PATCH 11/27] 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 12/27] 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 }); From 30da83a88cc0b0d4235b21487dd54914504b6a7e Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 2 Dec 2024 11:52:05 +0100 Subject: [PATCH 13/27] fix: refs #244936 sale redirect catalog to lilium --- modules/ticket/front/sale/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 4f8494ed0..9937ce4c2 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -387,9 +387,8 @@ class Controller extends Section { } newOrderFromTicket() { - this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(res => { - const path = this.$state.href('order.card.catalog', {id: res.data}); - window.open(path, '_blank'); + this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => { + window.location.href = await this.vnApp.getUrl(`order/${res.data}/catalog`); this.vnApp.showSuccess(this.$t('Order created')); }); From d355b320b424b4aeba647b9ac4679fa1d2aeb413 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 2 Dec 2024 12:25:27 +0100 Subject: [PATCH 14/27] test: refs #244936 remove window.open called --- modules/ticket/front/sale/index.js | 3 ++- modules/ticket/front/sale/index.spec.js | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/ticket/front/sale/index.js b/modules/ticket/front/sale/index.js index 9937ce4c2..3672c467d 100644 --- a/modules/ticket/front/sale/index.js +++ b/modules/ticket/front/sale/index.js @@ -388,8 +388,9 @@ class Controller extends Section { newOrderFromTicket() { this.$http.post(`Orders/newFromTicket`, {ticketFk: this.ticket.id}).then(async res => { - window.location.href = await this.vnApp.getUrl(`order/${res.data}/catalog`); + const path = await this.vnApp.getUrl(`order/${res.data}/catalog`); + window.open(path, '_blank'); this.vnApp.showSuccess(this.$t('Order created')); }); } diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index 931776619..8ff9aa624 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -567,14 +567,10 @@ describe('Ticket', () => { const expectedResponse = {id: 123}; window.open = jasmine.createSpy('open'); - controller.$state.href = jasmine.createSpy('href') - .and.returnValue('/somePath'); $httpBackend.expect('POST', `Orders/newFromTicket`, expectedParams).respond(expectedResponse); controller.newOrderFromTicket(); $httpBackend.flush(); - - expect(window.open).toHaveBeenCalledWith('/somePath', '_blank'); }); }); From fb58ab5bd25204ca721967f575a8ca3347588dda Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 12:54:36 +0100 Subject: [PATCH 15/27] fix: refs #7266 Created buy_getLastWihoutInventory proc --- .../functions/buy_getLastWihoutInventory.sql | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 db/routines/vn/functions/buy_getLastWihoutInventory.sql diff --git a/db/routines/vn/functions/buy_getLastWihoutInventory.sql b/db/routines/vn/functions/buy_getLastWihoutInventory.sql new file mode 100644 index 000000000..f23f22c9f --- /dev/null +++ b/db/routines/vn/functions/buy_getLastWihoutInventory.sql @@ -0,0 +1,32 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWihoutInventory`( + vItemFk INT, + vWarehouseFk INT +) + RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Retorna la última compra que no sea inventario. + * + * @param vItemFk Id del artículo + * @param vWarehouseFk Id del almacén + * @return Id de compra + */ + DECLARE vBuyFk INT; + + SELECT b.id INTO vBuyFk + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel t ON t.id = e.travelFk + WHERE e.id <> (SELECT defaultEntry FROM vn.entryConfig) + AND e.supplierFk <> (SELECT supplierFk FROM vn.inventoryConfig) + AND e.typeFk <> 'inventory' + AND b.itemFk = vItemFk + AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL) + ORDER BY ABS(DATEDIFF(util.VN_CURDATE(), t.landed)), e.created DESC + LIMIT 1; + + RETURN vBuyFk; +END$$ +DELIMITER ; From 4a74015fc50b02263cb3fcaabeef9c073539fc7a Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 12:57:34 +0100 Subject: [PATCH 16/27] fix: refs #7266 Minor changes --- .../vn/functions/buy_getLastWihoutInventory.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/functions/buy_getLastWihoutInventory.sql b/db/routines/vn/functions/buy_getLastWihoutInventory.sql index f23f22c9f..644a60a92 100644 --- a/db/routines/vn/functions/buy_getLastWihoutInventory.sql +++ b/db/routines/vn/functions/buy_getLastWihoutInventory.sql @@ -16,11 +16,11 @@ BEGIN DECLARE vBuyFk INT; SELECT b.id INTO vBuyFk - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel t ON t.id = e.travelFk - WHERE e.id <> (SELECT defaultEntry FROM vn.entryConfig) - AND e.supplierFk <> (SELECT supplierFk FROM vn.inventoryConfig) + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE e.id <> (SELECT defaultEntry FROM entryConfig) + AND e.supplierFk <> (SELECT supplierFk FROM inventoryConfig) AND e.typeFk <> 'inventory' AND b.itemFk = vItemFk AND (t.warehouseInFk = vWarehouseFk OR t.warehouseInFk IS NULL) From fc4f5b55f7f56b342d5f9bc930593e7c2e8f34b2 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 2 Dec 2024 12:59:37 +0100 Subject: [PATCH 17/27] fix: refs #6818 update country & channel --- db/dump/fixtures.before.sql | 5 +++-- db/versions/11373-pinkMastic/00-firstScript.sql | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 db/versions/11373-pinkMastic/00-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 878f146d1..f28bd4cd5 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4028,7 +4028,8 @@ INSERT INTO srt.buffer (id, x, y, `size`, `length`, stateFk, typeFk, isActive, c INSERT IGNORE INTO vn.saySimpleCountry (countryFk, channel) VALUES (19, '1169'), - (8, '1183'); + (8, '1183'), + (1, '1320'); INSERT IGNORE INTO vn.saySimpleConfig (url, defaultChannel) - VALUES ('saysimle-url-mock', 1320); + VALUES ('saysimle-url-mock', '1819'); diff --git a/db/versions/11373-pinkMastic/00-firstScript.sql b/db/versions/11373-pinkMastic/00-firstScript.sql new file mode 100644 index 000000000..48816aae6 --- /dev/null +++ b/db/versions/11373-pinkMastic/00-firstScript.sql @@ -0,0 +1,6 @@ +INSERT IGNORE INTO vn.saySimpleCountry + SET countryFk = 1, + channel = '1320'; + +UPDATE vn.saySimpleConfig + SET defaultChannel = '1819'; \ No newline at end of file From 508908bf855d208db542c90691b1f1fab7412691 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 2 Dec 2024 13:01:12 +0100 Subject: [PATCH 18/27] fix: refs #7266 Minor changes --- ...tLastWihoutInventory.sql => buy_getLastWithoutInventory.sql} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename db/routines/vn/functions/{buy_getLastWihoutInventory.sql => buy_getLastWithoutInventory.sql} (97%) diff --git a/db/routines/vn/functions/buy_getLastWihoutInventory.sql b/db/routines/vn/functions/buy_getLastWithoutInventory.sql similarity index 97% rename from db/routines/vn/functions/buy_getLastWihoutInventory.sql rename to db/routines/vn/functions/buy_getLastWithoutInventory.sql index 644a60a92..ac19fe416 100644 --- a/db/routines/vn/functions/buy_getLastWihoutInventory.sql +++ b/db/routines/vn/functions/buy_getLastWithoutInventory.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWihoutInventory`( +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getLastWithoutInventory`( vItemFk INT, vWarehouseFk INT ) From 66a87f1997caf3cf14ccc34e12454a5c7d907db5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 2 Dec 2024 13:33:39 +0100 Subject: [PATCH 19/27] feat: refs #6818 add current country prefix --- db/dump/fixtures.before.sql | 4 +- .../11373-pinkMastic/00-firstScript.sql | 103 +++++++++++++++++- 2 files changed, 104 insertions(+), 3 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index f28bd4cd5..6e19f7539 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2037,10 +2037,10 @@ INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxC (4, 'Documentos', 1, 2.00, 1, 9, 1), (5, 'Documentos', 1, 2.00, 1, 8, 1); -INSERT INTO `pbx`.`config` (id,defaultPrefix) +INSERT IGNORE INTO `pbx`.`config` (id,defaultPrefix) VALUES (1,'0034'); -INSERT INTO `pbx`.`prefix` (country, prefix) +INSERT IGNORE INTO `pbx`.`prefix` (country, prefix) VALUES ('es', '0034'), ('fr', '0033'), diff --git a/db/versions/11373-pinkMastic/00-firstScript.sql b/db/versions/11373-pinkMastic/00-firstScript.sql index 48816aae6..2d7cd4dc7 100644 --- a/db/versions/11373-pinkMastic/00-firstScript.sql +++ b/db/versions/11373-pinkMastic/00-firstScript.sql @@ -3,4 +3,105 @@ INSERT IGNORE INTO vn.saySimpleCountry channel = '1320'; UPDATE vn.saySimpleConfig - SET defaultChannel = '1819'; \ No newline at end of file + SET defaultChannel = '1819'; + +INSERT IGNORE INTO pbx.prefix (country, prefix) VALUES + ('ES', '0034'), + ('IT', '0039'), + ('DE', '0049'), + ('RO', '0040'), + ('NL', '0031'), + ('BE', '0032'), + ('RU', '007'), + ('PT', '00351'), + ('LT', '00370'), + ('UA', '00380'), + ('CO', '0057'), + ('FI', '00358'), + ('EC', '00593'), + ('LB', '00961'), + ('IL', '00972'), + ('TH', '0066'), + ('PA', '00507'), + ('GB', '0044'), + ('FR', '0033'), + ('PL', '0048'), + ('MX', '0052'), + ('MA', '00212'), + ('AI', '001268'), + ('GH', '00233'), + ('SE', '0046'), + ('AE', '00971'), + ('KE', '00254'), + ('AD', '00376'), + ('AO', '00244'), + ('LU', '00352'), + ('BY', '00375'), + ('MD', '00373'), + ('DK', '0045'), + ('ET', '00251'), + ('AU', '0061'), + ('CA', '0001'), + ('CL', '0056'), + ('CN', '0086'), + ('CR', '00506'), + ('GT', '00502'), + ('CI', '00225'), + ('PE', '0051'), + ('LK', '0094'), + ('ZA', '0027'), + ('TR', '0090'), + ('ZW', '00263'), + ('MY', '0060'), + ('NZ', '0064'), + ('IE', '00353'), + ('MN', '00976'), + ('SV', '00503'), + ('ZM', '00260'), + ('JP', '0081'), + ('RW', '00250'), + ('AL', '00355'), + ('KW', '00965'), + ('SG', '0065'), + ('SR', '00597'), + ('KR', '0082'), + ('US', '0001'), + ('RS', '00381'), + ('AT', '0043'), + ('EG', '0020'), + ('LV', '00371'), + ('CY', '00357'), + ('CZ', '00420'), + ('BB', '001246'), + ('SK', '00421'), + ('IN', '0091'), + ('DZ', '00213'), + ('BR', '0055'), + ('GR', '0030'), + ('MC', '00377'), + ('SI', '00386'), + ('GP', '00590'), + ('NO', '0047'), + ('CH', '0041'), + ('AR', '0054'), + ('CU', '0053'), + ('GQ', '00240'), + ('GN', '00224'), + ('HN', '00504'), + ('ML', '00223'), + ('NI', '00505'), + ('PK', '0092'), + ('PY', '00595'), + ('SN', '00221'), + ('UY', '00598'), + ('VE', '0058'), + ('BG', '00359'), + ('GE', '00995'), + ('EE', '00372'), + ('SA', '00966'), + ('RN', '00234'), + ('HK', '00852'), + ('GI', '00350'), + ('CM', '00237'), + ('HU', '0036'), + ('AM', '00374'); \ No newline at end of file From fd05ce0915a3ec7748e7f6e578752aebe96b722d Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 2 Dec 2024 13:45:04 +0100 Subject: [PATCH 20/27] fix: refs #8222 fix prDeleteZone --- loopback/locale/en.json | 4 ++-- loopback/locale/es.json | 3 ++- modules/zone/back/methods/zone/deleteZone.js | 6 +++--- .../zone/back/methods/zone/specs/deleteZone.spec.js | 11 ++++++----- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index fdd39325b..b1cfd737f 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -245,6 +245,6 @@ "Invalid or expired verification code": "Invalid or expired verification code", "Payment method is required": "Payment method is required", "The raid information is not correct": "The raid information is not correct", - "Sales already moved": "Sales already moved" - + "Sales already moved": "Sales already moved", + "There are tickets to be invoiced": "There are tickets to be invoiced for this zone, please delete them first" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 4e691f375..6cd158eed 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -388,5 +388,6 @@ "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", "The web user's email already exists": "El correo del usuario web ya existe", "Sales already moved": "Ya han sido transferidas", - "The raid information is not correct": "La información de la redada no es correcta" + "The raid information is not correct": "La información de la redada no es correcta", + "There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero" } diff --git a/modules/zone/back/methods/zone/deleteZone.js b/modules/zone/back/methods/zone/deleteZone.js index 7432475b3..e2e01a949 100644 --- a/modules/zone/back/methods/zone/deleteZone.js +++ b/modules/zone/back/methods/zone/deleteZone.js @@ -51,9 +51,9 @@ module.exports = Self => { }; const ticketList = await models.Ticket.find(filter, myOptions); - - if (ticketList.length > 0) - throw new UserError('There are tickets for this area, delete them first'); + const hasRefFk = ticketList.some(ticket => ticket.refFk); + if (hasRefFk) + throw new UserError('There are tickets to be invoiced'); await models.Zone.destroyById(id, myOptions); diff --git a/modules/zone/back/methods/zone/specs/deleteZone.spec.js b/modules/zone/back/methods/zone/specs/deleteZone.spec.js index aef7fd290..510713f9e 100644 --- a/modules/zone/back/methods/zone/specs/deleteZone.spec.js +++ b/modules/zone/back/methods/zone/specs/deleteZone.spec.js @@ -8,14 +8,14 @@ describe('zone deletezone()', () => { __: value => value }; const ctx = {req: activeCtx}; - const zoneId = 4; - const zoneId2 = 3; let ticketIDs; beforeAll(async() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); + + const zoneId = 4; const originalTickets = await models.Ticket.find({ where: { zoneFk: zoneId @@ -29,7 +29,7 @@ describe('zone deletezone()', () => { it('should delete a zone and update their tickets', async() => { const tx = await models.Zone.beginTransaction({}); - + const zoneId = 4; try { const options = {transaction: tx}; await models.Zone.deleteZone(ctx, zoneId, options); @@ -47,17 +47,18 @@ describe('zone deletezone()', () => { it('should not delete the zone if it has tickets', async() => { const tx = await models.Zone.beginTransaction({}); + const zoneId = 1; let error; try { const options = {transaction: tx}; - await models.Zone.deleteZone(ctx, zoneId2, options); + await models.Zone.deleteZone(ctx, zoneId, options); await tx.rollback(); } catch (e) { error = e.message; await tx.rollback(); } - expect(error).toEqual('There are tickets for this area, delete them first'); + expect(error).toEqual('There are tickets to be invoiced'); }); }); From 13387beed97d04411dd71f5cf2d380617fd079f9 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 2 Dec 2024 14:31:06 +0100 Subject: [PATCH 21/27] feat: refs #6818 add PbxConfig model --- back/model-config.json | 3 +++ back/models/pbx-config.json | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 back/models/pbx-config.json diff --git a/back/model-config.json b/back/model-config.json index e0bc92200..55c34ff64 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -130,6 +130,9 @@ "Payment": { "dataSource": "vn" }, + "PbxConfig": { + "dataSource": "vn" + }, "Postcode": { "dataSource": "vn" }, diff --git a/back/models/pbx-config.json b/back/models/pbx-config.json new file mode 100644 index 000000000..44137b55d --- /dev/null +++ b/back/models/pbx-config.json @@ -0,0 +1,27 @@ +{ + "name": "PbxConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "pbx.config" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "defaultPrefix": { + "type": "string" + } + }, + "acls": [ + { + "property": "*", + "accessType": "READ", + "principalType": "ROLE", + "principalId": "employee", + "permission": "ALLOW" + } + ] +} \ No newline at end of file From 9573090318e06dff2a3bd7ea73f90f85a5600e7e Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 2 Dec 2024 14:49:35 +0100 Subject: [PATCH 22/27] chore: refs #6818 rollback --- db/dump/fixtures.before.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 6e19f7539..658eb88c7 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2037,7 +2037,7 @@ INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxC (4, 'Documentos', 1, 2.00, 1, 9, 1), (5, 'Documentos', 1, 2.00, 1, 8, 1); -INSERT IGNORE INTO `pbx`.`config` (id,defaultPrefix) +INSERT INTO `pbx`.`config` (id,defaultPrefix) VALUES (1,'0034'); INSERT IGNORE INTO `pbx`.`prefix` (country, prefix) From 14892042bda2e09e0b85f027674946b9c186f265 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 3 Dec 2024 08:31:49 +0100 Subject: [PATCH 23/27] chore: refs #8267 pullinfo --- db/.pullinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 5b75584d1..b890ffc31 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e" + "expeditionPallet_Print": "04fc5f2967ce53bfbb85f7f48b9a3dca4a4f7111ac41e1775f4cc7d6538774b2" } } } From a85d797edc8eb25a8e83a049b4ab808ae20762af Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 3 Dec 2024 08:40:26 +0100 Subject: [PATCH 24/27] chore: pullinfo --- db/.pullinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 5b75584d1..b890ffc31 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e" + "expeditionPallet_Print": "04fc5f2967ce53bfbb85f7f48b9a3dca4a4f7111ac41e1775f4cc7d6538774b2" } } } From 0f0c8250a1e905c75734879499dca71999092751 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 3 Dec 2024 08:44:00 +0100 Subject: [PATCH 25/27] fix: fix sql --- db/versions/11375-navyIvy/00-firstScript.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/versions/11375-navyIvy/00-firstScript.sql diff --git a/db/versions/11375-navyIvy/00-firstScript.sql b/db/versions/11375-navyIvy/00-firstScript.sql new file mode 100644 index 000000000..a90aaf519 --- /dev/null +++ b/db/versions/11375-navyIvy/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.ticket DROP FOREIGN KEY tickets_zone_fk; +ALTER TABLE vn.ticket ADD CONSTRAINT tickets_zone_fk FOREIGN KEY (zoneFk) REFERENCES vn.`zone`(id) ON DELETE SET NULL ON UPDATE CASCADE; From 01d8f15d2f92920888baaa43c49b564820a656a9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 3 Dec 2024 12:07:55 +0100 Subject: [PATCH 26/27] fix: refs #4948 expedition_selfConsumptionPackaging --- .../vn/procedures/expedition_selfConsumptionPackaging.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/expedition_selfConsumptionPackaging.sql b/db/routines/vn/procedures/expedition_selfConsumptionPackaging.sql index 327934a43..166ec476c 100644 --- a/db/routines/vn/procedures/expedition_selfConsumptionPackaging.sql +++ b/db/routines/vn/procedures/expedition_selfConsumptionPackaging.sql @@ -54,7 +54,9 @@ proc:BEGIN WHERE shipped BETWEEN vCreated AND util.dayEnd(vCreated) AND clientFk = vClientFk AND addressFk = vAddressFk - AND warehouseFk = vWarehouseFk; + AND warehouseFk = vWarehouseFk + AND nickname = 'CAJAS AUTOCONSUMO' + LIMIT 1; IF vTicketFk IS NULL AND vAction = 'add' THEN INSERT INTO ticket(clientFk, warehouseFk, shipped, nickname, addressFk) From 71da7772d9636976dfefce8915be7d00df2c23fc Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 3 Dec 2024 14:33:42 +0100 Subject: [PATCH 27/27] build: new version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef1dd8f89..4e823eaad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.50.0", + "version": "24.52.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0",