From d0975f0acdb5bc289672218e747e7ee4c4ba585c Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 2 Nov 2023 16:25:25 +0100 Subject: [PATCH 001/250] ref #6276 operator_add --- db/changes/234601/00-newWareHouse.sql | 0 modules/worker/back/methods/operator/add.js | 21 +++++++++++++++++++++ modules/worker/back/models/operator.js | 4 +++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 db/changes/234601/00-newWareHouse.sql create mode 100644 modules/worker/back/methods/operator/add.js diff --git a/db/changes/234601/00-newWareHouse.sql b/db/changes/234601/00-newWareHouse.sql new file mode 100644 index 000000000..e69de29bb diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js new file mode 100644 index 000000000..65639ad01 --- /dev/null +++ b/modules/worker/back/methods/operator/add.js @@ -0,0 +1,21 @@ +module.exports = Self => { + Self.remoteMethodCtx('add', { + description: 'Add a new operator', + accessType: 'WRITE', + http: { + path: `/add`, + verb: 'POST' + } + }); + + Self.add = async ctx => { + const userId = ctx.req.accessToken.userId; + // He visto findOrCreate pero no funciona + const user = await Self.findById(userId); + if (!user) { + await Self.create({ + workerFk: userId + }); + } + }; +}; diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index db1ac7e49..442ac343f 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -1,4 +1,6 @@ -module.exports = function(Self) { +module.exports = Self => { + require('../methods/operator/add')(Self); + Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance; const models = Self.app.models; From 251578146edd44bd55b2c5489c0b12351738ec3f Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 21 Nov 2023 12:32:36 +0100 Subject: [PATCH 002/250] refs #6276 several methods created --- back/methods/collection/assignCollection.js | 28 + back/models/collection.js | 1 + db/changes/234601/00-newWareHouse.sql | 4 + db/dump/fixtures.sql | 669 ++++++++++++++++++ modules/item/back/methods/item/card.js | 52 ++ modules/item/back/models/item.js | 1 + .../methods/expedition-pallet/getPallet.js | 53 ++ .../ticket/back/models/expeditionPallet.js | 3 + .../ticket/back/models/expeditionPallet.json | 29 +- modules/worker/back/methods/operator/add.js | 1 - .../methods/operator/getAvailablePrinters.js | 39 + .../back/methods/operator/getPrinter.js | 39 + modules/worker/back/models/operator.js | 2 + 13 files changed, 913 insertions(+), 8 deletions(-) create mode 100644 back/methods/collection/assignCollection.js create mode 100644 modules/item/back/methods/item/card.js create mode 100644 modules/ticket/back/methods/expedition-pallet/getPallet.js create mode 100644 modules/ticket/back/models/expeditionPallet.js create mode 100644 modules/worker/back/methods/operator/getAvailablePrinters.js create mode 100644 modules/worker/back/methods/operator/getPrinter.js diff --git a/back/methods/collection/assignCollection.js b/back/methods/collection/assignCollection.js new file mode 100644 index 000000000..e63e6c1d0 --- /dev/null +++ b/back/methods/collection/assignCollection.js @@ -0,0 +1,28 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethodCtx('assignCollection', { + description: 'Assign a collection', + accessType: 'WRITE', + http: { + path: `/assignCollection`, + verb: 'POST' + }, + returns: { + type: ['object'], + }, + }); + + Self.assignCollection = async ctx => { + const userId = ctx.req.accessToken.userId; + + await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk)', [userId]); + + const [assignedCollection] = await Self.rawSql('SELECT @vCollectionFk'); + const {'@vCollectionFk': collectionFk} = assignedCollection; + + if (!collectionFk) throw new UserError('No hay tickets para sacar'); + await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk]); + + return collectionFk; + }; +}; diff --git a/back/models/collection.js b/back/models/collection.js index bfa906af6..28413743e 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -5,4 +5,5 @@ module.exports = Self => { require('../methods/collection/setSaleQuantity')(Self); require('../methods/collection/previousLabel')(Self); require('../methods/collection/getTickets')(Self); + require('../methods/collection/assignCollection')(Self); }; diff --git a/db/changes/234601/00-newWareHouse.sql b/db/changes/234601/00-newWareHouse.sql index e69de29bb..4a2344330 100644 --- a/db/changes/234601/00-newWareHouse.sql +++ b/db/changes/234601/00-newWareHouse.sql @@ -0,0 +1,4 @@ +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index fa204ddd5..6ef420526 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1218,6 +1218,7 @@ INSERT INTO `vn`.`train`(`id`, `name`) INSERT INTO `vn`.`operator` (`workerFk`, `numberOfWagons`, `trainFk`, `itemPackingTypeFk`, `warehouseFk`, `sectorFk`, `labelerFk`) VALUES ('1106', '1', '1', 'H', '1', '1', '1'), + ('9', '2', '1', 'H', '1', '1', '1'), ('1107', '1', '1', 'V', '1', '1', '1'); INSERT INTO `vn`.`collection`(`id`, `workerFk`, `stateFk`, `created`, `trainFk`) @@ -2996,3 +2997,671 @@ INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`) (1, 'Error in VAT calculation'), (2, 'Error in sales details'), (3, 'Error in customer data'); + + +/* + Se necesitan, para hacer un simulacro de pedido, lo siguiente: + + - Warehouse 999 + - Sectores + - Normal 9991 + - Previa 9992 + - Altillo 9993 + - Parkings + - Normal A-01-1, A-02-2, B-03-3, B-04-4, C-05-5 + - Previa P-01-1, P-02-2, P-03-3 + - Altillo M-01-1, M-02-2, M-03-3 + - Shelvings + - Normal NAA, NBB, NCC, NDD, NEE + - Previa PAA, PBB, PCC + - Altillo MAA, MBB, MCC + - Items + * Normal + * Previa: + - Ticket + - Sales + +*/ + +INSERT IGNORE INTO intrastat + SET id = 44219999, + description = 'Manufacturas de madera', + taxClassFk = 1, + taxCodeFk = 1; + +INSERT IGNORE INTO warehouse + SET id = 999, + name = 'TestingWarehouse', + hasAvailable = TRUE, + isForTicket = TRUE, + isInventory = TRUE, + hasUbications = TRUE, + hasProduction = TRUE; + +INSERT IGNORE INTO sector + SET id = 9991, + description = 'NormalSector', + warehouseFk = 999, + isPreviousPreparedByPacking = FALSE, + code = 'NS', + isPreviousPrepared = FALSE, + isPackagingArea = FALSE, + sonFk = NULL, + isMain = TRUE, + itemPackingTypeFk = NULL; + +INSERT IGNORE INTO sector + SET id = 9992, + description = 'PreviousSector', + warehouseFk = 999, + isPreviousPreparedByPacking = FALSE, + code = 'PS', + isPreviousPrepared = TRUE, + isPackagingArea = FALSE, + sonFk = NULL, + isMain = TRUE, + itemPackingTypeFk = NULL; + +INSERT IGNORE INTO sector + SET id = 9993, + description = 'MezaninneSector', + warehouseFk = 999, + isPreviousPreparedByPacking = TRUE, + code = 'MS', + isPreviousPrepared = FALSE, + isPackagingArea = FALSE, + sonFk = 9991, + isMain = TRUE, + itemPackingTypeFk = NULL; + +REPLACE parking SET id = 9991011, sectorFk = 9991, code = 'A-01-1', pickingOrder = 1; +REPLACE parking SET id = 9991012, sectorFk = 9991, code = 'A-02-2', pickingOrder = 2; +REPLACE parking SET id = 9991013, sectorFk = 9991, code = 'A-03-3', pickingOrder = 3; +REPLACE parking SET id = 9991014, sectorFk = 9991, code = 'A-04-4', pickingOrder = 4; +REPLACE parking SET id = 9991015, sectorFk = 9991, code = 'A-05-5', pickingOrder = 5; + +REPLACE parking SET id = 9992011, sectorFk = 9992, code = 'P-01-1', pickingOrder = 6; +REPLACE parking SET id = 9992012, sectorFk = 9992, code = 'P-02-2', pickingOrder = 7; +REPLACE parking SET id = 9992013, sectorFk = 9992, code = 'P-03-3', pickingOrder = 8; + +REPLACE parking SET id = 9993011, sectorFk = 9993, code = 'M-01-1', pickingOrder = 9; +REPLACE parking SET id = 9993012, sectorFk = 9993, code = 'M-02-2', pickingOrder = 10; +REPLACE parking SET id = 9993013, sectorFk = 9993, code = 'M-03-3', pickingOrder = 11; + +REPLACE shelving SET code = 'NAA', parkingFk = 9991011, priority = 1; +REPLACE shelving SET code = 'NBB', parkingFk = 9991012, priority = 1; +REPLACE shelving SET code = 'NCC', parkingFk = 9991013, priority = 1; +REPLACE shelving SET code = 'NDD', parkingFk = 9991014, priority = 1; +REPLACE shelving SET code = 'NEE', parkingFk = 9991015, priority = 1; + +REPLACE shelving SET code = 'PAA', parkingFk = 9992011, priority = 1; +REPLACE shelving SET code = 'PBB', parkingFk = 9992012, priority = 1; +REPLACE shelving SET code = 'PCC', parkingFk = 9992013, priority = 1; + +REPLACE shelving SET code = 'MAA', parkingFk = 9993011, priority = 1; +REPLACE shelving SET code = 'MBB', parkingFk = 9993012, priority = 1; +REPLACE shelving SET code = 'MCC', parkingFk = 9993013, priority = 1; + +INSERT IGNORE INTO itemType + SET id = 999, + code = 'WOO', + name = 'Wood Objects', + categoryFk = 3, + workerFk = 103, + isInventory = TRUE, + life = 10, + density = 250, + itemPackingTypeFk = NULL, + temperatureFk = 'warm'; + +INSERT IGNORE INTO travel + SET id = 99, + shipped = CURDATE(), + landed = CURDATE(), + warehouseInFk = 999, + warehouseOutFk = 1, + isReceived = TRUE, + agencyFk = 1; + +REPLACE entry + SET id = 999, + supplierFk = 791, + isConfirmed = TRUE, + dated = CURDATE(), + travelFk = 99, + companyFk = 442; + +REPLACE ticket + SET id = 999999, + clientFk = 2, + warehouseFk = 999, + shipped = CURDATE(), + nickname = 'Cliente', + addressFk = 1, + companyFk = 442, + agencyModeFk = 10, + landed = CURDATE(); + +REPLACE collection + SET id = 10101010, + workerFk = 103; + +INSERT IGNORE INTO ticketCollection + SET id = 10101010, + ticketFk = 999999, + collectionFk = 10101010; + +REPLACE item + SET id = 999991, + name = 'Palito para pinchos', + `size` = 25, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Palito para pinchos', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 6, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999991, + entryFk = 999, + itemFk = 999991, + quantity = 8, + buyingValue = 0.61, + stickers = 1, + packing = 20, + `grouping` = 1, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 50; + +REPLACE sale + SET id = 99991, + itemFk = 999991, + ticketFk = 999999, + concept = 'Palito para pinchos', + quantity = 3, + price = 1, + discount = 0; + +REPLACE item + SET id = 999992, + name = 'Madera verde', + `size` = 10, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Madera verde', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 50, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999992, + entryFk = 999, + itemFk = 999992, + quantity = 40, + buyingValue = 0.62, + stickers = 1, + packing = 40, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 25; + +REPLACE sale + SET id = 99992, + itemFk = 999992, + ticketFk = 999999, + concept = 'Madera Verde', + quantity = 10, + price = 1, + discount = 0; + +REPLACE item + SET id = 999993, + name = 'Madera Roja/Morada', + `size` = 12, + stems = 2, + category = 'EXT', + typeFk = 999, + longName = 'Madera Roja/Morada', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 35, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999993, + entryFk = 999, + itemFk = 999993, + quantity = 20, + buyingValue = 0.63, + stickers = 2, + packing = 10, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 25; + +REPLACE itemShelving + SET id = 9931, + itemFk = 999993, + shelvingFk = 'NCC', + visible = 10, + `grouping` = 5, + packing = 10; + +REPLACE sale + SET id = 99993, + itemFk = 999993, + ticketFk = 999999, + concept = 'Madera Roja/Morada', + quantity = 15, + price = 1, + discount = 0; + +REPLACE item + SET id = 999994, + name = 'Madera Naranja', + `size` = 18, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Madera Naranja', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 160, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999994, + entryFk = 999, + itemFk = 999994, + quantity = 20, + buyingValue = 0.64, + stickers = 1, + packing = 20, + `grouping` = 4, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 25; + +REPLACE sale + SET id = 99994, + itemFk = 999994, + ticketFk = 999999, + concept = 'Madera Naranja', + quantity = 4, + price = 1, + discount = 0; + +REPLACE item + SET id = 999995, + name = 'Madera Amarilla', + `size` = 11, + stems = 5, + category = 'EXT', + typeFk = 999, + longName = 'Madera Amarilla', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999995, + entryFk = 999, + itemFk = 999995, + quantity = 4, + buyingValue = 0.65, + stickers = 1, + packing = 20, + `grouping` = 1, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE sale + SET id = 99995, + itemFk = 999995, + ticketFk = 999999, + concept = 'Madera Amarilla', + quantity = 5, + price = 1, + discount = 0; + +-- Palito naranja +REPLACE item + SET id = 999998, + name = 'Palito naranja', + `size` = 11, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Palito naranja', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999998, + entryFk = 999, + itemFk = 999998, + quantity = 80, + buyingValue = 0.65, + stickers = 1, + packing = 200, + `grouping` = 30, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE sale + SET id = 99998, + itemFk = 999998, + ticketFk = 999999, + concept = 'Palito naranja', + quantity = 60, + price = 1, + discount = 0; + +-- Palito amarillo +REPLACE item + SET id = 999999, + name = 'Palito amarillo', + `size` = 11, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Palito amarillo', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999999, + entryFk = 999, + itemFk = 999999, + quantity = 70, + buyingValue = 0.65, + stickers = 1, + packing = 500, + `grouping` = 10, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE sale + SET id = 99999, + itemFk = 999999, + ticketFk = 999999, + concept = 'Palito amarillo', + quantity = 50, + price = 1, + discount = 0; + +-- Palito azul +REPLACE item + SET id = 1000000, + name = 'Palito azul', + `size` = 10, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Palito azul', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE buy + SET id = 10000000, + entryFk = 999, + itemFk = 1000000, + quantity = 75, + buyingValue = 0.65, + stickers = 2, + packing = 300, + `grouping` = 50, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE sale + SET id = 100000, + itemFk = 1000000, + ticketFk = 999999, + concept = 'Palito azul', + quantity = 50, + price = 1, + discount = 0; + +-- Palito rojo +REPLACE item + SET id = 1000001, + name = 'Palito rojo', + `size` = 10, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Palito rojo', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE buy + SET id = 10000001, + entryFk = 999, + itemFk = 1000001, + quantity = 12, + buyingValue = 0.65, + stickers = 2, + packing = 50, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + + +REPLACE sale + SET id = 100001, + itemFk = 1000001, + ticketFk = 999999, + concept = 'Palito rojo', + quantity = 10, + price = 1, + discount = 0; + +-- Previa +INSERT IGNORE INTO item + SET id = 999996, + name = 'Bolas de madera', + `size` = 2, + stems = 4, + category = 'EXT', + typeFk = 999, + longName = 'Bolas de madera', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 20, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999996, + entryFk = 999, + itemFk = 999996, + quantity = 5, + buyingValue = 3, + stickers = 1, + packing = 5, + `grouping` = 2, + groupingMode = 1, + packageFk = 94, + price1 = 7, + price2 = 7, + price3 = 7, + minPrice = 7, + weight = 80; + +REPLACE sale + SET id = 99996, + itemFk = 999996, + ticketFk = 999999, + concept = 'Bolas de madera', + quantity = 4, + price = 7, + discount = 0, + isPicked = TRUE; + +INSERT IGNORE INTO item + SET id = 999997, + name = 'Palitos de polo MIX', + `size` = 14, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Palitos de polo MIX', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 20, + intrastatFk = 44219999; + +REPLACE buy + SET id = 9999997, + entryFk = 999, + itemFk = 999997, + quantity = 100, + buyingValue = 3.2, + stickers = 1, + packing = 100, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 7, + price2 = 7, + price3 = 7, + minPrice = 7, + weight = 80; + +REPLACE sale + SET id = 99997, + itemFk = 999997, + ticketFk = 999999, + concept = 'Palitos de polo MIX', + quantity = 5, + price = 7, + discount = 0; + +-- Ubicación +DELETE ish.* + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + JOIN sector s ON s.id = p.sectorFk + JOIN warehouse w ON w.id = s.warehouseFk + WHERE w.name = 'TestingWarehouse'; + +REPLACE vn.itemShelving +(id, itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) +VALUES + (9911, 999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL), + (9912, 999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL), + (9913, 1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL), + (9914, 1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL), + (9915, 999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL), + (9916, 999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL), + (9917, 999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL), + (9918, 999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL), + (9919, 999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL), + (9920, 999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL), + (9921, 999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL), + (9922, 1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL), + (9923, 999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL), + (9924, 1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL), + (9925, 999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL), + (9926, 999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL); + +-- Previous for Bolas de madera +INSERT IGNORE INTO sectorCollection + SET id = 99, + userFk = 1, + sectorFk = 9992; + +INSERT IGNORE INTO saleGroup + SET id = 999, + userFk = 1, + parkingFk = 9992011, + sectorFk = 9992; + +INSERT IGNORE INTO sectorCollectionSaleGroup + SET id = 9999, + sectorCollectionFk = 99, + saleGroupFk = 999; + +REPLACE saleGroupDetail + SET id = 99991, + saleFk = 99996, + saleGroupFk = 999; + +REPLACE saleTracking + SET saleFk = 99996, + isChecked = TRUE, + workerFk = 103, + stateFk = 28; + +INSERT IGNORE INTO itemShelvingSale + SET id = 991, + itemShelvingFk = 9962, + saleFk = 99996, + quantity = 5, + userFk = 1; + + +CALL itemShelvingSale_reserveByCollection(10101010); + +UPDATE vn.collection + SET workerFk=9 + WHERE id=10101010; diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js new file mode 100644 index 000000000..6d861b394 --- /dev/null +++ b/modules/item/back/methods/item/card.js @@ -0,0 +1,52 @@ +module.exports = Self => { + Self.remoteMethod('card', { + description: 'Idk', + accessType: 'READ', + http: { + path: `/card`, + verb: 'GET' + }, + accepts: [ + { + arg: 'itemFk', + type: 'number', + required: true, + }, + { + arg: 'warehouseFk', + type: 'number', + required: true, + } + ], + returns: { + type: ['object'], + root: true + }, + }); + + Self.card = async(itemFk, warehouseFk) => { + const models = Self.app.models; + + const [result] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]); + + const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk]); + const realIdItems = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); + + const barcodes = await models.ItemBarcode.find({ + fields: ['code'], + where: { + realIdItem: { + inq: realIdItems + } + } + }); + + let itemInfo; + if (result.length) { + itemInfo = {...result[0]}; + itemInfo.barcodes = barcodes.map(barcode => barcode.code); + } + + return itemInfo; + }; +}; diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index eac1ecb7d..17c7a59f1 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -17,6 +17,7 @@ module.exports = Self => { require('../methods/item/buyerWasteEmail')(Self); require('../methods/item/labelPdf')(Self); require('../methods/item/setVisibleDiscard')(Self); + require('../methods/item/card')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); diff --git a/modules/ticket/back/methods/expedition-pallet/getPallet.js b/modules/ticket/back/methods/expedition-pallet/getPallet.js new file mode 100644 index 000000000..09775a6fa --- /dev/null +++ b/modules/ticket/back/methods/expedition-pallet/getPallet.js @@ -0,0 +1,53 @@ + +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethod('getPallet', { + description: 'Get pallet', + accessType: 'READ', + accepts: [ + { + arg: 'expeditionFk', + type: 'integer', + }, + ], + http: { + path: `/getPallet`, + verb: 'GET' + }, + returns: { + type: 'object', + }, + }); + + Self.getPallet = async expeditionFk => { + try { + const pallet = await Self.findOne({ + fields: ['truckFk'], + where: { + id: expeditionFk + }, + include: [ + { + relation: 'expeditionTruck', + scope: { + fields: ['eta', 'description'] + } + } + ], + }); + + if (pallet) { + const truck = pallet.expeditionTruck(); + return { + truckFk: pallet.truckFk, + eta: truck.eta, + description: truck.description + }; + } + + throw new UserError('palletDoesNotExist'); + } catch (e) { + return {message: e.message}; + } + }; +}; diff --git a/modules/ticket/back/models/expeditionPallet.js b/modules/ticket/back/models/expeditionPallet.js new file mode 100644 index 000000000..f41ad7712 --- /dev/null +++ b/modules/ticket/back/models/expeditionPallet.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + require('../methods/expedition-pallet/getPallet')(Self); +}; diff --git a/modules/ticket/back/models/expeditionPallet.json b/modules/ticket/back/models/expeditionPallet.json index c5a38df75..7cb4e1e6d 100644 --- a/modules/ticket/back/models/expeditionPallet.json +++ b/modules/ticket/back/models/expeditionPallet.json @@ -1,5 +1,6 @@ { "name": "ExpeditionPallet", + "base": "VnModel", "options": { "mysql": { "table": "expeditionPallet" @@ -10,13 +11,27 @@ "type": "number", "id": true, "description": "Identifier" - } + }, + "truckFk": { + "type": "number" + }, + "built": { + "type": "date" + }, + "position": { + "type": "number" + }, + "isPrint": { + "type": "number" + } }, - "acls": [{ - "accessType": "WRITE", - "principalType": "ROLE", - "principalId": "production", - "permission": "ALLOW" - }] + "relations": { + "expeditionTruck": { + "type": "belongsTo", + "model": "ExpeditionTruck", + "foreignKey": "truckFk" + } + } + } diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js index 65639ad01..eaf74e7b4 100644 --- a/modules/worker/back/methods/operator/add.js +++ b/modules/worker/back/methods/operator/add.js @@ -10,7 +10,6 @@ module.exports = Self => { Self.add = async ctx => { const userId = ctx.req.accessToken.userId; - // He visto findOrCreate pero no funciona const user = await Self.findById(userId); if (!user) { await Self.create({ diff --git a/modules/worker/back/methods/operator/getAvailablePrinters.js b/modules/worker/back/methods/operator/getAvailablePrinters.js new file mode 100644 index 000000000..2e787da2b --- /dev/null +++ b/modules/worker/back/methods/operator/getAvailablePrinters.js @@ -0,0 +1,39 @@ +module.exports = Self => { + Self.remoteMethodCtx('getAvailablePrinters', { + description: 'Retrieve available printers for an user', + accessType: 'READ', + http: { + path: `/getAvailabePrinters`, + verb: 'GET' + }, + returns: { + type: ['object'], + }, + }); + + Self.getAvailablePrinters = async ctx => { + const userId = ctx.req.accessToken.userId; + + const operators = await Self.find({ + fields: [], + where: { + workerFk: userId, + }, + + include: { + relation: 'printer', + scope: { + fields: ['id', 'name'] + }, + where: { + isLabeler: {neq: 0} + } + } + }); + if (operators.length) { + return operators.map(operator => { + return operator.printer(); + }); + } + }; +}; diff --git a/modules/worker/back/methods/operator/getPrinter.js b/modules/worker/back/methods/operator/getPrinter.js new file mode 100644 index 000000000..c46734517 --- /dev/null +++ b/modules/worker/back/methods/operator/getPrinter.js @@ -0,0 +1,39 @@ +module.exports = Self => { + Self.remoteMethodCtx('getPrinter', { + description: 'Gets user\'s printer', + accessType: 'READ', + http: { + path: `/getPrinter`, + verb: 'GET' + }, + returns: { + type: 'object', + }, + }); + + Self.getPrinter = async ctx => { + const userId = ctx.req.accessToken.userId; + + const operator = await Self.findOne({ + include: [ + { + relation: 'printer', + scope: { + fields: ['id', 'name'], + } + } + ], + where: { + workerFk: userId + } + }); + + if (operator) { + const printer = operator.printer(); + return { + id: printer.id, + name: printer.name + }; + } + }; +}; diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index 442ac343f..5e8870130 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -1,5 +1,7 @@ module.exports = Self => { require('../methods/operator/add')(Self); + require('../methods/operator/getPrinter')(Self); + require('../methods/operator/getAvailablePrinters')(Self); Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance; From fac6aab26c23e556e6b55e7138029d5424a25267 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 22 Nov 2023 14:25:19 +0100 Subject: [PATCH 003/250] refs #6276 machineWorker_update --- back/methods/machine-worker/updateMachine.js | 71 +++++++++++++++++++ back/model-config.json | 6 ++ back/models/machine-worker-config.json | 18 +++++ back/models/machine-worker.js | 3 + back/models/machine.json | 18 +++++ .../{234601 => 234801}/00-newWareHouse.sql | 6 +- 6 files changed, 121 insertions(+), 1 deletion(-) create mode 100644 back/methods/machine-worker/updateMachine.js create mode 100644 back/models/machine-worker-config.json create mode 100644 back/models/machine-worker.js create mode 100644 back/models/machine.json rename db/changes/{234601 => 234801}/00-newWareHouse.sql (60%) diff --git a/back/methods/machine-worker/updateMachine.js b/back/methods/machine-worker/updateMachine.js new file mode 100644 index 000000000..ac52a3f48 --- /dev/null +++ b/back/methods/machine-worker/updateMachine.js @@ -0,0 +1,71 @@ +module.exports = Self => { + Self.remoteMethodCtx('updateMachine', { + description: '', + accessType: 'WRITE', + accepts: [ + { + arg: 'plate', + type: 'string', + } + ], + returns: { + type: 'object', + root: true + }, + http: { + path: `/update-machine`, + verb: 'POST' + } + }); + + Self.updateMachine = async(ctx, plate, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + let insertState = false; + + const machine = await models.Machine.findOne({ + fields: ['id', 'plate'], + where: {plate} + }, myOptions); + + if (machine) { + const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); + + const machineWorker = await models.MachineWorker.findOne({ + where: { + workerFk: userId, + inTime: {gte: new Date(Date.now() - maxHours * 60 * 60 * 1000)}, + outTimed: null, + machineFk: machine.id, + } + + }); + if (machineWorker) { + await machineWorker.updateAttributes({ + inTime: new Date(Date.now()) + }, myOptions); + } + insertState = true; + } + + if (tx) await tx.commit(); + return insertState; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/back/model-config.json b/back/model-config.json index ebc0e321b..856167757 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -79,9 +79,15 @@ "Language": { "dataSource": "vn" }, + "Machine": { + "dataSource": "vn" + }, "MachineWorker": { "dataSource": "vn" }, + "MachineWorkerConfig": { + "dataSource": "vn" + }, "MobileAppVersionControl": { "dataSource": "vn" }, diff --git a/back/models/machine-worker-config.json b/back/models/machine-worker-config.json new file mode 100644 index 000000000..dfb77124e --- /dev/null +++ b/back/models/machine-worker-config.json @@ -0,0 +1,18 @@ +{ + "name": "MachineWorkerConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "vn.machineWorkerConfig" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "maxHours": { + "type": "number" + } + } +} diff --git a/back/models/machine-worker.js b/back/models/machine-worker.js new file mode 100644 index 000000000..324ca28a9 --- /dev/null +++ b/back/models/machine-worker.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/machine-worker/updateMachine')(Self); +}; diff --git a/back/models/machine.json b/back/models/machine.json new file mode 100644 index 000000000..7029091a2 --- /dev/null +++ b/back/models/machine.json @@ -0,0 +1,18 @@ +{ + "name": "Machine", + "base": "VnModel", + "options": { + "mysql": { + "table": "vn.machine" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "plate": { + "type": "string" + } + } +} diff --git a/db/changes/234601/00-newWareHouse.sql b/db/changes/234801/00-newWareHouse.sql similarity index 60% rename from db/changes/234601/00-newWareHouse.sql rename to db/changes/234801/00-newWareHouse.sql index 4a2344330..e55835563 100644 --- a/db/changes/234601/00-newWareHouse.sql +++ b/db/changes/234801/00-newWareHouse.sql @@ -1,4 +1,8 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file + ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('MachineWorker','updateMachine','WRITE','ALLOW','ROLE','employee'); + +INSERT INTO `vn`.`machineWorkerConfig` (id, maxHours) + VALUES (1, 12) \ No newline at end of file From f862ed7d8af3076ab15aa6000575e6611cb2d2a6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 23 Nov 2023 13:19:59 +0100 Subject: [PATCH 004/250] refs #6274 refactor updateInTime --- back/methods/machine-worker/updateInTime.js | 63 ++++++++++++++++ back/methods/machine-worker/updateMachine.js | 71 ------------------- back/models/machine-worker.js | 2 +- .../{234801 => 235001}/00-newWareHouse.sql | 5 +- db/dump/fixtures.sql | 3 + 5 files changed, 68 insertions(+), 76 deletions(-) create mode 100644 back/methods/machine-worker/updateInTime.js delete mode 100644 back/methods/machine-worker/updateMachine.js rename db/changes/{234801 => 235001}/00-newWareHouse.sql (64%) diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js new file mode 100644 index 000000000..b8e2becf2 --- /dev/null +++ b/back/methods/machine-worker/updateInTime.js @@ -0,0 +1,63 @@ +module.exports = Self => { + Self.remoteMethodCtx('updateInTime', { + description: '', + accessType: 'WRITE', + accepts: [ + { + arg: 'plate', + type: 'string', + } + ], + http: { + path: `/updateInTime`, + verb: 'POST' + } + }); + + Self.updateInTime = async(ctx, plate, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const machine = await models.Machine.findOne({ + fields: ['id', 'plate'], + where: {plate} + }, myOptions); + + if (!machine) throw new Error(`plate ${plate} does not exist`); + + const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); + + const machineWorker = await models.MachineWorker.findOne({ + where: { + workerFk: userId, + inTime: {gte: new Date(Date.now() - maxHours * 60 * 60 * 1000)}, + outTimed: null, + machineFk: machine.id, + } + + }); + if (machineWorker) { + await machineWorker.updateAttributes({ + inTime: new Date(Date.now()) + }, myOptions); + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/back/methods/machine-worker/updateMachine.js b/back/methods/machine-worker/updateMachine.js deleted file mode 100644 index ac52a3f48..000000000 --- a/back/methods/machine-worker/updateMachine.js +++ /dev/null @@ -1,71 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('updateMachine', { - description: '', - accessType: 'WRITE', - accepts: [ - { - arg: 'plate', - type: 'string', - } - ], - returns: { - type: 'object', - root: true - }, - http: { - path: `/update-machine`, - verb: 'POST' - } - }); - - Self.updateMachine = async(ctx, plate, options) => { - const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - - let tx; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - let insertState = false; - - const machine = await models.Machine.findOne({ - fields: ['id', 'plate'], - where: {plate} - }, myOptions); - - if (machine) { - const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); - - const machineWorker = await models.MachineWorker.findOne({ - where: { - workerFk: userId, - inTime: {gte: new Date(Date.now() - maxHours * 60 * 60 * 1000)}, - outTimed: null, - machineFk: machine.id, - } - - }); - if (machineWorker) { - await machineWorker.updateAttributes({ - inTime: new Date(Date.now()) - }, myOptions); - } - insertState = true; - } - - if (tx) await tx.commit(); - return insertState; - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }; -}; diff --git a/back/models/machine-worker.js b/back/models/machine-worker.js index 324ca28a9..cbc5fd53e 100644 --- a/back/models/machine-worker.js +++ b/back/models/machine-worker.js @@ -1,3 +1,3 @@ module.exports = Self => { - require('../methods/machine-worker/updateMachine')(Self); + require('../methods/machine-worker/updateInTime')(Self); }; diff --git a/db/changes/234801/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql similarity index 64% rename from db/changes/234801/00-newWareHouse.sql rename to db/changes/235001/00-newWareHouse.sql index e55835563..955088866 100644 --- a/db/changes/234801/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -2,7 +2,4 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp VALUES ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('MachineWorker','updateMachine','WRITE','ALLOW','ROLE','employee'); - -INSERT INTO `vn`.`machineWorkerConfig` (id, maxHours) - VALUES (1, 12) \ No newline at end of file + ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 39007fcc1..e8ae2f9a3 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3671,3 +3671,6 @@ CALL itemShelvingSale_reserveByCollection(10101010); UPDATE vn.collection SET workerFk=9 WHERE id=10101010; + +INSERT INTO `vn`.`machineWorkerConfig` (id, maxHours) + VALUES (1, 12) \ No newline at end of file From 273db31c059892b99e18c89468ac371166845a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Segarra=20Mart=C3=ADnez?= Date: Sat, 25 Nov 2023 21:11:06 +0100 Subject: [PATCH 005/250] refs #5858 feat: approach to print bad field in model --- loopback/locale/es.json | 28 ++- .../methods/client/body_model_validator.js | 41 ++++ .../back/methods/client/updateFiscalData.js | 196 ++++++++++-------- modules/client/back/models/client.js | 18 +- 4 files changed, 189 insertions(+), 94 deletions(-) create mode 100644 modules/client/back/methods/client/body_model_validator.js diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a4de6f997..76b0d955c 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,4 +1,5 @@ { + "postalcode": "Código postal", "Phone format is invalid": "El formato del teléfono no es correcto", "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", @@ -327,5 +328,28 @@ "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada", "User disabled": "Usuario desactivado", "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima", - "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima" -} + "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", + "provinceFk must be unique": "provinceFk must be unique", + "fi cannot be empty": "fi cannot be empty", + "countryFk cannot be empty": "countryFk cannot be empty", + "Model is not valid": "El campo \" {{key}}\" no es válido", + "postcode": "Código postal", + "fi": "NIF/CIF", + "socialName": "Razón social", + "street":"Dirección fiscal", + "city":"Población", + "countryFk":"País", + "provinceFk":"Provincia", + "sageTaxTypeFk":"Tipo de impuesto Sage", + "sageTransactionTypeFk":"Tipo de transacción Sage", + "transferorFk":"", + "hasToInvoiceByAddress":"", + "isFreezed":"", + "isVies":"", + "isToBeMailed":"", + "isEqualizated":"", + "isTaxDataVerified":"", + "despiteOfClient":"", + "hasIncoterms":"", + "hasElectronicInvoice":"" +} \ No newline at end of file diff --git a/modules/client/back/methods/client/body_model_validator.js b/modules/client/back/methods/client/body_model_validator.js new file mode 100644 index 000000000..c451608e6 --- /dev/null +++ b/modules/client/back/methods/client/body_model_validator.js @@ -0,0 +1,41 @@ + +const isNotNull = value => value !== null && value !== undefined && value !== ''; +const validatorBodyModel = (model, body) => { + let isValid = true; + let tag = null; + Object.entries(body).forEach(([key, value]) => { + if (!isValid) return; + const bodyArg = model.find(m => m.arg === key); + if (!bodyArg) throw new Error('Property is not defined in this model'); + const {type} = bodyArg; + tag = key; + if (tag !== 'any') { + isValid = isNotNull(value); + return; + } + + switch (type) { + case 'number': + isValid = /^[0-9]*$/.test(value); + break; + + case 'boolean': + isValid = value instanceof Boolean; + break; + + case 'date': + isValid = (new Date(date) !== 'Invalid Date') && !isNaN(new Date(date)); + break; + + case 'string': + isValid = typeof value == 'string'; + break; + + default: + break; + } + }); + return {isValid, tag}; +}; + +module.exports = validatorBodyModel; diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 5fd886c32..c3b92f6b1 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -1,4 +1,95 @@ let UserError = require('vn-loopback/util/user-error'); +const validatorBodyModel = require('./body_model_validator'); +const BODY_MODEL = [ + { + arg: 'socialName', + type: 'string' + }, + { + arg: 'fi', + type: 'string' + }, + { + arg: 'street', + type: 'string' + }, + { + arg: 'postcode', + type: 'string' + }, + { + arg: 'city', + type: 'string' + }, + { + arg: 'countryFk', + type: 'number' + }, + { + arg: 'provinceFk', + type: 'number' + }, + { + arg: 'sageTaxTypeFk', + type: 'any' + }, + { + arg: 'sageTransactionTypeFk', + type: 'any' + }, + { + arg: 'transferorFk', + type: 'any' + }, + { + arg: 'hasToInvoiceByAddress', + type: 'boolean' + }, + { + arg: 'hasToInvoice', + type: 'boolean' + }, + { + arg: 'isActive', + type: 'boolean' + }, + { + arg: 'isFreezed', + type: 'boolean' + }, + { + arg: 'isVies', + type: 'boolean' + }, + { + arg: 'isToBeMailed', + type: 'boolean' + }, + { + arg: 'isEqualizated', + type: 'boolean' + }, + { + arg: 'isTaxDataVerified', + type: 'boolean' + }, + { + arg: 'isTaxDataChecked', + type: 'boolean' + }, + { + arg: 'despiteOfClient', + type: 'number' + }, + { + arg: 'hasIncoterms', + type: 'boolean' + }, + { + arg: 'hasElectronicInvoice', + type: 'boolean' + } +]; module.exports = Self => { Self.remoteMethod('updateFiscalData', { @@ -17,92 +108,9 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'socialName', - type: 'string' - }, - { - arg: 'fi', - type: 'string' - }, - { - arg: 'street', - type: 'string' - }, - { - arg: 'postcode', - type: 'string' - }, - { - arg: 'city', - type: 'string' - }, - { - arg: 'countryFk', - type: 'number' - }, - { - arg: 'provinceFk', - type: 'number' - }, - { - arg: 'sageTaxTypeFk', - type: 'any' - }, - { - arg: 'sageTransactionTypeFk', - type: 'any' - }, - { - arg: 'transferorFk', - type: 'any' - }, - { - arg: 'hasToInvoiceByAddress', - type: 'boolean' - }, - { - arg: 'hasToInvoice', - type: 'boolean' - }, - { - arg: 'isActive', - type: 'boolean' - }, - { - arg: 'isFreezed', - type: 'boolean' - }, - { - arg: 'isVies', - type: 'boolean' - }, - { - arg: 'isToBeMailed', - type: 'boolean' - }, - { - arg: 'isEqualizated', - type: 'boolean' - }, - { - arg: 'isTaxDataVerified', - type: 'boolean' - }, - { - arg: 'isTaxDataChecked', - type: 'boolean' - }, - { - arg: 'despiteOfClient', - type: 'number' - }, - { - arg: 'hasIncoterms', - type: 'boolean' - }, - { - arg: 'hasElectronicInvoice', - type: 'boolean' + arg: 'data', + type: 'object', + http: {source: 'body'} } ], returns: { @@ -148,8 +156,22 @@ module.exports = Self => { // Remove unwanted properties delete args.ctx; delete args.id; + const {isValid, tag} = validatorBodyModel(BODY_MODEL, args.data); + if (!isValid) { + const key = $t(`${tag}`); + throw new Error($t('Model is not valid', {key}) + ); + } + // const isValid = client.isValid(async function(valid) { + // if (!valid) { + // cb(new ValidationError(client), client); + // return; + // } - const updatedClient = await client.updateAttributes(args, myOptions); + // // triggerSave(); + // }, args.data, myOptions); + // client.isValid(client.constructor.validations, client.data, {}); + const updatedClient = await client.updateAttributes(args.data, myOptions); if (tx) await tx.commit(); diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 72b702779..acb2780f8 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -10,18 +10,26 @@ module.exports = Self => { require('./client-methods')(Self); // Validations - + // Self.isValid(function(valid) { + // if (!valid) + // console.error(valid); // hash of errors {attr: [errmessage, errmessage, ...], attr: ...} + // }); Self.validatesPresenceOf('street', { message: 'Street cannot be empty' }); - Self.validatesPresenceOf('city', { - message: 'City cannot be empty' - }); - Self.validatesUniquenessOf('fi', { message: 'TIN must be unique' }); + Self.validatesPresenceOf('fi', { + message: 'fi cannot be empty' + }); + Self.validatesPresenceOf('provinceFk', { + message: 'fi cannot be empty' + }); + Self.validatesPresenceOf('countryFk', { + message: 'countryFk cannot be empty' + }); Self.validatesFormatOf('email', { message: 'Invalid email', From 626c000ebbe97e2480391963a47416dcd3cc2e3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Segarra=20Mart=C3=ADnez?= Date: Sat, 25 Nov 2023 21:13:50 +0100 Subject: [PATCH 006/250] refs #5878 perf: add translation --- loopback/locale/es.json | 1 + 1 file changed, 1 insertion(+) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 76b0d955c..9a08ef561 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -333,6 +333,7 @@ "fi cannot be empty": "fi cannot be empty", "countryFk cannot be empty": "countryFk cannot be empty", "Model is not valid": "El campo \" {{key}}\" no es válido", + "Property is not defined in this model": "La propiedad que ha modificado no existe", "postcode": "Código postal", "fi": "NIF/CIF", "socialName": "Razón social", From 8b3565d885017cd3d294fa059e736fc315266fd7 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 08:07:19 +0100 Subject: [PATCH 007/250] refs #5878 test: add new tests --- .../methods/client/body_model_validator.js | 3 +- .../client/specs/bodyValidator.spec.js | 284 ++++++++++++++++++ .../client/specs/createWithUser.spec.js | 3 +- modules/client/back/models/client.js | 14 +- 4 files changed, 289 insertions(+), 15 deletions(-) create mode 100644 modules/client/back/methods/client/specs/bodyValidator.spec.js diff --git a/modules/client/back/methods/client/body_model_validator.js b/modules/client/back/methods/client/body_model_validator.js index c451608e6..999c32024 100644 --- a/modules/client/back/methods/client/body_model_validator.js +++ b/modules/client/back/methods/client/body_model_validator.js @@ -6,7 +6,8 @@ const validatorBodyModel = (model, body) => { Object.entries(body).forEach(([key, value]) => { if (!isValid) return; const bodyArg = model.find(m => m.arg === key); - if (!bodyArg) throw new Error('Property is not defined in this model'); + if (!bodyArg) return; + // throw new Error(`Property ${key} is not defined in this model`); const {type} = bodyArg; tag = key; if (tag !== 'any') { diff --git a/modules/client/back/methods/client/specs/bodyValidator.spec.js b/modules/client/back/methods/client/specs/bodyValidator.spec.js new file mode 100644 index 000000000..716597f10 --- /dev/null +++ b/modules/client/back/methods/client/specs/bodyValidator.spec.js @@ -0,0 +1,284 @@ +const validatorBodyModel = require('../body_model_validator'); + +describe('Validation Client Create', () => { + const newAccount = { + userName: 'Deadpool', + email: 'Deadpool@marvel.com', + fi: '16195279J', + name: 'Wade', + socialName: 'DEADPOOL MARVEL', + street: 'WALL STREET', + city: 'New York', + businessTypeFk: 'florist', + provinceFk: 1 + }; + const CLIENT_MODEL = [ + { + arg: 'socialName', + type: 'string' + }, + { + arg: 'fi', + type: 'string' + }, + { + arg: 'street', + type: 'string' + }, + { + arg: 'postcode', + type: 'string' + }, + { + arg: 'city', + type: 'string' + }, + { + arg: 'countryFk', + type: 'number' + }, + { + arg: 'provinceFk', + type: 'number' + }, + { + arg: 'sageTaxTypeFk', + type: 'any' + }, + { + arg: 'sageTransactionTypeFk', + type: 'any' + }, + { + arg: 'transferorFk', + type: 'any' + }, + { + arg: 'hasToInvoiceByAddress', + type: 'boolean' + }, + { + arg: 'hasToInvoice', + type: 'boolean' + }, + { + arg: 'isActive', + type: 'boolean' + }, + { + arg: 'isFreezed', + type: 'boolean' + }, + { + arg: 'isVies', + type: 'boolean' + }, + { + arg: 'isToBeMailed', + type: 'boolean' + }, + { + arg: 'isEqualizated', + type: 'boolean' + }, + { + arg: 'isTaxDataVerified', + type: 'boolean' + }, + { + arg: 'isTaxDataChecked', + type: 'boolean' + }, + { + arg: 'despiteOfClient', + type: 'number' + }, + { + arg: 'hasIncoterms', + type: 'boolean' + }, + { + arg: 'hasElectronicInvoice', + type: 'boolean' + } + ]; + it(`should not find Deadpool as he's not created yet`, async() => { + let isValid = false; + + isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; + + expect(isValid).toBeTrue(); + }); + + it('should create a new account', async() => { + let isValid = false; + + isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; + + expect(isValid).toBeTrue(); + }); + + it('should not be able to create a user if exists', async() => { + let isValid = false; + let error; + + isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; + + expect(isValid).toBeTrue(); + }); +}); +fdescribe('Validation Worker Create', () => { + const defaultWorker = { + // fi: '78457139E', + // name: 'DEFAULTERWORKER', + // firstName: 'DEFAULT', + // lastNames: 'WORKER', + // email: 'defaultWorker@mydomain.com', + // street: 'S/ DEFAULTWORKERSTREET', + // city: 'defaultWorkerCity', + // provinceFk: 1, + // countryFk: 1, + // companyFk: 442, + // postcode: '46680', + // phone: '123456789', + // code: 'DWW', + // bossFk: 9, + // birth: '2022-12-11T23:00:00.000Z', + // payMethodFk: 1, + // roleFk: 1 + }; + const WORKER_MODEL =[ + { + arg: 'fi', + type: 'string', + description: `The worker fi`, + required: true, + }, + { + arg: 'name', + type: 'string', + description: `The user name`, + required: true, + }, + { + arg: 'firstName', + type: 'string', + description: `The worker firstname`, + required: true, + }, + { + arg: 'lastNames', + type: 'string', + description: `The worker lastnames`, + required: true, + }, + { + arg: 'email', + type: 'string', + description: `The worker email`, + required: true, + }, + { + arg: 'street', + type: 'string', + description: `The worker address`, + required: true, + }, + { + arg: 'city', + type: 'string', + description: `The worker city`, + required: true, + }, + { + arg: 'provinceFk', + type: 'number', + description: `The worker province`, + required: true, + }, + { + arg: 'companyFk', + type: 'number', + description: `The worker company`, + required: true, + }, + { + arg: 'postcode', + type: 'string', + description: `The worker postcode`, + required: true, + }, + { + arg: 'phone', + type: 'string', + description: `The worker phone`, + required: true, + }, + { + arg: 'code', + type: 'string', + description: `The worker code`, + required: true, + }, + { + arg: 'bossFk', + type: 'number', + description: `The worker boss`, + required: true, + }, + { + arg: 'birth', + type: 'date', + description: `The worker birth`, + required: true, + }, + { + arg: 'payMethodFk', + type: 'number', + description: `The client payMethod`, + required: true, + }, + { + arg: 'iban', + type: 'string', + description: `The client iban`, + }, + { + arg: 'bankEntityFk', + type: 'number', + description: `The client bank entity`, + } + ]; + + it(`should not find worker as he's not created yet`, async() => { + let isValid = false; + + isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; + + expect(isValid).toBeTrue(); + }); + + it('should create a new worker', async() => { + let isValid = false; + isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; + + expect(isValid).toBeTrue(); + }); + + it('should update a new worker', async() => { + let isValid = false; + + isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; + + expect(isValid).toBeTrue(); + }); + + it('should not be able to create a worker if exists', async() => { + let isValid = false; + let error; + + isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; + + expect(isValid).toBeTrue(); + }); +}); diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index 03106acc1..cae38ad8c 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -11,7 +11,8 @@ describe('Client Create', () => { street: 'WALL STREET', city: 'New York', businessTypeFk: 'florist', - provinceFk: 1 + provinceFk: 1, + countryFk: 1 }; beforeAll(async() => { diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index acb2780f8..666f5ed32 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -10,10 +10,7 @@ module.exports = Self => { require('./client-methods')(Self); // Validations - // Self.isValid(function(valid) { - // if (!valid) - // console.error(valid); // hash of errors {attr: [errmessage, errmessage, ...], attr: ...} - // }); + Self.validatesPresenceOf('street', { message: 'Street cannot be empty' }); @@ -21,15 +18,6 @@ module.exports = Self => { Self.validatesUniquenessOf('fi', { message: 'TIN must be unique' }); - Self.validatesPresenceOf('fi', { - message: 'fi cannot be empty' - }); - Self.validatesPresenceOf('provinceFk', { - message: 'fi cannot be empty' - }); - Self.validatesPresenceOf('countryFk', { - message: 'countryFk cannot be empty' - }); Self.validatesFormatOf('email', { message: 'Invalid email', From f8bf2e02dec378af7bfea77c12a5c5b0f479f49e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 08:12:00 +0100 Subject: [PATCH 008/250] refs #5878 test: fix --- loopback/locale/en.json | 12 +++++++++++- loopback/locale/es.json | 14 ++------------ .../methods/client/specs/createWithUser.spec.js | 3 +-- modules/client/back/models/client.js | 4 ++++ 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 949136459..634c04e03 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -197,5 +197,15 @@ "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", - "Try again": "Try again" + "Try again": "Try again", + "Property is not defined in this model": "La propiedad que ha modificado no existe", + "postcode": "Postcode", + "fi": "NIF/CIF", + "socialName": "Social name", + "street":"Street", + "city":"City", + "countryFk":"Country", + "provinceFk":"Province", + "sageTaxTypeFk":"Sage tax type", + "sageTransactionTypeFk":"Sage transaction type" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9a08ef561..d07071068 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -342,15 +342,5 @@ "countryFk":"País", "provinceFk":"Provincia", "sageTaxTypeFk":"Tipo de impuesto Sage", - "sageTransactionTypeFk":"Tipo de transacción Sage", - "transferorFk":"", - "hasToInvoiceByAddress":"", - "isFreezed":"", - "isVies":"", - "isToBeMailed":"", - "isEqualizated":"", - "isTaxDataVerified":"", - "despiteOfClient":"", - "hasIncoterms":"", - "hasElectronicInvoice":"" -} \ No newline at end of file + "sageTransactionTypeFk":"Tipo de transacción Sage" +} diff --git a/modules/client/back/methods/client/specs/createWithUser.spec.js b/modules/client/back/methods/client/specs/createWithUser.spec.js index cae38ad8c..03106acc1 100644 --- a/modules/client/back/methods/client/specs/createWithUser.spec.js +++ b/modules/client/back/methods/client/specs/createWithUser.spec.js @@ -11,8 +11,7 @@ describe('Client Create', () => { street: 'WALL STREET', city: 'New York', businessTypeFk: 'florist', - provinceFk: 1, - countryFk: 1 + provinceFk: 1 }; beforeAll(async() => { diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 666f5ed32..72b702779 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -15,6 +15,10 @@ module.exports = Self => { message: 'Street cannot be empty' }); + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); + Self.validatesUniquenessOf('fi', { message: 'TIN must be unique' }); From 3822183095f3d8a9761108e785264c8f57160a3a Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 10:46:36 +0100 Subject: [PATCH 009/250] refs #5878 test: improve bodyValidator fn --- .../client/specs/bodyValidator.spec.js | 134 +++++++++++++++++- 1 file changed, 132 insertions(+), 2 deletions(-) diff --git a/modules/client/back/methods/client/specs/bodyValidator.spec.js b/modules/client/back/methods/client/specs/bodyValidator.spec.js index 716597f10..f4c84975f 100644 --- a/modules/client/back/methods/client/specs/bodyValidator.spec.js +++ b/modules/client/back/methods/client/specs/bodyValidator.spec.js @@ -1,5 +1,136 @@ +/* eslint-disable jasmine/no-spec-dupes */ const validatorBodyModel = require('../body_model_validator'); +fdescribe('Validation Model', () => { + describe('should be number', () => { + it('success', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'number' + }], {property: 1}); + + expect(isValid).toBeTrue(); + }); + + it('fail', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'number' + + }], {property: null}); + + expect(isValid).toBeFalse(); + }); + }); + + describe('should be string', () => { + it('success as number', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'string' + + }], {property: '1234'}); + + expect(isValid).toBeTrue(); + }); + + it('success as string', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'string' + + }], {property: 'null'}); + + expect(isValid).toBeTrue(); + }); + + it('fail', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'string' + + }], {property: null}); + + expect(isValid).toBeFalse(); + }); + }); + + describe('should be date', () => { + it('success', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'date' + + }], {property: new Date()}); + + expect(isValid).toBeTrue(); + }); + + it('fail', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'date' + + }], {property: null}); + + expect(isValid).toBeFalse(); + }); + }); + + describe('should be boolean', () => { + it('success as true', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'boolean' + + }], {property: true}); + + expect(isValid).toBeTrue(); + }); + + it('success as false', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'boolean' + + }], {property: false}); + + expect(isValid).toBeTrue(); + }); + + it('fail', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'boolean' + + }], {property: null}); + + expect(isValid).toBeFalse(); + }); + }); + + describe('should be any', () => { + it('success', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'any' + + }], {property: '1234'}); + + expect(isValid).toBeTrue(); + }); + + it('fail', () => { + let {isValid} = validatorBodyModel([{ + arg: 'property', + type: 'any' + + }], {property: null}); + + expect(isValid).toBeFalse(); + }); + }); +}); describe('Validation Client Create', () => { const newAccount = { userName: 'Deadpool', @@ -120,7 +251,6 @@ describe('Validation Client Create', () => { it('should not be able to create a user if exists', async() => { let isValid = false; - let error; isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; @@ -147,7 +277,7 @@ fdescribe('Validation Worker Create', () => { // payMethodFk: 1, // roleFk: 1 }; - const WORKER_MODEL =[ + const WORKER_MODEL = [ { arg: 'fi', type: 'string', From 334c5f03a5e5ce83e1da625945891ee510f6f264 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 10:47:49 +0100 Subject: [PATCH 010/250] refs #5878 feat: validate params in supplier model --- .../back/methods/client/updateFiscalData.js | 4 +- .../back/methods/supplier/updateFiscalData.js | 137 ++++++++++-------- 2 files changed, 76 insertions(+), 65 deletions(-) diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index c3b92f6b1..c87eba6be 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -128,9 +128,7 @@ module.exports = Self => { let tx; const myOptions = {}; const models = Self.app.models; - const args = ctx.args; - const userId = ctx.req.accessToken.userId; - const $t = ctx.req.__; + const {args, req: {__: $t}} = ctx; if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index 271ed8769..c0f0be14c 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -1,3 +1,65 @@ +const validatorBodyModel = require('../../../../client/back/methods/client/body_model_validator'); + +const BODY_MODEL = [{ + arg: 'name', + type: 'string' +}, +{ + arg: 'nif', + type: 'string' +}, +{ + arg: 'account', + type: 'any' +}, +{ + arg: 'sageTaxTypeFk', + type: 'any' +}, +{ + arg: 'sageWithholdingFk', + type: 'any' +}, +{ + arg: 'sageTransactionTypeFk', + type: 'any' +}, +{ + arg: 'postCode', + type: 'any' +}, +{ + arg: 'street', + type: 'any' +}, +{ + arg: 'city', + type: 'string' +}, +{ + arg: 'provinceFk', + type: 'any' +}, +{ + arg: 'countryFk', + type: 'any' +}, +{ + arg: 'supplierActivityFk', + type: 'string' +}, +{ + arg: 'healthRegister', + type: 'string' +}, +{ + arg: 'isVies', + type: 'boolean' +}, +{ + arg: 'isTrucker', + type: 'boolean' +}]; module.exports = Self => { Self.remoteMethod('updateFiscalData', { description: 'Updates fiscal data of a supplier', @@ -14,65 +76,11 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'name', - type: 'string' - }, - { - arg: 'nif', - type: 'string' - }, - { - arg: 'account', - type: 'any' - }, - { - arg: 'sageTaxTypeFk', - type: 'any' - }, - { - arg: 'sageWithholdingFk', - type: 'any' - }, - { - arg: 'sageTransactionTypeFk', - type: 'any' - }, - { - arg: 'postCode', - type: 'any' - }, - { - arg: 'street', - type: 'any' - }, - { - arg: 'city', - type: 'string' - }, - { - arg: 'provinceFk', - type: 'any' - }, - { - arg: 'countryFk', - type: 'any' - }, - { - arg: 'supplierActivityFk', - type: 'string' - }, - { - arg: 'healthRegister', - type: 'string' - }, - { - arg: 'isVies', - type: 'boolean' - }, - { - arg: 'isTrucker', - type: 'boolean' - }], + arg: 'data', + type: 'object', + http: {source: 'body'} + } + ], returns: { arg: 'res', type: 'string', @@ -86,13 +94,18 @@ module.exports = Self => { Self.updateFiscalData = async(ctx, supplierId) => { const models = Self.app.models; - const args = ctx.args; + const {args} = ctx; const supplier = await models.Supplier.findById(supplierId); // Remove unwanted properties delete args.ctx; delete args.id; - - return supplier.updateAttributes(args); + const {isValid, tag} = validatorBodyModel(BODY_MODEL, args.data); + if (!isValid) { + const key = $t(`${tag}`); + throw new Error($t('Model is not valid', {key}) + ); + } + return supplier.updateAttributes(args.data); }; }; From aa5218fb1a2f259aef1bd3a23129a735e44d8ffc Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 15:06:39 +0100 Subject: [PATCH 011/250] refs #5878 feat: supplier translations --- loopback/locale/en.json | 8 +++++++- loopback/locale/es.json | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 634c04e03..90b6f4edd 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -200,12 +200,18 @@ "Try again": "Try again", "Property is not defined in this model": "La propiedad que ha modificado no existe", "postcode": "Postcode", + "postCode": "Postcode", "fi": "NIF/CIF", + "nif": "NIF/CIF", + "Account": "Account", "socialName": "Social name", "street":"Street", "city":"City", "countryFk":"Country", "provinceFk":"Province", + "supplierFk":"Supplier", + "healthRegister":"Health register", "sageTaxTypeFk":"Sage tax type", - "sageTransactionTypeFk":"Sage transaction type" + "sageTransactionTypeFk":"Sage transaction type", + "sageWithholdingFk": "Sage with holding" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d07071068..6ce4f72bc 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -335,12 +335,18 @@ "Model is not valid": "El campo \" {{key}}\" no es válido", "Property is not defined in this model": "La propiedad que ha modificado no existe", "postcode": "Código postal", + "postCode": "Código postal", "fi": "NIF/CIF", + "nif": "NIF/CIF", + "Account": "Cuenta", "socialName": "Razón social", "street":"Dirección fiscal", "city":"Población", "countryFk":"País", "provinceFk":"Provincia", + "supplierFk":"Actividad del proveedor", + "healthRegister":"Registro sanitario", "sageTaxTypeFk":"Tipo de impuesto Sage", - "sageTransactionTypeFk":"Tipo de transacción Sage" + "sageTransactionTypeFk":"Tipo de transacción Sage", + "sageWithholdingFk" : "Sage con tenencia" } From f09e249348b1fee96cabb7328bf09f1f8e6f98fd Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 15:06:55 +0100 Subject: [PATCH 012/250] refs #5878 feat: remove conditions --- modules/supplier/back/models/supplier.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index 5cf357c13..fbe74286a 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -17,17 +17,13 @@ module.exports = Self => { message: 'The social name cannot be empty' }); - if (this.city) { - Self.validatesPresenceOf('city', { - message: 'City cannot be empty' - }); - } + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); - if (this.nif) { - Self.validatesPresenceOf('nif', { - message: 'The nif cannot be empty' - }); - } + Self.validatesPresenceOf('nif', { + message: 'The nif cannot be empty' + }); Self.validatesUniquenessOf('nif', { message: 'TIN must be unique' From ce3da6841c9169de93214fbf1996038ccf98fec4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 27 Nov 2023 15:07:14 +0100 Subject: [PATCH 013/250] refs #5878 feat: new middleware to validate body --- loopback/server/middleware.json | 3 +- loopback/server/middleware/validate-model.js | 33 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 loopback/server/middleware/validate-model.js diff --git a/loopback/server/middleware.json b/loopback/server/middleware.json index 31a2f113b..f06395e89 100644 --- a/loopback/server/middleware.json +++ b/loopback/server/middleware.json @@ -35,11 +35,12 @@ } }, "auth:after": { + "./middleware/validate-model": {}, "./middleware/current-user": {}, "./middleware/salix-version": {} }, "parse": { - "body-parser#json":{} + "body-parser#json":{} }, "routes": { "loopback#rest": { diff --git a/loopback/server/middleware/validate-model.js b/loopback/server/middleware/validate-model.js new file mode 100644 index 000000000..7c1538190 --- /dev/null +++ b/loopback/server/middleware/validate-model.js @@ -0,0 +1,33 @@ +const {models} = require('vn-loopback/server/server'); +const validatorBodyModel = require('../../../modules/client/back/methods/client/body_model_validator'); +const makeSingular = s => { + if (s == null || s.length == 0) + return s; + + return s.substring(0, s.length - 1); +}; +function blobToB64(data) { + return new Uint8Array(data).reduce(function(data, byte) { + return data + String.fromCharCode(byte); + }, ''); +} +module.exports = function(options) { + return function(req, res, next) { + const {method, originalUrl} = req; + if (['GET', 'DELETE'].includes(method)) return next(); + let [module, id, path] = originalUrl.split('api/')[1].split('/'); + + let model = models[module]; + if (!model) { + module = makeSingular(module); + model = models[module]; + } + const properties = model.definition.rawProperties; + const data = JSON.parse(blobToB64(req.readableBuffer.tail.data)); + let isValid = validatorBodyModel(properties, data); + + if (!isValid.isValid) + next(); + return next(); + }; +}; From 877c6792733033ff568b98bc3c253dddfba6fce7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 29 Nov 2023 13:22:44 +0100 Subject: [PATCH 014/250] refs #6276 getVersion --- .../mobile-app-version-control/getVersion.js | 45 +++++++++++++++++++ back/models/mobile-app-version-control.js | 3 ++ back/models/mobile-app-version-control.json | 39 ++++++++++++++++ db/changes/235001/00-newWareHouse.sql | 3 +- modules/worker/back/model-config.json | 3 ++ .../worker/back/models/worker-app-tester.json | 22 +++++++++ 6 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 back/methods/mobile-app-version-control/getVersion.js create mode 100644 back/models/mobile-app-version-control.js create mode 100644 back/models/mobile-app-version-control.json create mode 100644 modules/worker/back/models/worker-app-tester.json diff --git a/back/methods/mobile-app-version-control/getVersion.js b/back/methods/mobile-app-version-control/getVersion.js new file mode 100644 index 000000000..510fd6c4a --- /dev/null +++ b/back/methods/mobile-app-version-control/getVersion.js @@ -0,0 +1,45 @@ +module.exports = Self => { + Self.remoteMethodCtx('getVersion', { + description: 'gets app version data', + accessType: 'READ', + accepts: [{ + arg: 'app', + type: 'string', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getVersion`, + verb: 'GET' + } + }); + + Self.getVersion = async(ctx, app) => { + const {models} = Self.app; + const userId = ctx.req.accessToken.userId; + + const workerFk = await models.WorkerAppTester.findOne({ + where: { + workerFk: userId + } + }); + let fields = ['id', 'appName']; + + if (workerFk) + fields = [...fields, ...['isVersionBetaCritical', 'versionBeta', 'urlBeta']]; + else + fields = [...fields, ...['isVersionCritical', 'version', 'urlProduction']]; + + const filter = { + where: { + appName: app + }, + fields, + }; + + return await Self.findOne(filter); + }; +}; diff --git a/back/models/mobile-app-version-control.js b/back/models/mobile-app-version-control.js new file mode 100644 index 000000000..ee8fa2ab6 --- /dev/null +++ b/back/models/mobile-app-version-control.js @@ -0,0 +1,3 @@ +module.exports = Self => { + require('../methods/mobile-app-version-control/getVersion')(Self); +}; diff --git a/back/models/mobile-app-version-control.json b/back/models/mobile-app-version-control.json new file mode 100644 index 000000000..819ad33f5 --- /dev/null +++ b/back/models/mobile-app-version-control.json @@ -0,0 +1,39 @@ +{ + "name": "MobileAppVersionControl", + "base": "VnModel", + "options": { + "mysql": { + "table": "vn.mobileAppVersionControl" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + }, + "appName": { + "type": "string" + }, + + "version": { + "type": "string" + }, + + "isVersionCritical": { + "type": "boolean" + }, + + "urlProduction": { + "type": "string" + }, + "urlBeta": { + "type": "string" + }, + "versionBeta": { + "type": "string" + }, + "isVersionBetaCritical": { + "type": "boolean" + } + } +} diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 955088866..9111a8a04 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -2,4 +2,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp VALUES ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file + ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), + ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index 8352eb070..650a8d0c2 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -53,6 +53,9 @@ "Time": { "dataSource": "vn" }, + "WorkerAppTester": { + "dataSource": "vn" + }, "WorkCenter": { "dataSource": "vn" }, diff --git a/modules/worker/back/models/worker-app-tester.json b/modules/worker/back/models/worker-app-tester.json new file mode 100644 index 000000000..7e9706dcb --- /dev/null +++ b/modules/worker/back/models/worker-app-tester.json @@ -0,0 +1,22 @@ +{ + "name": "WorkerAppTester", + "base": "VnModel", + "options": { + "mysql": { + "table": "vn.workerAppTester" + } + }, + "properties": { + "workerFk": { + "id": true, + "type": "number" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + } + } +} \ No newline at end of file From 0a76b6843fc774112a94a14ca528d162edea11e1 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 29 Nov 2023 15:02:44 +0100 Subject: [PATCH 015/250] refs #5878 feat: approach error-handler middleware --- loopback/locale/es.json | 8 ++++++-- loopback/server/middleware/error-handler.js | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 6ce4f72bc..cf5998e9d 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -334,7 +334,6 @@ "countryFk cannot be empty": "countryFk cannot be empty", "Model is not valid": "El campo \" {{key}}\" no es válido", "Property is not defined in this model": "La propiedad que ha modificado no existe", - "postcode": "Código postal", "postCode": "Código postal", "fi": "NIF/CIF", "nif": "NIF/CIF", @@ -348,5 +347,10 @@ "healthRegister":"Registro sanitario", "sageTaxTypeFk":"Tipo de impuesto Sage", "sageTransactionTypeFk":"Tipo de transacción Sage", - "sageWithholdingFk" : "Sage con tenencia" + "sageWithholdingFk" : "Sage con tenencia", + "Cannot past travels with entries": "No se pueden pasar envíos con entradas", + "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", + "Field are invalid": "El campo {{tag}} no es válido", + "postcode": "Código postal" } + diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index 725826ae7..0c53d9e8b 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -1,6 +1,9 @@ const UserError = require('../../util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); - +const validations = [{ + validation: message => String(message).startsWith('Value is not'), + message: ({__: $t, body}) => $t('Field are invalid', {tag: $t(Object.keys(body)[0])}) +}]; module.exports = function() { return function(err, req, res, next) { // Thrown user errors @@ -10,6 +13,16 @@ module.exports = function() { } // Validation errors + if (err.statusCode == 400) { + try { + validations.forEach(validation => { + err.message = validation.validation(err.message) && validation.message(req); + }); + + return next(err); + } catch (e) { + } + } if (err.statusCode == 422) { try { let code; From e5e97a047f4b993f2ce6d637ac1941406d017419 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 29 Nov 2023 15:03:09 +0100 Subject: [PATCH 016/250] refs #5878 perf: front validations --- front/core/components/watcher/locale/es.yml | 4 +++- front/core/components/watcher/watcher.js | 6 ++++-- loopback/locale/es.json | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/front/core/components/watcher/locale/es.yml b/front/core/components/watcher/locale/es.yml index 5d25752b4..37113b871 100644 --- a/front/core/components/watcher/locale/es.yml +++ b/front/core/components/watcher/locale/es.yml @@ -1,4 +1,6 @@ Are you sure exit without saving?: ¿Seguro que quieres salir sin guardar? Unsaved changes will be lost: Los cambios que no hayas guardado se perderán No changes to save: No hay cambios que guardar -Some fields are invalid: Algunos campos no son válidos \ No newline at end of file +Field are invalid: El campo {{tag}} no es válido +Some fields are invalid: Algunos campos no son válidos + diff --git a/front/core/components/watcher/watcher.js b/front/core/components/watcher/watcher.js index 8b52be69c..5e3069e02 100644 --- a/front/core/components/watcher/watcher.js +++ b/front/core/components/watcher/watcher.js @@ -317,8 +317,10 @@ export default class Watcher extends Component { * Checks if the form is valid. */ isInvalid() { - if (this.form && this.form.$invalid) - throw new UserError('Some fields are invalid'); + if (this.form && this.form.$invalid) { + const tag = Object.values(this.form.$error)[0][0].$$attr.label; + throw new UserError(this.$t('Field are invalid', {tag: this.$t(tag)})); + } } /** diff --git a/loopback/locale/es.json b/loopback/locale/es.json index cf5998e9d..8a5f4db9f 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -335,6 +335,7 @@ "Model is not valid": "El campo \" {{key}}\" no es válido", "Property is not defined in this model": "La propiedad que ha modificado no existe", "postCode": "Código postal", + "postcode": "Código postal", "fi": "NIF/CIF", "nif": "NIF/CIF", "Account": "Cuenta", @@ -350,7 +351,5 @@ "sageWithholdingFk" : "Sage con tenencia", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", - "Field are invalid": "El campo {{tag}} no es válido", - "postcode": "Código postal" + "Field are invalid": "El campo {{tag}} no es válido" } - From 27d223cbab099ff9bd73d97d1872401dd5cc1962 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 29 Nov 2023 16:25:15 +0100 Subject: [PATCH 017/250] refs #6276 machineWorker_add --- back/methods/machine-worker/add.js | 68 +++++++++++++++++++++ back/methods/machine-worker/updateInTime.js | 2 +- back/models/machine-worker.js | 1 + db/changes/235001/00-newWareHouse.sql | 1 + 4 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 back/methods/machine-worker/add.js diff --git a/back/methods/machine-worker/add.js b/back/methods/machine-worker/add.js new file mode 100644 index 000000000..3da236cb8 --- /dev/null +++ b/back/methods/machine-worker/add.js @@ -0,0 +1,68 @@ +module.exports = Self => { + Self.remoteMethodCtx('add', { + description: 'Insert log if the worker has not logged anything in the last 12 hours', + accessType: 'READ', + accepts: [ + { + arg: 'plate', + type: 'string', + } + ], + http: { + path: `/add`, + verb: 'POST' + } + }); + + Self.add = async(ctx, plate, options) => { + const models = Self.app.models; + const userId = ctx.req.accessToken.userId; + + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const machine = await models.Machine.findOne({ + fields: ['id', 'plate'], + where: {plate} + }, myOptions); + + if (!machine) throw new Error(`plate ${plate} does not exist`); + + const twelveHoursAgo = Date.vnNew(); + twelveHoursAgo.setHours(twelveHoursAgo.getHours() - 12); + + const isRegistered = await models.MachineWorker.findOne({ + where: { + and: [ + {machineFk: machine.id}, + {workerFk: userId}, + {outTime: {gte: twelveHoursAgo}} + ] + } + }, myOptions); + console.log(isRegistered); + if (!isRegistered) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); + else { + await models.MachineWorker.updateAll( + {or: [{workerFk: userId}, {machineFk: machine.id}]}, + {outTime: Date.vnNew()}, + myOptions + ); + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index b8e2becf2..917733686 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethodCtx('updateInTime', { - description: '', + description: 'Updates the corresponding registry if the worker has been registered in the last few hours', accessType: 'WRITE', accepts: [ { diff --git a/back/models/machine-worker.js b/back/models/machine-worker.js index cbc5fd53e..b44cb1fb6 100644 --- a/back/models/machine-worker.js +++ b/back/models/machine-worker.js @@ -1,3 +1,4 @@ module.exports = Self => { require('../methods/machine-worker/updateInTime')(Self); + require('../methods/machine-worker/add')(Self); }; diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 9111a8a04..05003d8ec 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -3,4 +3,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), + ('MachineWorker','add','READ','ALLOW','ROLE','employee'), ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'); \ No newline at end of file From 375cb1acc0759e560a88c0ae464bca3e92c61818 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 29 Nov 2023 16:28:14 +0100 Subject: [PATCH 018/250] refs #6276 console removed --- back/methods/machine-worker/add.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/machine-worker/add.js b/back/methods/machine-worker/add.js index 3da236cb8..65eb5d297 100644 --- a/back/methods/machine-worker/add.js +++ b/back/methods/machine-worker/add.js @@ -49,7 +49,7 @@ module.exports = Self => { ] } }, myOptions); - console.log(isRegistered); + if (!isRegistered) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); else { await models.MachineWorker.updateAll( From 40236fdb7bac7b299e6118e51b12cc0a69fbf226 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 30 Nov 2023 13:23:10 +0100 Subject: [PATCH 019/250] refs #6276 itemShelvingMake_multi --- .../back/methods/item-shelving/makeMulti.js | 74 +++++++++++++++++++ modules/item/back/models/item-shelving.js | 1 + modules/item/back/models/item-shelving.json | 2 +- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 modules/item/back/methods/item-shelving/makeMulti.js diff --git a/modules/item/back/methods/item-shelving/makeMulti.js b/modules/item/back/methods/item-shelving/makeMulti.js new file mode 100644 index 000000000..d4b451760 --- /dev/null +++ b/modules/item/back/methods/item-shelving/makeMulti.js @@ -0,0 +1,74 @@ +module.exports = Self => { + Self.remoteMethod('makeMulti', { + description: 'Add a record or update it if it already exists.', + accessType: 'WRITE', + accepts: [{ + arg: 'shelvingFk', + type: 'number', + required: true, + }, + { + arg: 'items', + type: ['number'], + required: true, + description: 'array of item foreign keys' + }, + { + arg: 'warehouseFk', + type: 'number', + required: true + }], + + http: { + path: `/makeMulti`, + verb: 'POST' + } + }); + + Self.makeMulti = async(shelvingFk, items, warehouseFk, options) => { + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + const discardItems = []; + + try { + for (let item of items) { + if (!discardItems.includes(item)) { + let quantity = items.reduce((acc, cur) => { + return acc + (cur === item ? 1 : 0); + }, 0); + discardItems.push(item); + + let [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?)', [item, warehouseFk]); + let packing; + + if (result) packing = Object.values(result)[0]; + if (!packing) packing = 1; + + quantity = quantity * packing; + + await Self.rawSql('CALL vn.itemShelving_add(?, ?, ?, NULL, NULL, ?, ?)', + [shelvingFk, + item, + quantity, + packing, + warehouseFk] + ); + } + } + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 98ff18931..4684d49e2 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -1,4 +1,5 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); require('../methods/item-shelving/getInventory')(Self); + require('../methods/item-shelving/makeMulti')(Self); }; diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index bb1a141c4..61d05539e 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -1,6 +1,6 @@ { "name": "ItemShelving", - "base": "Loggable", + "base": "VnModel", "options": { "mysql": { "table": "itemShelving" From 3333c837029fa3c87713f26914049f416c85c7b5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 30 Nov 2023 16:25:13 +0100 Subject: [PATCH 020/250] refs #6276 WIP itemShelving_return --- .../item/back/methods/item-shelving/return.js | 77 +++++++++++++++++++ modules/item/back/models/item-shelving.js | 1 + modules/item/back/models/item-shelving.json | 5 +- 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 modules/item/back/methods/item-shelving/return.js diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js new file mode 100644 index 000000000..dc17719de --- /dev/null +++ b/modules/item/back/methods/item-shelving/return.js @@ -0,0 +1,77 @@ +module.exports = Self => { + Self.remoteMethod('return', { + description: 'Returns a list of items and possible alternative locations', + accessType: 'READ', + accepts: [{ + arg: 'shelvingFk', + type: 'string', + required: true, + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/return`, + verb: 'POST' + } + }); + + Self.return = async(shelvingFk, options) => { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const filterItemShelvings = { + fields: ['id', 'visible', 'itemFk', 'packing', 'grouping', 'isChecked', 'shelvingFk'], + where: {shelvingFk}, + include: [ + { + relation: 'item', + scope: { + fields: ['longName', 'name', 'size'] + } + }, + { + relation: 'shelving', + + scope: { + include: { + fields: ['id', 'name', 'code'], + relation: 'parking', + } + + } + }, + ] + }; + + let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions); + + let alternatives = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]); + console.log(alternatives); + + if (itemShelvings) { + itemShelvings = itemShelvings.map(itemShelving => { + const item = itemShelving.item(); + const shelving = itemShelving.shelving(); + const parking = shelving ? shelving.parking() : null; + + return { + item: itemShelving.itemFk, + description: item ? item.longName || `${item.name} ${item.size}` : '', + visible: itemShelving.visible, + stickers: Math.ceil(itemShelving.visible / itemShelving.packing), + packing: itemShelving.packing, + grouping: itemShelving.grouping, + code: parking ? parking.code : '', + id: itemShelving.id, + priority: shelving ? shelving.priority : 0, + isChecked: itemShelving.isChecked + }; + }); + } + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 4684d49e2..e610aabec 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -2,4 +2,5 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); require('../methods/item-shelving/getInventory')(Self); require('../methods/item-shelving/makeMulti')(Self); + require('../methods/item-shelving/return')(Self); }; diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index 61d05539e..bf9e5e4b1 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -51,7 +51,8 @@ "shelving": { "type": "belongsTo", "model": "Shelving", - "foreignKey": "shelvingFk" - } + "foreignKey": "shelvingFk", + "primaryKey": "code" + } } } From d5f09c2f75dc674f34d0df45aca8f591735e68c5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 09:44:49 +0100 Subject: [PATCH 021/250] refs #6276 saleTrackingDel --- db/changes/235001/00-newWareHouse.sql | 3 +- .../back/methods/sale-tracking/delete.js | 30 +++++++++++-------- modules/ticket/front/sale-tracking/index.js | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 05003d8ec..c6f595400 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -4,4 +4,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), ('MachineWorker','add','READ','ALLOW','ROLE','employee'), - ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'); \ No newline at end of file + ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), + ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 0b977e5d4..5efd267dc 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -10,12 +10,12 @@ module.exports = Self => { description: 'The sale id' }, { - arg: 'stateCode', - type: 'string' - } + arg: 'stateCodes', + type: ['string'] + }, ], returns: { - type: ['object'], + type: 'boolean', root: true }, http: { @@ -24,7 +24,7 @@ module.exports = Self => { } }); - Self.delete = async(saleFk, stateCode, options) => { + Self.delete = async(saleFk, stateCodes, options) => { const models = Self.app.models; const myOptions = {}; let tx; @@ -38,20 +38,24 @@ module.exports = Self => { } try { - if (stateCode === 'PREPARED') { - const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); - for (let itemShelvingSale of itemShelvingSales) - await itemShelvingSale.destroy(myOptions); - } + const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); - const state = await models.State.findOne({ - where: {code: stateCode} + for (let itemShelvingSale of itemShelvingSales) + await itemShelvingSale.destroy(myOptions); + + const states = await models.State.find({ + fields: ['id'], + where: { + code: {inq: stateCodes} + } }, myOptions); + const stateIds = states.map(state => state.id); + const filter = { where: { saleFk: saleFk, - stateFk: state.id + stateFk: {inq: stateIds} } }; const saleTrackings = await models.SaleTracking.find(filter, myOptions); diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 6c0e7232e..095d581a1 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -100,7 +100,7 @@ class Controller extends Section { saleTrackingDel(sale, stateCode) { const params = { saleFk: sale.saleFk, - stateCode: stateCode + stateCodes: [stateCode] }; this.$http.post(`SaleTrackings/delete`, params).then(() => { this.vnApp.showSuccess(this.$t('Data saved!')); From f2ab44bb8f3e8bbdeeac2be8ed0deb422697ef2b Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 10:14:32 +0100 Subject: [PATCH 022/250] refs #6276 itemShelving_return --- .../item/back/methods/item-shelving/return.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index dc17719de..6e0f80824 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -8,7 +8,7 @@ module.exports = Self => { required: true, }], returns: { - type: 'object', + type: ['object'], root: true }, http: { @@ -50,8 +50,7 @@ module.exports = Self => { let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions); - let alternatives = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]); - console.log(alternatives); + const alternatives = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]); if (itemShelvings) { itemShelvings = itemShelvings.map(itemShelving => { @@ -59,19 +58,23 @@ module.exports = Self => { const shelving = itemShelving.shelving(); const parking = shelving ? shelving.parking() : null; + const carros = alternatives.filter(el => el.item == itemShelving.itemFk); + return { + id: itemShelving.id, item: itemShelving.itemFk, - description: item ? item.longName || `${item.name} ${item.size}` : '', - visible: itemShelving.visible, + longName: item ? item.longName || `${item.name} ${item.size}` : '', + quantity: itemShelving.visible, stickers: Math.ceil(itemShelving.visible / itemShelving.packing), packing: itemShelving.packing, grouping: itemShelving.grouping, code: parking ? parking.code : '', - id: itemShelving.id, priority: shelving ? shelving.priority : 0, - isChecked: itemShelving.isChecked + isChecked: itemShelving.isChecked, + carros }; }); } + return itemShelvings; }; }; From d2769f4c2190ab55b22a1cf0e7dcf5d41a5d22df Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 11:38:30 +0100 Subject: [PATCH 023/250] refs #6276 return fixed --- modules/item/back/methods/item-shelving/return.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index 6e0f80824..346fe8bdf 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -13,7 +13,7 @@ module.exports = Self => { }, http: { path: `/return`, - verb: 'POST' + verb: 'GET' } }); From 7e57640758ebdc47403e98af56c69a8dfee960e5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 11:43:07 +0100 Subject: [PATCH 024/250] refs #6276 itemShelving_updateFromSale --- .../methods/item-shelving/updateFromSale.js | 51 +++++++++++++++++++ modules/item/back/models/item-shelving.js | 1 + 2 files changed, 52 insertions(+) create mode 100644 modules/item/back/methods/item-shelving/updateFromSale.js diff --git a/modules/item/back/methods/item-shelving/updateFromSale.js b/modules/item/back/methods/item-shelving/updateFromSale.js new file mode 100644 index 000000000..cd2012edb --- /dev/null +++ b/modules/item/back/methods/item-shelving/updateFromSale.js @@ -0,0 +1,51 @@ +module.exports = Self => { + Self.remoteMethod('updateFromSale', { + description: 'Returns a list of items and possible alternative locations', + accessType: 'WRITE', + accepts: [{ + arg: 'saleFk', + type: 'number', + required: true, + }], + http: { + path: `/updateFromSale`, + verb: 'POST' + } + }); + + Self.updateFromSale = async(saleFk, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const itemShelvingSale = await models.ItemShelvingSale.findOne({ + where: {saleFk} + }, myOptions); + + const itemShelving = await models.ItemShelving.findOne({ + where: { + id: itemShelvingSale.ItemShelvingFk + } + }); + const quantity = itemShelving.visible + itemShelvingSale.quantity; + + await itemShelving.updateAttributes( + {visible: quantity}, + myOptions + ); + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index e610aabec..4eb5374e8 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/item-shelving/getInventory')(Self); require('../methods/item-shelving/makeMulti')(Self); require('../methods/item-shelving/return')(Self); + require('../methods/item-shelving/updateFromSale')(Self); }; From 660e77be5527dc01e4693fbdf97dd4d10af300a8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 12:48:21 +0100 Subject: [PATCH 025/250] refs #6276 updateFromSale refactored --- .../item/back/methods/item-shelving/updateFromSale.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/item/back/methods/item-shelving/updateFromSale.js b/modules/item/back/methods/item-shelving/updateFromSale.js index cd2012edb..b63b766c2 100644 --- a/modules/item/back/methods/item-shelving/updateFromSale.js +++ b/modules/item/back/methods/item-shelving/updateFromSale.js @@ -28,14 +28,11 @@ module.exports = Self => { try { const itemShelvingSale = await models.ItemShelvingSale.findOne({ - where: {saleFk} + where: {saleFk}, + include: {relation: 'itemShelving'} }, myOptions); - const itemShelving = await models.ItemShelving.findOne({ - where: { - id: itemShelvingSale.ItemShelvingFk - } - }); + const itemShelving = itemShelvingSale.itemShelving(); const quantity = itemShelving.visible + itemShelvingSale.quantity; await itemShelving.updateAttributes( From 4690dca4f955ceff7eb53ddf2e08e0d0d25622db Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 13:54:09 +0100 Subject: [PATCH 026/250] refs #6276 getItemPackingType --- .../methods/item-shelving/updateFromSale.js | 2 +- .../methods/operator/getItemPackingType.js | 28 +++++++++++++++++++ modules/worker/back/models/operator.js | 1 + modules/worker/back/models/operator.json | 6 ++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 modules/worker/back/methods/operator/getItemPackingType.js diff --git a/modules/item/back/methods/item-shelving/updateFromSale.js b/modules/item/back/methods/item-shelving/updateFromSale.js index b63b766c2..2b9f49cae 100644 --- a/modules/item/back/methods/item-shelving/updateFromSale.js +++ b/modules/item/back/methods/item-shelving/updateFromSale.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('updateFromSale', { - description: 'Returns a list of items and possible alternative locations', + description: 'Update the visible items', accessType: 'WRITE', accepts: [{ arg: 'saleFk', diff --git a/modules/worker/back/methods/operator/getItemPackingType.js b/modules/worker/back/methods/operator/getItemPackingType.js new file mode 100644 index 000000000..6e2125b5b --- /dev/null +++ b/modules/worker/back/methods/operator/getItemPackingType.js @@ -0,0 +1,28 @@ +module.exports = Self => { + Self.remoteMethodCtx('getItemPackingType', { + description: 'Retrieve the operator items', + accessType: 'READ', + returns: { + type: 'string', + }, + http: { + path: `/getItemPackingType`, + verb: 'GET' + }, + }); + + Self.getItemPackingType = async ctx => { + const userId = 9 ?? ctx.req.accessToken.userId; + + const result = await Self.findOne({ + where: { + workerFk: userId + }, + include: { + relation: 'itemPackingType', + } + }); + const itemPackingType = result.itemPackingType(); + return itemPackingType?.description; + }; +}; diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index 5e8870130..b9ea481a7 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -2,6 +2,7 @@ module.exports = Self => { require('../methods/operator/add')(Self); require('../methods/operator/getPrinter')(Self); require('../methods/operator/getAvailablePrinters')(Self); + require('../methods/operator/getItemPackingType')(Self); Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance; diff --git a/modules/worker/back/models/operator.json b/modules/worker/back/models/operator.json index 6da3945fc..a2f3ee01c 100644 --- a/modules/worker/back/models/operator.json +++ b/modules/worker/back/models/operator.json @@ -43,6 +43,12 @@ "type": "belongsTo", "model": "Printer", "foreignKey": "labelerFk" + }, + "itemPackingType": { + "type": "belongsTo", + "model": "ItemPackingType", + "foreignKey": "itemPackingTypeFk", + "primaryKey": "code" } } } From 1dfdd94584de25519d91324f09b34f93ab1fad61 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Dec 2023 13:56:43 +0100 Subject: [PATCH 027/250] refs #6276 fix getItemPackingType --- modules/worker/back/methods/operator/getItemPackingType.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/methods/operator/getItemPackingType.js b/modules/worker/back/methods/operator/getItemPackingType.js index 6e2125b5b..d28cd95fe 100644 --- a/modules/worker/back/methods/operator/getItemPackingType.js +++ b/modules/worker/back/methods/operator/getItemPackingType.js @@ -3,7 +3,7 @@ module.exports = Self => { description: 'Retrieve the operator items', accessType: 'READ', returns: { - type: 'string', + type: 'object', }, http: { path: `/getItemPackingType`, @@ -23,6 +23,9 @@ module.exports = Self => { } }); const itemPackingType = result.itemPackingType(); - return itemPackingType?.description; + + return { + description: itemPackingType?.description + }; }; }; From 94147bd2b27b1869dcea72736002a20787fc9bb4 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Dec 2023 07:36:39 +0100 Subject: [PATCH 028/250] refs #5858 feat: handle Error from middleware --- front/core/components/watcher/locale/es.yml | 2 - front/core/components/watcher/watcher.js | 6 +- loopback/locale/es.json | 2 +- loopback/server/middleware.json | 1 - loopback/server/middleware/error-handler.js | 42 +- loopback/server/middleware/validate-model.js | 33 -- .../methods/client/body_model_validator.js | 42 -- .../client/specs/bodyValidator.spec.js | 414 ------------------ .../back/methods/client/updateFiscalData.js | 200 ++++----- .../back/methods/supplier/updateFiscalData.js | 137 +++--- 10 files changed, 195 insertions(+), 684 deletions(-) delete mode 100644 loopback/server/middleware/validate-model.js delete mode 100644 modules/client/back/methods/client/body_model_validator.js delete mode 100644 modules/client/back/methods/client/specs/bodyValidator.spec.js diff --git a/front/core/components/watcher/locale/es.yml b/front/core/components/watcher/locale/es.yml index 37113b871..83553d20d 100644 --- a/front/core/components/watcher/locale/es.yml +++ b/front/core/components/watcher/locale/es.yml @@ -1,6 +1,4 @@ Are you sure exit without saving?: ¿Seguro que quieres salir sin guardar? Unsaved changes will be lost: Los cambios que no hayas guardado se perderán No changes to save: No hay cambios que guardar -Field are invalid: El campo {{tag}} no es válido Some fields are invalid: Algunos campos no son válidos - diff --git a/front/core/components/watcher/watcher.js b/front/core/components/watcher/watcher.js index 5e3069e02..8b52be69c 100644 --- a/front/core/components/watcher/watcher.js +++ b/front/core/components/watcher/watcher.js @@ -317,10 +317,8 @@ export default class Watcher extends Component { * Checks if the form is valid. */ isInvalid() { - if (this.form && this.form.$invalid) { - const tag = Object.values(this.form.$error)[0][0].$$attr.label; - throw new UserError(this.$t('Field are invalid', {tag: this.$t(tag)})); - } + if (this.form && this.form.$invalid) + throw new UserError('Some fields are invalid'); } /** diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 8a5f4db9f..83dc81d77 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -351,5 +351,5 @@ "sageWithholdingFk" : "Sage con tenencia", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", - "Field are invalid": "El campo {{tag}} no es válido" + "Field are invalid": "El campo '{{tag}}' no es válido" } diff --git a/loopback/server/middleware.json b/loopback/server/middleware.json index f06395e89..cfc693217 100644 --- a/loopback/server/middleware.json +++ b/loopback/server/middleware.json @@ -35,7 +35,6 @@ } }, "auth:after": { - "./middleware/validate-model": {}, "./middleware/current-user": {}, "./middleware/salix-version": {} }, diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index 0c53d9e8b..e0d32d209 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -1,8 +1,36 @@ + const UserError = require('../../util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); const validations = [{ validation: message => String(message).startsWith('Value is not'), - message: ({__: $t, body}) => $t('Field are invalid', {tag: $t(Object.keys(body)[0])}) + message: ({__: $t}, _tag) => + $t('Field are invalid', {tag: $t(_tag)}), + handleError: ({method, originalUrl, body}) => { + const {models} = require('vn-loopback/server/server'); + let tag = null; + try { + let [module, id, path] = originalUrl.split('api/')[1].split('/'); + + let model = models[module]; + if (!model) { + module = module.substring(0, module.length - 1); + model = models[module]; + } + if (!model) throw new UserError(''); + const {accepts} = model.sharedClass.methods().find(method => method.name === path); + for (const [key, value] of Object.entries(body)) { + const accept = accepts.find(acc => acc.arg === key); + if (!value && accept.type !== 'any') { + tag = key; + break; + } + } + return tag; + } catch (error) { + throw new Error(error); + } + } + }]; module.exports = function() { return function(err, req, res, next) { @@ -16,7 +44,17 @@ module.exports = function() { if (err.statusCode == 400) { try { validations.forEach(validation => { - err.message = validation.validation(err.message) && validation.message(req); + if (validation.validation(err.message)) { + const error = validation.handleError(req); + if (error) + err.message = validation.message(req, error); + // const tag = handleNullProperty(req); + // if (tag) { + // const message = validation.message(req); + // } + // const tag = validateModel(req); + // if (tag) validation.message(req); + } }); return next(err); diff --git a/loopback/server/middleware/validate-model.js b/loopback/server/middleware/validate-model.js deleted file mode 100644 index 7c1538190..000000000 --- a/loopback/server/middleware/validate-model.js +++ /dev/null @@ -1,33 +0,0 @@ -const {models} = require('vn-loopback/server/server'); -const validatorBodyModel = require('../../../modules/client/back/methods/client/body_model_validator'); -const makeSingular = s => { - if (s == null || s.length == 0) - return s; - - return s.substring(0, s.length - 1); -}; -function blobToB64(data) { - return new Uint8Array(data).reduce(function(data, byte) { - return data + String.fromCharCode(byte); - }, ''); -} -module.exports = function(options) { - return function(req, res, next) { - const {method, originalUrl} = req; - if (['GET', 'DELETE'].includes(method)) return next(); - let [module, id, path] = originalUrl.split('api/')[1].split('/'); - - let model = models[module]; - if (!model) { - module = makeSingular(module); - model = models[module]; - } - const properties = model.definition.rawProperties; - const data = JSON.parse(blobToB64(req.readableBuffer.tail.data)); - let isValid = validatorBodyModel(properties, data); - - if (!isValid.isValid) - next(); - return next(); - }; -}; diff --git a/modules/client/back/methods/client/body_model_validator.js b/modules/client/back/methods/client/body_model_validator.js deleted file mode 100644 index 999c32024..000000000 --- a/modules/client/back/methods/client/body_model_validator.js +++ /dev/null @@ -1,42 +0,0 @@ - -const isNotNull = value => value !== null && value !== undefined && value !== ''; -const validatorBodyModel = (model, body) => { - let isValid = true; - let tag = null; - Object.entries(body).forEach(([key, value]) => { - if (!isValid) return; - const bodyArg = model.find(m => m.arg === key); - if (!bodyArg) return; - // throw new Error(`Property ${key} is not defined in this model`); - const {type} = bodyArg; - tag = key; - if (tag !== 'any') { - isValid = isNotNull(value); - return; - } - - switch (type) { - case 'number': - isValid = /^[0-9]*$/.test(value); - break; - - case 'boolean': - isValid = value instanceof Boolean; - break; - - case 'date': - isValid = (new Date(date) !== 'Invalid Date') && !isNaN(new Date(date)); - break; - - case 'string': - isValid = typeof value == 'string'; - break; - - default: - break; - } - }); - return {isValid, tag}; -}; - -module.exports = validatorBodyModel; diff --git a/modules/client/back/methods/client/specs/bodyValidator.spec.js b/modules/client/back/methods/client/specs/bodyValidator.spec.js deleted file mode 100644 index f4c84975f..000000000 --- a/modules/client/back/methods/client/specs/bodyValidator.spec.js +++ /dev/null @@ -1,414 +0,0 @@ -/* eslint-disable jasmine/no-spec-dupes */ -const validatorBodyModel = require('../body_model_validator'); -fdescribe('Validation Model', () => { - describe('should be number', () => { - it('success', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'number' - - }], {property: 1}); - - expect(isValid).toBeTrue(); - }); - - it('fail', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'number' - - }], {property: null}); - - expect(isValid).toBeFalse(); - }); - }); - - describe('should be string', () => { - it('success as number', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'string' - - }], {property: '1234'}); - - expect(isValid).toBeTrue(); - }); - - it('success as string', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'string' - - }], {property: 'null'}); - - expect(isValid).toBeTrue(); - }); - - it('fail', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'string' - - }], {property: null}); - - expect(isValid).toBeFalse(); - }); - }); - - describe('should be date', () => { - it('success', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'date' - - }], {property: new Date()}); - - expect(isValid).toBeTrue(); - }); - - it('fail', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'date' - - }], {property: null}); - - expect(isValid).toBeFalse(); - }); - }); - - describe('should be boolean', () => { - it('success as true', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'boolean' - - }], {property: true}); - - expect(isValid).toBeTrue(); - }); - - it('success as false', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'boolean' - - }], {property: false}); - - expect(isValid).toBeTrue(); - }); - - it('fail', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'boolean' - - }], {property: null}); - - expect(isValid).toBeFalse(); - }); - }); - - describe('should be any', () => { - it('success', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'any' - - }], {property: '1234'}); - - expect(isValid).toBeTrue(); - }); - - it('fail', () => { - let {isValid} = validatorBodyModel([{ - arg: 'property', - type: 'any' - - }], {property: null}); - - expect(isValid).toBeFalse(); - }); - }); -}); -describe('Validation Client Create', () => { - const newAccount = { - userName: 'Deadpool', - email: 'Deadpool@marvel.com', - fi: '16195279J', - name: 'Wade', - socialName: 'DEADPOOL MARVEL', - street: 'WALL STREET', - city: 'New York', - businessTypeFk: 'florist', - provinceFk: 1 - }; - const CLIENT_MODEL = [ - { - arg: 'socialName', - type: 'string' - }, - { - arg: 'fi', - type: 'string' - }, - { - arg: 'street', - type: 'string' - }, - { - arg: 'postcode', - type: 'string' - }, - { - arg: 'city', - type: 'string' - }, - { - arg: 'countryFk', - type: 'number' - }, - { - arg: 'provinceFk', - type: 'number' - }, - { - arg: 'sageTaxTypeFk', - type: 'any' - }, - { - arg: 'sageTransactionTypeFk', - type: 'any' - }, - { - arg: 'transferorFk', - type: 'any' - }, - { - arg: 'hasToInvoiceByAddress', - type: 'boolean' - }, - { - arg: 'hasToInvoice', - type: 'boolean' - }, - { - arg: 'isActive', - type: 'boolean' - }, - { - arg: 'isFreezed', - type: 'boolean' - }, - { - arg: 'isVies', - type: 'boolean' - }, - { - arg: 'isToBeMailed', - type: 'boolean' - }, - { - arg: 'isEqualizated', - type: 'boolean' - }, - { - arg: 'isTaxDataVerified', - type: 'boolean' - }, - { - arg: 'isTaxDataChecked', - type: 'boolean' - }, - { - arg: 'despiteOfClient', - type: 'number' - }, - { - arg: 'hasIncoterms', - type: 'boolean' - }, - { - arg: 'hasElectronicInvoice', - type: 'boolean' - } - ]; - it(`should not find Deadpool as he's not created yet`, async() => { - let isValid = false; - - isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; - - expect(isValid).toBeTrue(); - }); - - it('should create a new account', async() => { - let isValid = false; - - isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; - - expect(isValid).toBeTrue(); - }); - - it('should not be able to create a user if exists', async() => { - let isValid = false; - - isValid = validatorBodyModel(CLIENT_MODEL, newAccount).isValid; - - expect(isValid).toBeTrue(); - }); -}); -fdescribe('Validation Worker Create', () => { - const defaultWorker = { - // fi: '78457139E', - // name: 'DEFAULTERWORKER', - // firstName: 'DEFAULT', - // lastNames: 'WORKER', - // email: 'defaultWorker@mydomain.com', - // street: 'S/ DEFAULTWORKERSTREET', - // city: 'defaultWorkerCity', - // provinceFk: 1, - // countryFk: 1, - // companyFk: 442, - // postcode: '46680', - // phone: '123456789', - // code: 'DWW', - // bossFk: 9, - // birth: '2022-12-11T23:00:00.000Z', - // payMethodFk: 1, - // roleFk: 1 - }; - const WORKER_MODEL = [ - { - arg: 'fi', - type: 'string', - description: `The worker fi`, - required: true, - }, - { - arg: 'name', - type: 'string', - description: `The user name`, - required: true, - }, - { - arg: 'firstName', - type: 'string', - description: `The worker firstname`, - required: true, - }, - { - arg: 'lastNames', - type: 'string', - description: `The worker lastnames`, - required: true, - }, - { - arg: 'email', - type: 'string', - description: `The worker email`, - required: true, - }, - { - arg: 'street', - type: 'string', - description: `The worker address`, - required: true, - }, - { - arg: 'city', - type: 'string', - description: `The worker city`, - required: true, - }, - { - arg: 'provinceFk', - type: 'number', - description: `The worker province`, - required: true, - }, - { - arg: 'companyFk', - type: 'number', - description: `The worker company`, - required: true, - }, - { - arg: 'postcode', - type: 'string', - description: `The worker postcode`, - required: true, - }, - { - arg: 'phone', - type: 'string', - description: `The worker phone`, - required: true, - }, - { - arg: 'code', - type: 'string', - description: `The worker code`, - required: true, - }, - { - arg: 'bossFk', - type: 'number', - description: `The worker boss`, - required: true, - }, - { - arg: 'birth', - type: 'date', - description: `The worker birth`, - required: true, - }, - { - arg: 'payMethodFk', - type: 'number', - description: `The client payMethod`, - required: true, - }, - { - arg: 'iban', - type: 'string', - description: `The client iban`, - }, - { - arg: 'bankEntityFk', - type: 'number', - description: `The client bank entity`, - } - ]; - - it(`should not find worker as he's not created yet`, async() => { - let isValid = false; - - isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; - - expect(isValid).toBeTrue(); - }); - - it('should create a new worker', async() => { - let isValid = false; - isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; - - expect(isValid).toBeTrue(); - }); - - it('should update a new worker', async() => { - let isValid = false; - - isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; - - expect(isValid).toBeTrue(); - }); - - it('should not be able to create a worker if exists', async() => { - let isValid = false; - let error; - - isValid = validatorBodyModel(WORKER_MODEL, defaultWorker).isValid; - - expect(isValid).toBeTrue(); - }); -}); diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index c87eba6be..5fd886c32 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -1,95 +1,4 @@ let UserError = require('vn-loopback/util/user-error'); -const validatorBodyModel = require('./body_model_validator'); -const BODY_MODEL = [ - { - arg: 'socialName', - type: 'string' - }, - { - arg: 'fi', - type: 'string' - }, - { - arg: 'street', - type: 'string' - }, - { - arg: 'postcode', - type: 'string' - }, - { - arg: 'city', - type: 'string' - }, - { - arg: 'countryFk', - type: 'number' - }, - { - arg: 'provinceFk', - type: 'number' - }, - { - arg: 'sageTaxTypeFk', - type: 'any' - }, - { - arg: 'sageTransactionTypeFk', - type: 'any' - }, - { - arg: 'transferorFk', - type: 'any' - }, - { - arg: 'hasToInvoiceByAddress', - type: 'boolean' - }, - { - arg: 'hasToInvoice', - type: 'boolean' - }, - { - arg: 'isActive', - type: 'boolean' - }, - { - arg: 'isFreezed', - type: 'boolean' - }, - { - arg: 'isVies', - type: 'boolean' - }, - { - arg: 'isToBeMailed', - type: 'boolean' - }, - { - arg: 'isEqualizated', - type: 'boolean' - }, - { - arg: 'isTaxDataVerified', - type: 'boolean' - }, - { - arg: 'isTaxDataChecked', - type: 'boolean' - }, - { - arg: 'despiteOfClient', - type: 'number' - }, - { - arg: 'hasIncoterms', - type: 'boolean' - }, - { - arg: 'hasElectronicInvoice', - type: 'boolean' - } -]; module.exports = Self => { Self.remoteMethod('updateFiscalData', { @@ -108,9 +17,92 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'data', - type: 'object', - http: {source: 'body'} + arg: 'socialName', + type: 'string' + }, + { + arg: 'fi', + type: 'string' + }, + { + arg: 'street', + type: 'string' + }, + { + arg: 'postcode', + type: 'string' + }, + { + arg: 'city', + type: 'string' + }, + { + arg: 'countryFk', + type: 'number' + }, + { + arg: 'provinceFk', + type: 'number' + }, + { + arg: 'sageTaxTypeFk', + type: 'any' + }, + { + arg: 'sageTransactionTypeFk', + type: 'any' + }, + { + arg: 'transferorFk', + type: 'any' + }, + { + arg: 'hasToInvoiceByAddress', + type: 'boolean' + }, + { + arg: 'hasToInvoice', + type: 'boolean' + }, + { + arg: 'isActive', + type: 'boolean' + }, + { + arg: 'isFreezed', + type: 'boolean' + }, + { + arg: 'isVies', + type: 'boolean' + }, + { + arg: 'isToBeMailed', + type: 'boolean' + }, + { + arg: 'isEqualizated', + type: 'boolean' + }, + { + arg: 'isTaxDataVerified', + type: 'boolean' + }, + { + arg: 'isTaxDataChecked', + type: 'boolean' + }, + { + arg: 'despiteOfClient', + type: 'number' + }, + { + arg: 'hasIncoterms', + type: 'boolean' + }, + { + arg: 'hasElectronicInvoice', + type: 'boolean' } ], returns: { @@ -128,7 +120,9 @@ module.exports = Self => { let tx; const myOptions = {}; const models = Self.app.models; - const {args, req: {__: $t}} = ctx; + const args = ctx.args; + const userId = ctx.req.accessToken.userId; + const $t = ctx.req.__; if (typeof options == 'object') Object.assign(myOptions, options); @@ -154,22 +148,8 @@ module.exports = Self => { // Remove unwanted properties delete args.ctx; delete args.id; - const {isValid, tag} = validatorBodyModel(BODY_MODEL, args.data); - if (!isValid) { - const key = $t(`${tag}`); - throw new Error($t('Model is not valid', {key}) - ); - } - // const isValid = client.isValid(async function(valid) { - // if (!valid) { - // cb(new ValidationError(client), client); - // return; - // } - // // triggerSave(); - // }, args.data, myOptions); - // client.isValid(client.constructor.validations, client.data, {}); - const updatedClient = await client.updateAttributes(args.data, myOptions); + const updatedClient = await client.updateAttributes(args, myOptions); if (tx) await tx.commit(); diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index c0f0be14c..271ed8769 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -1,65 +1,3 @@ -const validatorBodyModel = require('../../../../client/back/methods/client/body_model_validator'); - -const BODY_MODEL = [{ - arg: 'name', - type: 'string' -}, -{ - arg: 'nif', - type: 'string' -}, -{ - arg: 'account', - type: 'any' -}, -{ - arg: 'sageTaxTypeFk', - type: 'any' -}, -{ - arg: 'sageWithholdingFk', - type: 'any' -}, -{ - arg: 'sageTransactionTypeFk', - type: 'any' -}, -{ - arg: 'postCode', - type: 'any' -}, -{ - arg: 'street', - type: 'any' -}, -{ - arg: 'city', - type: 'string' -}, -{ - arg: 'provinceFk', - type: 'any' -}, -{ - arg: 'countryFk', - type: 'any' -}, -{ - arg: 'supplierActivityFk', - type: 'string' -}, -{ - arg: 'healthRegister', - type: 'string' -}, -{ - arg: 'isVies', - type: 'boolean' -}, -{ - arg: 'isTrucker', - type: 'boolean' -}]; module.exports = Self => { Self.remoteMethod('updateFiscalData', { description: 'Updates fiscal data of a supplier', @@ -76,11 +14,65 @@ module.exports = Self => { http: {source: 'path'} }, { - arg: 'data', - type: 'object', - http: {source: 'body'} - } - ], + arg: 'name', + type: 'string' + }, + { + arg: 'nif', + type: 'string' + }, + { + arg: 'account', + type: 'any' + }, + { + arg: 'sageTaxTypeFk', + type: 'any' + }, + { + arg: 'sageWithholdingFk', + type: 'any' + }, + { + arg: 'sageTransactionTypeFk', + type: 'any' + }, + { + arg: 'postCode', + type: 'any' + }, + { + arg: 'street', + type: 'any' + }, + { + arg: 'city', + type: 'string' + }, + { + arg: 'provinceFk', + type: 'any' + }, + { + arg: 'countryFk', + type: 'any' + }, + { + arg: 'supplierActivityFk', + type: 'string' + }, + { + arg: 'healthRegister', + type: 'string' + }, + { + arg: 'isVies', + type: 'boolean' + }, + { + arg: 'isTrucker', + type: 'boolean' + }], returns: { arg: 'res', type: 'string', @@ -94,18 +86,13 @@ module.exports = Self => { Self.updateFiscalData = async(ctx, supplierId) => { const models = Self.app.models; - const {args} = ctx; + const args = ctx.args; const supplier = await models.Supplier.findById(supplierId); // Remove unwanted properties delete args.ctx; delete args.id; - const {isValid, tag} = validatorBodyModel(BODY_MODEL, args.data); - if (!isValid) { - const key = $t(`${tag}`); - throw new Error($t('Model is not valid', {key}) - ); - } - return supplier.updateAttributes(args.data); + + return supplier.updateAttributes(args); }; }; From f9ea77fa39f3e26603ea14bf1e54cffb0036bcfe Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Dec 2023 07:38:42 +0100 Subject: [PATCH 029/250] refs #5858 perf: change UserError message --- loopback/server/middleware/error-handler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index e0d32d209..076122aa0 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -16,7 +16,7 @@ const validations = [{ module = module.substring(0, module.length - 1); model = models[module]; } - if (!model) throw new UserError(''); + if (!model) throw new Error('No matching model found'); const {accepts} = model.sharedClass.methods().find(method => method.name === path); for (const [key, value] of Object.entries(body)) { const accept = accepts.find(acc => acc.arg === key); From c8ca855ba960172ffef6eba0146ee0804be83aa5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Dec 2023 07:54:37 +0100 Subject: [PATCH 030/250] refs #5858 perf: revert changes --- modules/supplier/back/models/supplier.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index fbe74286a..5cf357c13 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -17,13 +17,17 @@ module.exports = Self => { message: 'The social name cannot be empty' }); - Self.validatesPresenceOf('city', { - message: 'City cannot be empty' - }); + if (this.city) { + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); + } - Self.validatesPresenceOf('nif', { - message: 'The nif cannot be empty' - }); + if (this.nif) { + Self.validatesPresenceOf('nif', { + message: 'The nif cannot be empty' + }); + } Self.validatesUniquenessOf('nif', { message: 'TIN must be unique' From 8acd03f1159b70fdde9fd11c99d4b06dc6ca2a20 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 11 Dec 2023 13:01:34 +0100 Subject: [PATCH 031/250] refs #6276 saleTrackingReplace --- db/changes/235001/00-newWareHouse.sql | 3 +- .../methods/sale-tracking/updateTracking.js | 100 ++++++++++++++++++ modules/ticket/back/model-config.json | 3 + modules/ticket/back/models/sale-buy.json | 33 ++++++ modules/ticket/back/models/sale-tracking.js | 1 + modules/ticket/back/models/sale-tracking.json | 3 + 6 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 modules/ticket/back/methods/sale-tracking/updateTracking.js create mode 100644 modules/ticket/back/models/sale-buy.json diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index c6f595400..f563ce40c 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -5,4 +5,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), ('MachineWorker','add','READ','ALLOW','ROLE','employee'), ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), - ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file + ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), + ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js new file mode 100644 index 000000000..1f499022e --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -0,0 +1,100 @@ +module.exports = Self => { + Self.remoteMethodCtx('updateTracking', { + description: 'Modify a saleTracking record and, if applicable, add a corresponding record in saleBuy.', + accessType: 'WRITE', + accepts: [ + { + arg: 'saleFk', + type: 'number', + required: true + }, + { + arg: 'originalQuantity', + type: 'number', + required: true + }, + { + arg: 'code', + type: 'string', + required: true + }, + { + arg: 'isChecked', + type: 'number', + required: true + }, + { + arg: 'buyFk', + type: 'number', + required: true + }, + { + arg: 'isScanned', + type: 'number', + }, + ], + http: { + path: `/updateTracking`, + verb: 'POST' + } + }); + + Self.updateTracking = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, options) => { + const userId = ctx.req.accessToken.userId; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const state = await models.State.findOne({ + where: {code}, + }, myOptions); + + const attributes = { + saleFk, + isChecked, + originalQuantity, + workerFk: userId, + stateFk: state.id, + isScanned, + }; + + const saleTracking = await models.SaleTracking.findOne({ + where: attributes, + }, myOptions); + + if (!saleTracking) + await models.SaleTracking.create(attributes, myOptions); + + else + await saleTracking.updateAttributes(attributes, myOptions); + + let isBuy; + if (buyFk) { + isBuy = await models.Buy.findOne({ + where: { + id: buyFk, + itemOriginalFk: { + neq: null + } + } + }); + } + if (isBuy) + await models.SaleBuy.create({saleFk, buyFk}, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index 76a289cc3..db90b55e1 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -65,6 +65,9 @@ "SaleTracking": { "dataSource": "vn" }, + "SaleBuy": { + "dataSource": "vn" + }, "State": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/sale-buy.json b/modules/ticket/back/models/sale-buy.json new file mode 100644 index 000000000..5279e6787 --- /dev/null +++ b/modules/ticket/back/models/sale-buy.json @@ -0,0 +1,33 @@ +{ + "name": "SaleBuy", + "base": "VnModel", + "options": { + "mysql": { + "table": "saleBuy" + } + }, + "properties": { + "saleFk": { + "id": true, + "type": "number", + "forceId": false + }, + "buyFk": { + "type": "number" + }, + "created": { + "type": "date" + }, + "isChecked": { + "type": "number" + } + }, + "relations": { + "sale": { + "type": "belongsTo", + "model": "Sale", + "foreignKey": "saleFk" + } + } +} + \ No newline at end of file diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 54a2b5a1a..4b513a716 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/sale-tracking/listSaleTracking')(Self); require('../methods/sale-tracking/new')(Self); require('../methods/sale-tracking/delete')(Self); + require('../methods/sale-tracking/updateTracking')(Self); }; diff --git a/modules/ticket/back/models/sale-tracking.json b/modules/ticket/back/models/sale-tracking.json index 4a103ea15..5e512f844 100644 --- a/modules/ticket/back/models/sale-tracking.json +++ b/modules/ticket/back/models/sale-tracking.json @@ -26,6 +26,9 @@ }, "originalQuantity": { "type": "number" + }, + "isScanned": { + "type": "number" } }, "relations": { From 3109f7722e867b1f8c9101abe287ba31929aff57 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 12 Dec 2023 13:24:18 +0100 Subject: [PATCH 032/250] refs #6276 saleTracking_mark --- db/changes/235001/00-newWareHouse.sql | 3 +- loopback/locale/en.json | 3 +- loopback/locale/es.json | 3 +- .../ticket/back/methods/sale-tracking/mark.js | 102 ++++++++++++++++++ modules/ticket/back/models/sale-tracking.js | 1 + 5 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 modules/ticket/back/methods/sale-tracking/mark.js diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index f563ce40c..13d5c87ad 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -6,4 +6,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('MachineWorker','add','READ','ALLOW','ROLE','employee'), ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), - ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file + ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), + ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 7d5b5ed47..8ccb7a245 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -200,5 +200,6 @@ "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}}" + "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", + "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 01384efb4..ea8f99805 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -329,5 +329,6 @@ "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima", "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", - "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}" + "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", + "The line could not be marked": "The line could not be marked" } \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js new file mode 100644 index 000000000..f2cb96099 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -0,0 +1,102 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('mark', { + description: 'Insert an itemShelvingSale and Modify a saleTracking record', + accessType: 'WRITE', + accepts: [ + { + arg: 'saleFk', + type: 'number', + required: true + }, + { + arg: 'originalQuantity', + type: 'number', + required: true + }, + { + arg: 'code', + type: 'string', + required: true + }, + { + arg: 'isChecked', + type: 'number', + required: true + }, + { + arg: 'buyFk', + type: 'number', + required: true + }, + { + arg: 'isScanned', + type: 'number', + }, + { + arg: 'quantity', + type: 'number', + required: true + }, + { + arg: 'itemShelvingFk', + type: 'number', + required: true + } + ], + http: { + path: `/mark`, + verb: 'POST' + } + }); + + Self.mark = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => { + const userId = ctx.req.accessToken.userId; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + await models.ItemShelvingSale.create({ + itemShelvingFk, + saleFk, + quantity, + userFk: userId + }, myOptions); + + const itemShelving = await models.ItemShelving.findOne({ + where: { + id: itemShelvingFk + } + }, myOptions); + + if (itemShelving.visible) { + await itemShelving.updateAttributes({ + visible: itemShelving.visible - quantity} + , myOptions); + } + + await Self.updateAll( + {saleFk}, + {isChecked: 1}, + myOptions + ); + + await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw new UserError('The line could not be marked'); + } + }; +}; diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index 4b513a716..f284ec185 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -4,4 +4,5 @@ module.exports = Self => { require('../methods/sale-tracking/new')(Self); require('../methods/sale-tracking/delete')(Self); require('../methods/sale-tracking/updateTracking')(Self); + require('../methods/sale-tracking/mark')(Self); }; From f5ee3aff7ad7660c276de50df7fd20cb9d187702 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 12 Dec 2023 13:43:15 +0100 Subject: [PATCH 033/250] refs #6276 remove checking visible --- modules/ticket/back/methods/sale-tracking/mark.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index f2cb96099..da637a7db 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -79,11 +79,9 @@ module.exports = Self => { } }, myOptions); - if (itemShelving.visible) { - await itemShelving.updateAttributes({ - visible: itemShelving.visible - quantity} - , myOptions); - } + await itemShelving.updateAttributes({ + visible: itemShelving.visible - quantity} + , myOptions); await Self.updateAll( {saleFk}, From 7b81630b8525be8f587085f12a45af96642a5c9c Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 12 Dec 2023 14:56:58 +0100 Subject: [PATCH 034/250] refs #6276 shelvingLog_add --- .../shelving/back/methods/shelving/addLog.js | 55 +++++++++++++++++++ modules/shelving/back/models/shelving.js | 1 + 2 files changed, 56 insertions(+) create mode 100644 modules/shelving/back/methods/shelving/addLog.js diff --git a/modules/shelving/back/methods/shelving/addLog.js b/modules/shelving/back/methods/shelving/addLog.js new file mode 100644 index 000000000..13f9075f1 --- /dev/null +++ b/modules/shelving/back/methods/shelving/addLog.js @@ -0,0 +1,55 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('addLog', { + description: 'Add a new log', + accessType: 'WRITE', + accepts: { + arg: 'code', + type: 'string', + required: true, + }, + http: { + path: '/addLog', + verb: 'POST' + } + }); + Self.addLog = async(ctx, code, options) => { + const userId = ctx.req.accessToken.userId; + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const shelving = await Self.findOne({ + where: { + code + } + }, myOptions); + + if (!shelving) throw new UserError('Shelving not valid'); + + await models.ShelvingLog.create({ + changedModel: 'Shelving', + originFk: shelving.id, + changedModelId: shelving.id, + action: 'select', + userFk: userId + + }, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/shelving/back/models/shelving.js b/modules/shelving/back/models/shelving.js index 3e27f5863..bf611d2ba 100644 --- a/modules/shelving/back/models/shelving.js +++ b/modules/shelving/back/models/shelving.js @@ -1,3 +1,4 @@ module.exports = Self => { require('../methods/shelving/getSummary')(Self); + require('../methods/shelving/addLog')(Self); }; From 9e6fac9addd04b59a446178f518e4bcf48afa69a Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 12 Dec 2023 16:00:43 +0100 Subject: [PATCH 035/250] refs #6276 change to boolean --- modules/ticket/back/methods/sale-tracking/mark.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index da637a7db..a5b8ece52 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -22,7 +22,7 @@ module.exports = Self => { }, { arg: 'isChecked', - type: 'number', + type: 'boolean', required: true }, { @@ -85,7 +85,7 @@ module.exports = Self => { await Self.updateAll( {saleFk}, - {isChecked: 1}, + {isChecked: true}, myOptions ); From 64c10f3b8e5d8b6f2d20ecd2132d25cf0f4a2609 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 13 Dec 2023 08:52:43 +0100 Subject: [PATCH 036/250] refs #6276 sectorCollection_getSales --- .../back/methods/item-shelving/getSale.js | 58 +++++++++++++++++++ modules/item/back/models/item-shelving.js | 1 + 2 files changed, 59 insertions(+) create mode 100644 modules/item/back/methods/item-shelving/getSale.js diff --git a/modules/item/back/methods/item-shelving/getSale.js b/modules/item/back/methods/item-shelving/getSale.js new file mode 100644 index 000000000..084f7351f --- /dev/null +++ b/modules/item/back/methods/item-shelving/getSale.js @@ -0,0 +1,58 @@ +module.exports = Self => { + Self.remoteMethod('getSale', { + description: 'Update the visible items', + accessType: 'WRITE', + accepts: [ + { + arg: 'sectorCollectionFk', + type: 'number', + required: true, + }, + { + arg: 'sectorFk', + type: 'number', + required: true + } + ], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/getSale`, + verb: 'GET' + }, + }); + + Self.getSale = async(sectorCollectionFk, sectorFk, options) => { + const myOptions = {}; + + if (typeof options == 'object') Object.assign(myOptions, options); + + const sales = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]); + + const itemShelvings = []; + for (let sale of sales) { + const [carros] = await Self.rawSql( + 'CALL vn.itemPlacementSupplyStockGetTargetList(?, ?)', + [sale.itemFk, sectorFk] + ); + + itemShelvings.push({ + id: sale.ticketFk, + itemFk: sale.itemFk, + longName: sale.longName, + packingType: sale.itemPackingTypeFk, + subName: sale.subName, + quantity: {saldo: sale.quantity}, + trabajador: sale.workerCode, + idMovimiento: sale.saleFk, + salesPersonFk: sale.salesPersonFk, + picked: sale.pickedQuantity, + carros + }); + } + + return itemShelvings; + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 4eb5374e8..e349b9c34 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -4,4 +4,5 @@ module.exports = Self => { require('../methods/item-shelving/makeMulti')(Self); require('../methods/item-shelving/return')(Self); require('../methods/item-shelving/updateFromSale')(Self); + require('../methods/item-shelving/getSale')(Self); }; From a4c3d78e31d1581c3a28c3f9973c9b282957bdf9 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 13 Dec 2023 09:45:01 +0100 Subject: [PATCH 037/250] refs #6276 drop fixtures & fix getSale --- db/dump/fixtures.sql | 673 +----------------- .../back/methods/item-shelving/getSale.js | 2 +- 2 files changed, 2 insertions(+), 673 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index d3bb4257f..dd1d0951e 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3008,675 +3008,4 @@ INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`) VALUES (1, 'Error in VAT calculation'), (2, 'Error in sales details'), - (3, 'Error in customer data'); - - -/* - Se necesitan, para hacer un simulacro de pedido, lo siguiente: - - - Warehouse 999 - - Sectores - - Normal 9991 - - Previa 9992 - - Altillo 9993 - - Parkings - - Normal A-01-1, A-02-2, B-03-3, B-04-4, C-05-5 - - Previa P-01-1, P-02-2, P-03-3 - - Altillo M-01-1, M-02-2, M-03-3 - - Shelvings - - Normal NAA, NBB, NCC, NDD, NEE - - Previa PAA, PBB, PCC - - Altillo MAA, MBB, MCC - - Items - * Normal - * Previa: - - Ticket - - Sales - -*/ - -INSERT IGNORE INTO intrastat - SET id = 44219999, - description = 'Manufacturas de madera', - taxClassFk = 1, - taxCodeFk = 1; - -INSERT IGNORE INTO warehouse - SET id = 999, - name = 'TestingWarehouse', - hasAvailable = TRUE, - isForTicket = TRUE, - isInventory = TRUE, - hasUbications = TRUE, - hasProduction = TRUE; - -INSERT IGNORE INTO sector - SET id = 9991, - description = 'NormalSector', - warehouseFk = 999, - isPreviousPreparedByPacking = FALSE, - code = 'NS', - isPreviousPrepared = FALSE, - isPackagingArea = FALSE, - sonFk = NULL, - isMain = TRUE, - itemPackingTypeFk = NULL; - -INSERT IGNORE INTO sector - SET id = 9992, - description = 'PreviousSector', - warehouseFk = 999, - isPreviousPreparedByPacking = FALSE, - code = 'PS', - isPreviousPrepared = TRUE, - isPackagingArea = FALSE, - sonFk = NULL, - isMain = TRUE, - itemPackingTypeFk = NULL; - -INSERT IGNORE INTO sector - SET id = 9993, - description = 'MezaninneSector', - warehouseFk = 999, - isPreviousPreparedByPacking = TRUE, - code = 'MS', - isPreviousPrepared = FALSE, - isPackagingArea = FALSE, - sonFk = 9991, - isMain = TRUE, - itemPackingTypeFk = NULL; - -REPLACE parking SET id = 9991011, sectorFk = 9991, code = 'A-01-1', pickingOrder = 1; -REPLACE parking SET id = 9991012, sectorFk = 9991, code = 'A-02-2', pickingOrder = 2; -REPLACE parking SET id = 9991013, sectorFk = 9991, code = 'A-03-3', pickingOrder = 3; -REPLACE parking SET id = 9991014, sectorFk = 9991, code = 'A-04-4', pickingOrder = 4; -REPLACE parking SET id = 9991015, sectorFk = 9991, code = 'A-05-5', pickingOrder = 5; - -REPLACE parking SET id = 9992011, sectorFk = 9992, code = 'P-01-1', pickingOrder = 6; -REPLACE parking SET id = 9992012, sectorFk = 9992, code = 'P-02-2', pickingOrder = 7; -REPLACE parking SET id = 9992013, sectorFk = 9992, code = 'P-03-3', pickingOrder = 8; - -REPLACE parking SET id = 9993011, sectorFk = 9993, code = 'M-01-1', pickingOrder = 9; -REPLACE parking SET id = 9993012, sectorFk = 9993, code = 'M-02-2', pickingOrder = 10; -REPLACE parking SET id = 9993013, sectorFk = 9993, code = 'M-03-3', pickingOrder = 11; - -REPLACE shelving SET code = 'NAA', parkingFk = 9991011, priority = 1; -REPLACE shelving SET code = 'NBB', parkingFk = 9991012, priority = 1; -REPLACE shelving SET code = 'NCC', parkingFk = 9991013, priority = 1; -REPLACE shelving SET code = 'NDD', parkingFk = 9991014, priority = 1; -REPLACE shelving SET code = 'NEE', parkingFk = 9991015, priority = 1; - -REPLACE shelving SET code = 'PAA', parkingFk = 9992011, priority = 1; -REPLACE shelving SET code = 'PBB', parkingFk = 9992012, priority = 1; -REPLACE shelving SET code = 'PCC', parkingFk = 9992013, priority = 1; - -REPLACE shelving SET code = 'MAA', parkingFk = 9993011, priority = 1; -REPLACE shelving SET code = 'MBB', parkingFk = 9993012, priority = 1; -REPLACE shelving SET code = 'MCC', parkingFk = 9993013, priority = 1; - -INSERT IGNORE INTO itemType - SET id = 999, - code = 'WOO', - name = 'Wood Objects', - categoryFk = 3, - workerFk = 103, - isInventory = TRUE, - life = 10, - density = 250, - itemPackingTypeFk = NULL, - temperatureFk = 'warm'; - -INSERT IGNORE INTO travel - SET id = 99, - shipped = CURDATE(), - landed = CURDATE(), - warehouseInFk = 999, - warehouseOutFk = 1, - isReceived = TRUE, - agencyFk = 1; - -REPLACE entry - SET id = 999, - supplierFk = 791, - isConfirmed = TRUE, - dated = CURDATE(), - travelFk = 99, - companyFk = 442; - -REPLACE ticket - SET id = 999999, - clientFk = 2, - warehouseFk = 999, - shipped = CURDATE(), - nickname = 'Cliente', - addressFk = 1, - companyFk = 442, - agencyModeFk = 10, - landed = CURDATE(); - -REPLACE collection - SET id = 10101010, - workerFk = 103; - -INSERT IGNORE INTO ticketCollection - SET id = 10101010, - ticketFk = 999999, - collectionFk = 10101010; - -REPLACE item - SET id = 999991, - name = 'Palito para pinchos', - `size` = 25, - stems = NULL, - category = 'EXT', - typeFk = 999, - longName = 'Palito para pinchos', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 6, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999991, - entryFk = 999, - itemFk = 999991, - quantity = 8, - buyingValue = 0.61, - stickers = 1, - packing = 20, - `grouping` = 1, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 50; - -REPLACE sale - SET id = 99991, - itemFk = 999991, - ticketFk = 999999, - concept = 'Palito para pinchos', - quantity = 3, - price = 1, - discount = 0; - -REPLACE item - SET id = 999992, - name = 'Madera verde', - `size` = 10, - stems = NULL, - category = 'EXT', - typeFk = 999, - longName = 'Madera verde', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 50, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999992, - entryFk = 999, - itemFk = 999992, - quantity = 40, - buyingValue = 0.62, - stickers = 1, - packing = 40, - `grouping` = 5, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 25; - -REPLACE sale - SET id = 99992, - itemFk = 999992, - ticketFk = 999999, - concept = 'Madera Verde', - quantity = 10, - price = 1, - discount = 0; - -REPLACE item - SET id = 999993, - name = 'Madera Roja/Morada', - `size` = 12, - stems = 2, - category = 'EXT', - typeFk = 999, - longName = 'Madera Roja/Morada', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 35, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999993, - entryFk = 999, - itemFk = 999993, - quantity = 20, - buyingValue = 0.63, - stickers = 2, - packing = 10, - `grouping` = 5, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 25; - -REPLACE itemShelving - SET id = 9931, - itemFk = 999993, - shelvingFk = 'NCC', - visible = 10, - `grouping` = 5, - packing = 10; - -REPLACE sale - SET id = 99993, - itemFk = 999993, - ticketFk = 999999, - concept = 'Madera Roja/Morada', - quantity = 15, - price = 1, - discount = 0; - -REPLACE item - SET id = 999994, - name = 'Madera Naranja', - `size` = 18, - stems = 1, - category = 'EXT', - typeFk = 999, - longName = 'Madera Naranja', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 160, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999994, - entryFk = 999, - itemFk = 999994, - quantity = 20, - buyingValue = 0.64, - stickers = 1, - packing = 20, - `grouping` = 4, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 25; - -REPLACE sale - SET id = 99994, - itemFk = 999994, - ticketFk = 999999, - concept = 'Madera Naranja', - quantity = 4, - price = 1, - discount = 0; - -REPLACE item - SET id = 999995, - name = 'Madera Amarilla', - `size` = 11, - stems = 5, - category = 'EXT', - typeFk = 999, - longName = 'Madera Amarilla', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 78, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999995, - entryFk = 999, - itemFk = 999995, - quantity = 4, - buyingValue = 0.65, - stickers = 1, - packing = 20, - `grouping` = 1, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 35; - -REPLACE sale - SET id = 99995, - itemFk = 999995, - ticketFk = 999999, - concept = 'Madera Amarilla', - quantity = 5, - price = 1, - discount = 0; - --- Palito naranja -REPLACE item - SET id = 999998, - name = 'Palito naranja', - `size` = 11, - stems = 1, - category = 'EXT', - typeFk = 999, - longName = 'Palito naranja', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 78, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999998, - entryFk = 999, - itemFk = 999998, - quantity = 80, - buyingValue = 0.65, - stickers = 1, - packing = 200, - `grouping` = 30, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 35; - -REPLACE sale - SET id = 99998, - itemFk = 999998, - ticketFk = 999999, - concept = 'Palito naranja', - quantity = 60, - price = 1, - discount = 0; - --- Palito amarillo -REPLACE item - SET id = 999999, - name = 'Palito amarillo', - `size` = 11, - stems = 1, - category = 'EXT', - typeFk = 999, - longName = 'Palito amarillo', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 78, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999999, - entryFk = 999, - itemFk = 999999, - quantity = 70, - buyingValue = 0.65, - stickers = 1, - packing = 500, - `grouping` = 10, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 35; - -REPLACE sale - SET id = 99999, - itemFk = 999999, - ticketFk = 999999, - concept = 'Palito amarillo', - quantity = 50, - price = 1, - discount = 0; - --- Palito azul -REPLACE item - SET id = 1000000, - name = 'Palito azul', - `size` = 10, - stems = 1, - category = 'EXT', - typeFk = 999, - longName = 'Palito azul', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 78, - intrastatFk = 44219999; - -REPLACE buy - SET id = 10000000, - entryFk = 999, - itemFk = 1000000, - quantity = 75, - buyingValue = 0.65, - stickers = 2, - packing = 300, - `grouping` = 50, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 35; - -REPLACE sale - SET id = 100000, - itemFk = 1000000, - ticketFk = 999999, - concept = 'Palito azul', - quantity = 50, - price = 1, - discount = 0; - --- Palito rojo -REPLACE item - SET id = 1000001, - name = 'Palito rojo', - `size` = 10, - stems = NULL, - category = 'EXT', - typeFk = 999, - longName = 'Palito rojo', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 78, - intrastatFk = 44219999; - -REPLACE buy - SET id = 10000001, - entryFk = 999, - itemFk = 1000001, - quantity = 12, - buyingValue = 0.65, - stickers = 2, - packing = 50, - `grouping` = 5, - groupingMode = 1, - packageFk = 94, - price1 = 1, - price2 = 1, - price3 = 1, - minPrice = 1, - weight = 35; - - -REPLACE sale - SET id = 100001, - itemFk = 1000001, - ticketFk = 999999, - concept = 'Palito rojo', - quantity = 10, - price = 1, - discount = 0; - --- Previa -INSERT IGNORE INTO item - SET id = 999996, - name = 'Bolas de madera', - `size` = 2, - stems = 4, - category = 'EXT', - typeFk = 999, - longName = 'Bolas de madera', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 20, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999996, - entryFk = 999, - itemFk = 999996, - quantity = 5, - buyingValue = 3, - stickers = 1, - packing = 5, - `grouping` = 2, - groupingMode = 1, - packageFk = 94, - price1 = 7, - price2 = 7, - price3 = 7, - minPrice = 7, - weight = 80; - -REPLACE sale - SET id = 99996, - itemFk = 999996, - ticketFk = 999999, - concept = 'Bolas de madera', - quantity = 4, - price = 7, - discount = 0, - isPicked = TRUE; - -INSERT IGNORE INTO item - SET id = 999997, - name = 'Palitos de polo MIX', - `size` = 14, - stems = NULL, - category = 'EXT', - typeFk = 999, - longName = 'Palitos de polo MIX', - itemPackingTypeFk = NULL, - originFk = 1, - weightByPiece = 20, - intrastatFk = 44219999; - -REPLACE buy - SET id = 9999997, - entryFk = 999, - itemFk = 999997, - quantity = 100, - buyingValue = 3.2, - stickers = 1, - packing = 100, - `grouping` = 5, - groupingMode = 1, - packageFk = 94, - price1 = 7, - price2 = 7, - price3 = 7, - minPrice = 7, - weight = 80; - -REPLACE sale - SET id = 99997, - itemFk = 999997, - ticketFk = 999999, - concept = 'Palitos de polo MIX', - quantity = 5, - price = 7, - discount = 0; - --- Ubicación -DELETE ish.* - FROM itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - JOIN sector s ON s.id = p.sectorFk - JOIN warehouse w ON w.id = s.warehouseFk - WHERE w.name = 'TestingWarehouse'; - -REPLACE vn.itemShelving -(id, itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) -VALUES - (9911, 999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL), - (9912, 999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL), - (9913, 1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL), - (9914, 1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL), - (9915, 999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL), - (9916, 999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL), - (9917, 999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL), - (9918, 999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL), - (9919, 999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL), - (9920, 999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL), - (9921, 999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL), - (9922, 1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL), - (9923, 999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL), - (9924, 1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL), - (9925, 999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL), - (9926, 999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL); - --- Previous for Bolas de madera -INSERT IGNORE INTO sectorCollection - SET id = 99, - userFk = 1, - sectorFk = 9992; - -INSERT IGNORE INTO saleGroup - SET id = 999, - userFk = 1, - parkingFk = 9992011, - sectorFk = 9992; - -INSERT IGNORE INTO sectorCollectionSaleGroup - SET id = 9999, - sectorCollectionFk = 99, - saleGroupFk = 999; - -REPLACE saleGroupDetail - SET id = 99991, - saleFk = 99996, - saleGroupFk = 999; - -REPLACE saleTracking - SET saleFk = 99996, - isChecked = TRUE, - workerFk = 103, - stateFk = 28; - -INSERT IGNORE INTO itemShelvingSale - SET id = 991, - itemShelvingFk = 9962, - saleFk = 99996, - quantity = 5, - userFk = 1; - - -CALL itemShelvingSale_reserveByCollection(10101010); - -UPDATE vn.collection - SET workerFk=9 - WHERE id=10101010; - -INSERT INTO `vn`.`machineWorkerConfig` (id, maxHours) - VALUES (1, 12) \ No newline at end of file + (3, 'Error in customer data'); \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/getSale.js b/modules/item/back/methods/item-shelving/getSale.js index 084f7351f..826ac03e1 100644 --- a/modules/item/back/methods/item-shelving/getSale.js +++ b/modules/item/back/methods/item-shelving/getSale.js @@ -29,7 +29,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const sales = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]); + const [sales] = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]); const itemShelvings = []; for (let sale of sales) { From 8d61473d4f7fe0e2471f1b9d1a5c075785dd64f8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 13 Dec 2023 11:43:19 +0100 Subject: [PATCH 038/250] refs #6276 fixtures & itemBarcode_delete --- db/changes/235001/00-newWareHouse.sql | 3 +- db/dump/fixtures.sql | 655 +++++++++++++++++- .../item/back/methods/item-barcode/delete.js | 34 + modules/item/back/models/item-barcode.js | 1 + 4 files changed, 691 insertions(+), 2 deletions(-) create mode 100644 modules/item/back/methods/item-barcode/delete.js diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 13d5c87ad..57e3398ff 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -7,4 +7,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), - ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file + ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), + ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index dd1d0951e..40264e987 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3008,4 +3008,657 @@ INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`) VALUES (1, 'Error in VAT calculation'), (2, 'Error in sales details'), - (3, 'Error in customer data'); \ No newline at end of file + (3, 'Error in customer data'); + + +-- NEW WAREHOUSE + +UPDATE vn.packaging + SET id='--' + WHERE id='pallet 100'; + +INSERT IGNORE INTO vn.intrastat + SET id = 44219999, + description = 'Manufacturas de madera', + taxClassFk = 1, + taxCodeFk = 1; + +INSERT IGNORE INTO vn.warehouse + SET id = 999, + name = 'TestingWarehouse', + hasAvailable = TRUE, + isForTicket = TRUE, + isInventory = TRUE, + hasUbications = TRUE, + hasProduction = TRUE; + +INSERT IGNORE INTO vn.sector + SET id = 9991, + description = 'NormalSector', + warehouseFk = 999, + isPreviousPreparedByPacking = FALSE, + code = 'NS', + isPreviousPrepared = FALSE, + isPackagingArea = FALSE, + sonFk = NULL, + isMain = TRUE, + itemPackingTypeFk = NULL; + +INSERT IGNORE INTO vn.sector + SET id = 9992, + description = 'PreviousSector', + warehouseFk = 999, + isPreviousPreparedByPacking = FALSE, + code = 'PS', + isPreviousPrepared = TRUE, + isPackagingArea = FALSE, + sonFk = NULL, + isMain = TRUE, + itemPackingTypeFk = NULL; + +INSERT IGNORE INTO vn.sector + SET id = 9993, + description = 'MezaninneSector', + warehouseFk = 999, + isPreviousPreparedByPacking = TRUE, + code = 'MS', + isPreviousPrepared = FALSE, + isPackagingArea = FALSE, + sonFk = 9991, + isMain = TRUE, + itemPackingTypeFk = NULL; + +REPLACE vn.parking SET id = 9991011, sectorFk = 9991, code = 'A-01-1', pickingOrder = 1; +REPLACE vn.parking SET id = 9991012, sectorFk = 9991, code = 'A-02-2', pickingOrder = 2; +REPLACE vn.parking SET id = 9991013, sectorFk = 9991, code = 'A-03-3', pickingOrder = 3; +REPLACE vn.parking SET id = 9991014, sectorFk = 9991, code = 'A-04-4', pickingOrder = 4; +REPLACE vn.parking SET id = 9991015, sectorFk = 9991, code = 'A-05-5', pickingOrder = 5; + +REPLACE vn.parking SET id = 9992011, sectorFk = 9992, code = 'P-01-1', pickingOrder = 6; +REPLACE vn.parking SET id = 9992012, sectorFk = 9992, code = 'P-02-2', pickingOrder = 7; +REPLACE vn.parking SET id = 9992013, sectorFk = 9992, code = 'P-03-3', pickingOrder = 8; + +REPLACE vn.parking SET id = 9993011, sectorFk = 9993, code = 'M-01-1', pickingOrder = 9; +REPLACE vn.parking SET id = 9993012, sectorFk = 9993, code = 'M-02-2', pickingOrder = 10; +REPLACE vn.parking SET id = 9993013, sectorFk = 9993, code = 'M-03-3', pickingOrder = 11; + +REPLACE vn.shelving SET code = 'NAA', parkingFk = 9991011, priority = 1; +REPLACE vn.shelving SET code = 'NBB', parkingFk = 9991012, priority = 1; +REPLACE vn.shelving SET code = 'NCC', parkingFk = 9991013, priority = 1; +REPLACE vn.shelving SET code = 'NDD', parkingFk = 9991014, priority = 1; +REPLACE vn.shelving SET code = 'NEE', parkingFk = 9991015, priority = 1; + +REPLACE vn.shelving SET code = 'PAA', parkingFk = 9992011, priority = 1; +REPLACE vn.shelving SET code = 'PBB', parkingFk = 9992012, priority = 1; +REPLACE vn.shelving SET code = 'PCC', parkingFk = 9992013, priority = 1; + +REPLACE vn.shelving SET code = 'MAA', parkingFk = 9993011, priority = 1; +REPLACE vn.shelving SET code = 'MBB', parkingFk = 9993012, priority = 1; +REPLACE vn.shelving SET code = 'MCC', parkingFk = 9993013, priority = 1; + +INSERT IGNORE INTO vn.itemType + SET id = 999, + code = 'WOO', + name = 'Wood Objects', + categoryFk = 3, + workerFk = 103, + isInventory = TRUE, + life = 10, + density = 250, + itemPackingTypeFk = NULL, + temperatureFk = 'warm'; + +INSERT IGNORE INTO vn.travel + SET id = 99, + shipped = CURDATE(), + landed = CURDATE(), + warehouseInFk = 999, + warehouseOutFk = 1, + isReceived = TRUE, + agencyFk = 1; + +REPLACE vn.entry + SET id = 999, + supplierFk = 791, + isConfirmed = TRUE, + dated = CURDATE(), + travelFk = 99, + companyFk = 442; + +REPLACE vn.ticket + SET id = 999999, + clientFk = 2, + warehouseFk = 999, + shipped = CURDATE(), + nickname = 'Cliente', + addressFk = 1, + companyFk = 442, + agencyModeFk = 10, + landed = CURDATE(); + +REPLACE vn.collection + SET id = 10101010, + workerFk = 9; + +INSERT IGNORE INTO vn.ticketCollection + SET id = 10101010, + ticketFk = 999999, + collectionFk = 10101010; + +REPLACE vn.item + SET id = 999991, + name = 'Palito para pinchos', + `size` = 25, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Palito para pinchos', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 6, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999991, + entryFk = 999, + itemFk = 999991, + quantity = 8, + buyingValue = 0.61, + stickers = 1, + packing = 20, + `grouping` = 1, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 50; + +REPLACE vn.sale + SET id = 99991, + itemFk = 999991, + ticketFk = 999999, + concept = 'Palito para pinchos', + quantity = 3, + price = 1, + discount = 0; + +REPLACE vn.item + SET id = 999992, + name = 'Madera verde', + `size` = 10, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Madera verde', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 50, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999992, + entryFk = 999, + itemFk = 999992, + quantity = 40, + buyingValue = 0.62, + stickers = 1, + packing = 40, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 25; + +REPLACE vn.sale + SET id = 99992, + itemFk = 999992, + ticketFk = 999999, + concept = 'Madera Verde', + quantity = 10, + price = 1, + discount = 0; + +REPLACE vn.item + SET id = 999993, + name = 'Madera Roja/Morada', + `size` = 12, + stems = 2, + category = 'EXT', + typeFk = 999, + longName = 'Madera Roja/Morada', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 35, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999993, + entryFk = 999, + itemFk = 999993, + quantity = 20, + buyingValue = 0.63, + stickers = 2, + packing = 10, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 25; + +REPLACE vn.itemShelving + SET id = 9931, + itemFk = 999993, + shelvingFk = 'NCC', + visible = 10, + `grouping` = 5, + packing = 10; + +REPLACE vn.sale + SET id = 99993, + itemFk = 999993, + ticketFk = 999999, + concept = 'Madera Roja/Morada', + quantity = 15, + price = 1, + discount = 0; + +REPLACE vn.item + SET id = 999994, + name = 'Madera Naranja', + `size` = 18, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Madera Naranja', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 160, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999994, + entryFk = 999, + itemFk = 999994, + quantity = 20, + buyingValue = 0.64, + stickers = 1, + packing = 20, + `grouping` = 4, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 25; + +REPLACE vn.sale + SET id = 99994, + itemFk = 999994, + ticketFk = 999999, + concept = 'Madera Naranja', + quantity = 4, + price = 1, + discount = 0; + +REPLACE vn.item + SET id = 999995, + name = 'Madera Amarilla', + `size` = 11, + stems = 5, + category = 'EXT', + typeFk = 999, + longName = 'Madera Amarilla', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999995, + entryFk = 999, + itemFk = 999995, + quantity = 4, + buyingValue = 0.65, + stickers = 1, + packing = 20, + `grouping` = 1, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE vn.sale + SET id = 99995, + itemFk = 999995, + ticketFk = 999999, + concept = 'Madera Amarilla', + quantity = 5, + price = 1, + discount = 0; + +-- Palito naranja +REPLACE vn.item + SET id = 999998, + name = 'Palito naranja', + `size` = 11, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Palito naranja', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999998, + entryFk = 999, + itemFk = 999998, + quantity = 80, + buyingValue = 0.65, + stickers = 1, + packing = 200, + `grouping` = 30, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE vn.sale + SET id = 99998, + itemFk = 999998, + ticketFk = 999999, + concept = 'Palito naranja', + quantity = 60, + price = 1, + discount = 0; + +-- Palito amarillo +REPLACE vn.item + SET id = 999999, + name = 'Palito amarillo', + `size` = 11, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Palito amarillo', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999999, + entryFk = 999, + itemFk = 999999, + quantity = 70, + buyingValue = 0.65, + stickers = 1, + packing = 500, + `grouping` = 10, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE vn.sale + SET id = 99999, + itemFk = 999999, + ticketFk = 999999, + concept = 'Palito amarillo', + quantity = 50, + price = 1, + discount = 0; + +-- Palito azul +REPLACE vn.item + SET id = 1000000, + name = 'Palito azul', + `size` = 10, + stems = 1, + category = 'EXT', + typeFk = 999, + longName = 'Palito azul', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 10000000, + entryFk = 999, + itemFk = 1000000, + quantity = 75, + buyingValue = 0.65, + stickers = 2, + packing = 300, + `grouping` = 50, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + +REPLACE vn.sale + SET id = 100000, + itemFk = 1000000, + ticketFk = 999999, + concept = 'Palito azul', + quantity = 50, + price = 1, + discount = 0; + +-- Palito rojo +REPLACE vn.item + SET id = 1000001, + name = 'Palito rojo', + `size` = 10, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Palito rojo', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 78, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 10000001, + entryFk = 999, + itemFk = 1000001, + quantity = 12, + buyingValue = 0.65, + stickers = 2, + packing = 50, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 1, + price2 = 1, + price3 = 1, + minPrice = 1, + weight = 35; + + +REPLACE vn.sale + SET id = 100001, + itemFk = 1000001, + ticketFk = 999999, + concept = 'Palito rojo', + quantity = 10, + price = 1, + discount = 0; + +-- Previa +INSERT IGNORE INTO vn.item + SET id = 999996, + name = 'Bolas de madera', + `size` = 2, + stems = 4, + category = 'EXT', + typeFk = 999, + longName = 'Bolas de madera', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 20, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999996, + entryFk = 999, + itemFk = 999996, + quantity = 5, + buyingValue = 3, + stickers = 1, + packing = 5, + `grouping` = 2, + groupingMode = 1, + packageFk = 94, + price1 = 7, + price2 = 7, + price3 = 7, + minPrice = 7, + weight = 80; + +REPLACE vn.sale + SET id = 99996, + itemFk = 999996, + ticketFk = 999999, + concept = 'Bolas de madera', + quantity = 4, + price = 7, + discount = 0, + isPicked = TRUE; + +INSERT IGNORE INTO vn.item + SET id = 999997, + name = 'Palitos de polo MIX', + `size` = 14, + stems = NULL, + category = 'EXT', + typeFk = 999, + longName = 'Palitos de polo MIX', + itemPackingTypeFk = NULL, + originFk = 1, + weightByPiece = 20, + intrastatFk = 44219999; + +REPLACE vn.buy + SET id = 9999997, + entryFk = 999, + itemFk = 999997, + quantity = 100, + buyingValue = 3.2, + stickers = 1, + packing = 100, + `grouping` = 5, + groupingMode = 1, + packageFk = 94, + price1 = 7, + price2 = 7, + price3 = 7, + minPrice = 7, + weight = 80; + +REPLACE vn.sale + SET id = 99997, + itemFk = 999997, + ticketFk = 999999, + concept = 'Palitos de polo MIX', + quantity = 5, + price = 7, + discount = 0; + +USE vn; +DELETE ish.* FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.warehouse w ON w.id = s.warehouseFk + WHERE w.name = 'TestingWarehouse'; + +REPLACE vn.itemShelving +(id, itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) +VALUES + (9911, 999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL), + (9912, 999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL), + (9913, 1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL), + (9914, 1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL), + (9915, 999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL), + (9916, 999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL), + (9917, 999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL), + (9918, 999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL), + (9919, 999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL), + (9920, 999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL), + (9921, 999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL), + (9922, 1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL), + (9923, 999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL), + (9924, 1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL), + (9925, 999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL), + (9926, 999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL); + +-- Previous for Bolas de madera +INSERT IGNORE INTO vn.sectorCollection + SET id = 99, + userFk = 1, + sectorFk = 9992; + +INSERT IGNORE INTO vn.saleGroup + SET id = 999, + userFk = 1, + parkingFk = 9992011, + sectorFk = 9992; + +INSERT IGNORE INTO vn.sectorCollectionSaleGroup + SET id = 9999, + sectorCollectionFk = 99, + saleGroupFk = 999; + +REPLACE vn.saleGroupDetail + SET id = 99991, + saleFk = 99996, + saleGroupFk = 999; + +REPLACE vn.saleTracking + SET saleFk = 99996, + isChecked = TRUE, + workerFk = 103, + stateFk = 28; + +INSERT IGNORE INTO vn.itemShelvingSale + SET id = 991, + itemShelvingFk = 9962, + saleFk = 99996, + quantity = 5, + userFk = 1; + +UPDATE vn.ticket + SET zoneFk=1 + WHERE id=999999; + +UPDATE vn.collection + SET workerFk=9 + WHERE id=10101010; + +UPDATE vn.sale + SET isPicked =FALSE; \ No newline at end of file diff --git a/modules/item/back/methods/item-barcode/delete.js b/modules/item/back/methods/item-barcode/delete.js new file mode 100644 index 000000000..b27782b1b --- /dev/null +++ b/modules/item/back/methods/item-barcode/delete.js @@ -0,0 +1,34 @@ +module.exports = Self => { + Self.remoteMethod('delete', { + description: 'Delete an ItemBarcode by itemFk and code', + accessType: 'READ', + accepts: [ + { + arg: 'barcode', + type: 'string', + required: true, + }, + { + arg: 'itemFk', + type: 'number', + required: true, + } + ], + http: { + path: `/delete`, + verb: 'DELETE' + } + }); + + Self.delete = async(barcode, itemFk, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + await Self.destroyAll({ + code: barcode, + itemFk + }, myOptions); + }; +}; diff --git a/modules/item/back/models/item-barcode.js b/modules/item/back/models/item-barcode.js index b608a7fe9..616d973e1 100644 --- a/modules/item/back/models/item-barcode.js +++ b/modules/item/back/models/item-barcode.js @@ -1,5 +1,6 @@ module.exports = Self => { require('../methods/item-barcode/toItem')(Self); + require('../methods/item-barcode/delete')(Self); Self.validatesUniquenessOf('code', { message: `Barcode must be unique` From 36a9b0eee447157f49f3a0571f581f7a5122c485 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 13 Dec 2023 16:00:07 +0100 Subject: [PATCH 039/250] refs #6276 collectionAddItem --- back/methods/collection/addItem.js | 60 +++++++++++++++++++++++++++ back/models/collection.js | 1 + db/changes/235001/00-newWareHouse.sql | 3 +- modules/ticket/back/models/sale.js | 5 ++- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 back/methods/collection/addItem.js diff --git a/back/methods/collection/addItem.js b/back/methods/collection/addItem.js new file mode 100644 index 000000000..4538a479c --- /dev/null +++ b/back/methods/collection/addItem.js @@ -0,0 +1,60 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethodCtx('addItem', { + description: 'Add a collection', + accessType: 'WRITE', + accepts: [ + { + arg: 'code', + type: 'string', + required: true + }, + { + arg: 'quantity', + type: 'number', + required: true + }, + { + arg: 'ticketFk', + type: 'number', + required: true + }, + { + arg: 'warehouseFk', + type: 'number', + required: true + }, + ], + http: { + path: `/addItem`, + verb: 'POST' + }, + }); + + Self.addItem = async(ctx, code, quantity, ticketFk, warehouseFk, options) => { + const models = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk]); + + if (!item.available) throw new UserError('We do not have availability for the selected item'); + + await models.Ticket.addSale(ctx, ticketFk, item.id, quantity, myOptions); + + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/back/models/collection.js b/back/models/collection.js index a0d34712f..0d5be170b 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -5,4 +5,5 @@ module.exports = Self => { require('../methods/collection/previousLabel')(Self); require('../methods/collection/getTickets')(Self); require('../methods/collection/assignCollection')(Self); + require('../methods/collection/addItem')(Self); }; diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 57e3398ff..8437d8e15 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -8,4 +8,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), - ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file + ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'), + ('Collection','addItem','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 3589eac4b..d6f06d744 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -71,7 +71,8 @@ module.exports = Self => { }, ctx.options); if (item.family == 'EMB') return; - if (await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*')) return; + const isInPreparing = await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*'); + if (!ctx.isNEwInstance && isInPreparing) return; await models.Sale.rawSql(`CALL catalog_calcFromItem(?,?,?,?)`, [ ticket.landed, @@ -89,7 +90,7 @@ module.exports = Self => { if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return; - if (newQuantity < item.minQuantity && newQuantity != available) + if (newQuantity < item.minQuantity && newQuantity != available && !isInPreparing) throw new UserError('The amount cannot be less than the minimum'); if (ctx.isNewInstance || isReduction) return; From fb524e2f14d21946e0954786a2d57b46ba97cfc0 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 14 Dec 2023 11:58:42 +0100 Subject: [PATCH 040/250] refs #5878 perf: handleError --- loopback/locale/es.json | 28 +++++----- loopback/server/middleware/error-handler.js | 57 ++++++++++++++++++--- 2 files changed, 66 insertions(+), 19 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 83dc81d77..b5bf25bcc 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -335,21 +335,23 @@ "Model is not valid": "El campo \" {{key}}\" no es válido", "Property is not defined in this model": "La propiedad que ha modificado no existe", "postCode": "Código postal", - "postcode": "Código postal", + "postcode": "Código postal", "fi": "NIF/CIF", "nif": "NIF/CIF", - "Account": "Cuenta", + "Account": "Cuenta", "socialName": "Razón social", - "street":"Dirección fiscal", - "city":"Población", - "countryFk":"País", - "provinceFk":"Provincia", - "supplierFk":"Actividad del proveedor", - "healthRegister":"Registro sanitario", - "sageTaxTypeFk":"Tipo de impuesto Sage", - "sageTransactionTypeFk":"Tipo de transacción Sage", - "sageWithholdingFk" : "Sage con tenencia", + "street": "Dirección fiscal", + "city": "Población", + "countryFk": "País", + "provinceFk": "Provincia", + "supplierFk": "Actividad del proveedor", + "healthRegister": "Registro sanitario", + "sageTaxTypeFk": "Tipo de impuesto Sage", + "sageTransactionTypeFk": "Tipo de transacción Sage", + "sageWithholdingFk": "Sage con tenencia", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", - "Field are invalid": "El campo '{{tag}}' no es válido" -} + "Field are invalid": "El campo '{{tag}}' no es válido", + "additionalData": "additionalData", + "isToBeMailed": "isToBeMailed" +} \ No newline at end of file diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index 076122aa0..b0b4cb55a 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -1,15 +1,26 @@ const UserError = require('../../util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); +function isJsonString(str) { + try { + let json = JSON.parse(str); + return (typeof json === 'object'); + } catch (e) { + return false; + } +} const validations = [{ validation: message => String(message).startsWith('Value is not'), message: ({__: $t}, _tag) => $t('Field are invalid', {tag: $t(_tag)}), - handleError: ({method, originalUrl, body}) => { + handleError: ({method: verb, originalUrl, body}) => { const {models} = require('vn-loopback/server/server'); let tag = null; try { - let [module, id, path] = originalUrl.split('api/')[1].split('/'); + let [module, ...path] = originalUrl.split('?')[0].split('api/')[1]; + path = path.join('/'); + // let module = url.split('/')[0]; + // let [id, path] = url.substring(url.indexOf('/') + 1).split('/'); let model = models[module]; if (!model) { @@ -17,12 +28,46 @@ const validations = [{ model = models[module]; } if (!model) throw new Error('No matching model found'); - const {accepts} = model.sharedClass.methods().find(method => method.name === path); + const currentMethod = model.sharedClass.methods().find(method => { + const methodMatch = [method.http].flat().filter(el => el.verb === verb.toLowerCase()); + if (methodMatch.length > 0) { + const http = methodMatch.find(el => el.path.endsWith(path)); + if (http) + return method; + } + } + ); + const {accepts} = currentMethod; for (const [key, value] of Object.entries(body)) { const accept = accepts.find(acc => acc.arg === key); - if (!value && accept.type !== 'any') { - tag = key; - break; + if (accept.type !== 'any') { + let isValid = false; + if (value) { + switch (accept.type) { + case 'object': + isValid = isJsonString(value); + break; + case 'number': + isValid = /^[0-9]*$/.test(value); + break; + + case 'boolean': + isValid = value instanceof Boolean; + break; + + case 'date': + isValid = (new Date(date) !== 'Invalid Date') && !isNaN(new Date(date)); + break; + + case 'string': + isValid = typeof value == 'string'; + break; + } + } + if (!value || !isValid) { + tag = key; + break; + } } } return tag; From 8d5e174a6441736ec3a73e7826650d217a45ffed Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 15 Dec 2023 12:39:48 +0100 Subject: [PATCH 041/250] refs #5878 perf: move validation to other folder --- loopback/server/middleware/error-handler.js | 83 +------------------ loopback/server/middleware/value-is-not.js | 89 +++++++++++++++++++++ 2 files changed, 92 insertions(+), 80 deletions(-) create mode 100644 loopback/server/middleware/value-is-not.js diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index b0b4cb55a..73441f862 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -1,81 +1,10 @@ const UserError = require('../../util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); -function isJsonString(str) { - try { - let json = JSON.parse(str); - return (typeof json === 'object'); - } catch (e) { - return false; - } -} +const valueIsNot = require('./value-is-not'); + const validations = [{ - validation: message => String(message).startsWith('Value is not'), - message: ({__: $t}, _tag) => - $t('Field are invalid', {tag: $t(_tag)}), - handleError: ({method: verb, originalUrl, body}) => { - const {models} = require('vn-loopback/server/server'); - let tag = null; - try { - let [module, ...path] = originalUrl.split('?')[0].split('api/')[1]; - path = path.join('/'); - // let module = url.split('/')[0]; - // let [id, path] = url.substring(url.indexOf('/') + 1).split('/'); - - let model = models[module]; - if (!model) { - module = module.substring(0, module.length - 1); - model = models[module]; - } - if (!model) throw new Error('No matching model found'); - const currentMethod = model.sharedClass.methods().find(method => { - const methodMatch = [method.http].flat().filter(el => el.verb === verb.toLowerCase()); - if (methodMatch.length > 0) { - const http = methodMatch.find(el => el.path.endsWith(path)); - if (http) - return method; - } - } - ); - const {accepts} = currentMethod; - for (const [key, value] of Object.entries(body)) { - const accept = accepts.find(acc => acc.arg === key); - if (accept.type !== 'any') { - let isValid = false; - if (value) { - switch (accept.type) { - case 'object': - isValid = isJsonString(value); - break; - case 'number': - isValid = /^[0-9]*$/.test(value); - break; - - case 'boolean': - isValid = value instanceof Boolean; - break; - - case 'date': - isValid = (new Date(date) !== 'Invalid Date') && !isNaN(new Date(date)); - break; - - case 'string': - isValid = typeof value == 'string'; - break; - } - } - if (!value || !isValid) { - tag = key; - break; - } - } - } - return tag; - } catch (error) { - throw new Error(error); - } - } - + ...valueIsNot }]; module.exports = function() { return function(err, req, res, next) { @@ -93,12 +22,6 @@ module.exports = function() { const error = validation.handleError(req); if (error) err.message = validation.message(req, error); - // const tag = handleNullProperty(req); - // if (tag) { - // const message = validation.message(req); - // } - // const tag = validateModel(req); - // if (tag) validation.message(req); } }); diff --git a/loopback/server/middleware/value-is-not.js b/loopback/server/middleware/value-is-not.js new file mode 100644 index 000000000..ef2e2513f --- /dev/null +++ b/loopback/server/middleware/value-is-not.js @@ -0,0 +1,89 @@ +module.exports = { + validation: message => String(message).startsWith('Value is not'), + message: ({__: $t}, _tag) => + $t('Field are invalid', {tag: $t(_tag)}), + handleError: ({method: verb, originalUrl, body}) => { + const {models} = require('vn-loopback/server/server'); + let tag = null; + let module = null; + let path = null; + let hasId = false; + try { + if (originalUrl.includes('?')) + originalUrl = originalUrl.split('?')[0]; + + originalUrl = originalUrl.split('api/')[1]; + [module, ...path] = originalUrl.split('/'); + hasId = path.length > 1; + // let module = url.split('/')[0]; + // let [id, path] = url.substring(url.indexOf('/') + 1).split('/'); + + let model = models[module]; + if (!model) { + module = module.substring(0, module.length - 1); + model = models[module]; + } + if (!model) throw new Error('No matching model found'); + const currentMethod = model.sharedClass.methods().find(method => { + const methodMatch = [method.http].flat().find(el => { + let isValid = false; + if (el.verb === verb.toLowerCase()) { + if (hasId) + isValid = el.path.replace(':id', path[0]) === '/' + path.join('/'); + else + isValid = el.path.endsWith(path[0]); + } + return isValid; + }); + if (methodMatch) + return method; + } + ); + const {accepts} = currentMethod; + for (const [key, value] of Object.entries(body)) { + const accept = accepts.find(acc => acc.arg === key); + if (accept.type !== 'any') { + let isValid = false; + if (value) { + switch (accept.type) { + case 'object': + isValid = isJsonString(value); + break; + case 'number': + isValid = /^[0-9]*$/.test(value); + break; + + case 'boolean': + isValid = value instanceof Boolean; + break; + + case 'date': + isValid = (new Date(date) !== 'Invalid Date') && !isNaN(new Date(date)); + break; + + case 'string': + isValid = typeof value == 'string'; + break; + } + } + if (!value || !isValid) { + tag = key; + break; + } + } + } + return tag; + } catch (error) { + throw new Error(error); + } + } + +}; +function isJsonString(str) { + try { + let json = JSON.parse(str); + return (typeof json === 'object'); + } catch (e) { + return false; + } +} From 779cbd2c0aaf4ca3a5708880386cedbf41c05fa7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 18 Dec 2023 11:43:15 +0100 Subject: [PATCH 042/250] refs #6276 collection_getTickets --- .../getSalesFromTicketOrCollection.js | 146 ++++++++++++++++++ back/models/collection.js | 1 + 2 files changed, 147 insertions(+) create mode 100644 back/methods/collection/getSalesFromTicketOrCollection.js diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSalesFromTicketOrCollection.js new file mode 100644 index 000000000..d806782d9 --- /dev/null +++ b/back/methods/collection/getSalesFromTicketOrCollection.js @@ -0,0 +1,146 @@ +module.exports = Self => { + Self.remoteMethodCtx('getSalesFromTicketOrCollection', { + description: 'Get sales from ticket or collection', + accessType: 'READ', + accepts: [ + { + arg: 'collectionOrTicketFk', + type: 'number', + required: true + }, + { + arg: 'sectorFk', + type: 'number', + required: true + }, + { + arg: 'printFk', + type: 'number', + required: true + }, + { + arg: 'source', + type: 'string', + required: true + }, + + ], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/getSalesFromTicketOrCollection`, + verb: 'GET' + }, + }); + + Self.getSalesFromTicketOrCollection = async(ctx, collectionOrTicketFk, sectorFk, printFk, source, options) => { + const models = Self.app.models; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const [collectionOrTicket] = await Self.rawSql('SELECT vn.ticket_get(?) as id', [collectionOrTicketFk]); + + const [tickets] = await Self.rawSql('CALL vn.collection_getTickets(?)', [collectionOrTicket.id]); + + if (source == 'PRECHECKER' || source == 'ON_CHECKING') { + await Self.rawSql( + 'CALL vn.ticketStateToday_setState(?,?)', + [collectionOrTicket.id, source] + ); + } + + const [sales] = await Self.rawSql('CALL vn.sale_getFromTicketOrCollection(?)', [collectionOrTicket.id]); + + const isPicker = source == 'CHECKER'; + const [placements] = await Self.rawSql( + 'CALL vn.collectionPlacement_get(?, ?)', [collectionOrTicket.id, isPicker] + ); + + if (printFk == 1) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [collectionOrTicket.id]); + + if (tickets.length) await sendRocketTickets(tickets); + + return getCollection(collectionOrTicket.id, tickets, sales, placements); + + async function sendRocketTickets(tickets) { + for (let ticket of tickets) { + let observations = ticket.observaciones.split(' '); + + for (let observation of observations) { + const salesMan = ticket.salesPersonFk; + + if (!observation.startsWith('#') && !observation.startsWith('@')) return; + + await models.Chat.send(ctx, + observation, + `El ticket ${ticket.ticketFk} del comercial ${salesMan} está en preparación.(mensaje creado automáticamente)` + ); + } + } + } + + async function getCollection(id, tickets, sales, placements) { + const collection = { + collectionFk: id, + tickets: [], + }; + for (let ticket of tickets) { + const {ticketFk} = ticket; + ticket.sales = []; + + const barcodes = await getBarcodes(ticketFk); + await Self.rawSql( + 'CALL util.log_add(?, ?, ?, ?, ?, ?, ?, ?)', + ['vn', 'ticket', 'Ticket', ticketFk, ticketFk, 'select', null, null] + ); + + for (let sale of sales) { + if (sale.ticketFk == ticketFk) { + sale.placements = placements.filter(placement => + placement.saleFk == sale.saleFk && placement.order + ); + + sale.barcodes = []; + for (const barcode of barcodes) { + if (barcode.movementId) { + if (barcode.code) { + sale.barcodes.push(barcode.code); + sale.barcodes.push(`0 ${barcode.code}`); + } + + if (barcode.id) { + sale.barcodes.push(barcode.id); + sale.barcodes.push(`0 ${barcode.id}`); + } + } + } + + ticket.sales.push(sale); + } + } + collection.tickets.push(ticket); + } + + return collection; + } + + async function getBarcodes(ticketId) { + const query = + `SELECT s.id movementId, + b.code, + c.id + FROM vn.sale s + LEFT JOIN vn.itemBarcode b ON b.itemFk = s.itemFk + LEFT JOIN vn.buy c ON c.itemFk = s.itemFk + LEFT JOIN vn.entry e ON e.id = c.entryFk + LEFT JOIN vn.travel tr ON tr.id = e.travelFk + WHERE s.ticketFk = ? + AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`; + return Self.rawSql(query, [ticketId]); + } + }; +}; diff --git a/back/models/collection.js b/back/models/collection.js index 0d5be170b..98a199fbd 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -6,4 +6,5 @@ module.exports = Self => { require('../methods/collection/getTickets')(Self); require('../methods/collection/assignCollection')(Self); require('../methods/collection/addItem')(Self); + require('../methods/collection/getSalesFromTicketOrCollection')(Self); }; From d864dfd899ea56f5a5f19ba2f65de4619cdf6656 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 20 Dec 2023 06:45:40 +0100 Subject: [PATCH 043/250] refs #5878 test: init test --- .../middleware/specs/value-is-not.spec.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 loopback/server/middleware/specs/value-is-not.spec.js diff --git a/loopback/server/middleware/specs/value-is-not.spec.js b/loopback/server/middleware/specs/value-is-not.spec.js new file mode 100644 index 000000000..b9d15f2aa --- /dev/null +++ b/loopback/server/middleware/specs/value-is-not.spec.js @@ -0,0 +1,47 @@ +const valueIsNot = require('../value-is-not'); + +fdescribe('Value is not', () => { + const i18n = require('i18n'); + + const userId = 9; + const ctx = { + req: { + + accessToken: {userId: userId}, + headers: {origin: 'http://localhost:5000'}, + } + }; + + it('UpdateFiscalData endpoint', () => { + let messageError = 'Value is not number'; + const tag = 'provinceFk'; + try { + expect(valueIsNot.validation(messageError)).toBeTrue(); + expect(valueIsNot.message(i18n, tag)).toEqual('El campo \'Provincia\' no es válido'); + const data = { + method: 'POST', + originalUrl: 'updateFiscalData', + body: { + [tag]: null + } + }; + const result = valueIsNot.handleError(data); + + expect(result).toEqual(tag); + } catch (error) { + expect(error).toBeDefined(); + } + }); + + describe('OsTicket', () => { + let messageError = 'Value is not number'; + it('sendToSupport endpoint', () => { + try { + expect(valueIsNot.validation(messageError)).toBeTrue(); + expect(valueIsNot.message(ctx, 'provinceFk')).toEqual('El campo "Provincia" no es válido'); + } catch (error) { + expect(error).toBeDefined(); + } + }); + }); +}); From ec9e1e6d430427cafbdf788ce97df600963eb297 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 21 Dec 2023 13:06:32 +0100 Subject: [PATCH 044/250] refs #5878 test: update test --- .../middleware/specs/value-is-not.spec.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/loopback/server/middleware/specs/value-is-not.spec.js b/loopback/server/middleware/specs/value-is-not.spec.js index b9d15f2aa..9382ba14b 100644 --- a/loopback/server/middleware/specs/value-is-not.spec.js +++ b/loopback/server/middleware/specs/value-is-not.spec.js @@ -12,7 +12,7 @@ fdescribe('Value is not', () => { } }; - it('UpdateFiscalData endpoint', () => { + fit('UpdateFiscalData endpoint', () => { let messageError = 'Value is not number'; const tag = 'provinceFk'; try { @@ -20,7 +20,7 @@ fdescribe('Value is not', () => { expect(valueIsNot.message(i18n, tag)).toEqual('El campo \'Provincia\' no es válido'); const data = { method: 'POST', - originalUrl: 'updateFiscalData', + originalUrl: '/api/updateFiscalData', body: { [tag]: null } @@ -34,11 +34,22 @@ fdescribe('Value is not', () => { }); describe('OsTicket', () => { - let messageError = 'Value is not number'; + let messageError = 'Value is not object'; + const tag = 'additionalData'; it('sendToSupport endpoint', () => { try { expect(valueIsNot.validation(messageError)).toBeTrue(); - expect(valueIsNot.message(ctx, 'provinceFk')).toEqual('El campo "Provincia" no es válido'); + expect(valueIsNot.message(i18n, tag)).toEqual(`El campo '${tag}' no es válido`); + const data = { + method: 'POST', + originalUrl: '/api/OsTickets/send-to-support?access_token=DEFAULT_TOKEN', + body: { + [tag]: '{ \'foo\': 42 }' + } + }; + const result = valueIsNot.handleError(data); + + expect(result).toEqual(tag); } catch (error) { expect(error).toBeDefined(); } From 92b4908b35ff666ed4bbe3ca1b867663ab499c6c Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 2 Jan 2024 09:42:41 +0100 Subject: [PATCH 045/250] fix conflicts: refs #6276 --- loopback/locale/es.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 1dbb394ab..819ee1740 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -330,10 +330,6 @@ "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", -<<<<<<< HEAD - "The line could not be marked": "The line could not be marked" -} -======= + "The line could not be marked": "The line could not be marked", "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada" } ->>>>>>> 0101dcda3ac950c1add6c3c426c4f745389805c1 From d98885192618f066f9e6a769166149fa89c9d13c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 2 Jan 2024 10:20:47 +0100 Subject: [PATCH 046/250] refs #5878 feat: use back/locale --- loopback/server/middleware/error-handler.js | 2 +- .../middleware/specs/value-is-not.spec.js | 15 ++--- loopback/server/middleware/value-is-not.js | 61 ++++++++++++++----- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index 73441f862..954fb1056 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -21,7 +21,7 @@ module.exports = function() { if (validation.validation(err.message)) { const error = validation.handleError(req); if (error) - err.message = validation.message(req, error); + err.message = validation.message(error, req); } }); diff --git a/loopback/server/middleware/specs/value-is-not.spec.js b/loopback/server/middleware/specs/value-is-not.spec.js index 9382ba14b..4d65ddf56 100644 --- a/loopback/server/middleware/specs/value-is-not.spec.js +++ b/loopback/server/middleware/specs/value-is-not.spec.js @@ -17,17 +17,18 @@ fdescribe('Value is not', () => { const tag = 'provinceFk'; try { expect(valueIsNot.validation(messageError)).toBeTrue(); - expect(valueIsNot.message(i18n, tag)).toEqual('El campo \'Provincia\' no es válido'); const data = { - method: 'POST', - originalUrl: '/api/updateFiscalData', + method: 'PATCH', + originalUrl: '/api/supplier/updateFiscalData', body: { [tag]: null - } + }, + __: i18n }; const result = valueIsNot.handleError(data); - expect(result).toEqual(tag); + expect(result.tag).toEqual(tag); + expect(valueIsNot.message(result, i18n)).toEqual('El campo \'provincia\' no es válido'); } catch (error) { expect(error).toBeDefined(); } @@ -39,7 +40,6 @@ fdescribe('Value is not', () => { it('sendToSupport endpoint', () => { try { expect(valueIsNot.validation(messageError)).toBeTrue(); - expect(valueIsNot.message(i18n, tag)).toEqual(`El campo '${tag}' no es válido`); const data = { method: 'POST', originalUrl: '/api/OsTickets/send-to-support?access_token=DEFAULT_TOKEN', @@ -49,7 +49,8 @@ fdescribe('Value is not', () => { }; const result = valueIsNot.handleError(data); - expect(result).toEqual(tag); + expect(result.tag).toEqual(tag); + expect(valueIsNot.message(tag, i18n)).toEqual(`El campo '${tag}' no es válido`); } catch (error) { expect(error).toBeDefined(); } diff --git a/loopback/server/middleware/value-is-not.js b/loopback/server/middleware/value-is-not.js index ef2e2513f..3bd4a65d3 100644 --- a/loopback/server/middleware/value-is-not.js +++ b/loopback/server/middleware/value-is-not.js @@ -1,11 +1,26 @@ +const SLASH = '/'; +const path = require('path'); +const glob = require('glob'); +const modulesPath = `modules/**/back/locale/**/**.yml`; +const pathResolve = path.resolve(modulesPath); +const modelsLocale = glob.sync(pathResolve, {}).map((f, data) => { + const file = require(f); + const model = f.substring(f.indexOf('modules'), f.indexOf('back') - 1).split(SLASH)[1]; + const locale = path.parse(f).base.split('.')[0]; + return [keyMap(model, locale), file.columns]; +} +); +const mapLocale = new Map(modelsLocale); + module.exports = { validation: message => String(message).startsWith('Value is not'), - message: ({__: $t}, _tag) => - $t('Field are invalid', {tag: $t(_tag)}), - handleError: ({method: verb, originalUrl, body}) => { + message: ({tagValue}, {__: $t}) => + $t('Field are invalid', {tag: tagValue}), + handleError: ({method: verb, originalUrl, body, __: $t}) => { const {models} = require('vn-loopback/server/server'); let tag = null; let module = null; + let moduleOriginal = null; let path = null; let hasId = false; try { @@ -13,34 +28,42 @@ module.exports = { originalUrl = originalUrl.split('?')[0]; originalUrl = originalUrl.split('api/')[1]; - [module, ...path] = originalUrl.split('/'); + [module, ...path] = originalUrl.split(SLASH); hasId = path.length > 1; - // let module = url.split('/')[0]; - // let [id, path] = url.substring(url.indexOf('/') + 1).split('/'); + moduleOriginal = module; let model = models[module]; + // Capitalize + if (!model) { + module = module.charAt(0).toUpperCase() + module.slice(1); + model = models[module]; + } + // Singular if (!model) { module = module.substring(0, module.length - 1); model = models[module]; } if (!model) throw new Error('No matching model found'); const currentMethod = model.sharedClass.methods().find(method => { - const methodMatch = [method.http].flat().find(el => { + const methodMatch = [method.http].flat().filter(el => el.verb === verb.toLowerCase()).find(el => { let isValid = false; - if (el.verb === verb.toLowerCase()) { - if (hasId) - isValid = el.path.replace(':id', path[0]) === '/' + path.join('/'); - else - isValid = el.path.endsWith(path[0]); - } + if (hasId) + isValid = el.path.replace(':id', path[0]) === SLASH + path.join(SLASH); + else + isValid = el.path.endsWith(path[0]); return isValid; }); if (methodMatch) return method; } ); + if (!currentMethod) throw new Error('No matching currentMethod found'); const {accepts} = currentMethod; for (const [key, value] of Object.entries(body)) { + if (!value) { + tag = key; + break; + } const accept = accepts.find(acc => acc.arg === key); if (accept.type !== 'any') { let isValid = false; @@ -66,19 +89,27 @@ module.exports = { break; } } - if (!value || !isValid) { + if (!isValid) { tag = key; break; } } } - return tag; + if (tag) { + const tagValue = mapLocale.get(keyMap(moduleOriginal, $t.getLocale()))[tag]; + return {tag, tagValue}; + } } catch (error) { throw new Error(error); } } }; + +function keyMap(model, local, connector = '_') { + return `${model}${connector}${local}`; +} + function isJsonString(str) { try { let json = JSON.parse(str); From d9527a5ec0c5202f2123ee83b71bf09b5bc9b1b9 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 2 Jan 2024 10:46:33 +0100 Subject: [PATCH 047/250] refs #5878 perf: remove bad translations --- back/methods/vn-user/renew-token.js | 1 - loopback/locale/en.json | 18 +----------------- loopback/locale/es.json | 23 +---------------------- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/back/methods/vn-user/renew-token.js b/back/methods/vn-user/renew-token.js index 194747949..28289aa2e 100644 --- a/back/methods/vn-user/renew-token.js +++ b/back/methods/vn-user/renew-token.js @@ -1,4 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); const {models} = require('vn-loopback/server/server'); const handlePromiseLogout = (Self, {id}, courtesyTime) => { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index a94717b4f..8fc968e74 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -200,22 +200,6 @@ "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}}", - "Try again": "Try again", - "Property is not defined in this model": "La propiedad que ha modificado no existe", - "postcode": "Postcode", - "postCode": "Postcode", - "fi": "NIF/CIF", - "nif": "NIF/CIF", - "Account": "Account", - "socialName": "Social name", - "street":"Street", - "city":"City", - "countryFk":"Country", - "provinceFk":"Province", - "supplierFk":"Supplier", - "healthRegister":"Health register", - "sageTaxTypeFk":"Sage tax type", - "sageTransactionTypeFk":"Sage transaction type", - "sageWithholdingFk": "Sage with holding" + "Try again": "Try again" } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 6c9528193..fad630bbe 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -332,26 +332,5 @@ "provinceFk must be unique": "provinceFk must be unique", "fi cannot be empty": "fi cannot be empty", "countryFk cannot be empty": "countryFk cannot be empty", - "Model is not valid": "El campo \" {{key}}\" no es válido", - "Property is not defined in this model": "La propiedad que ha modificado no existe", - "postCode": "Código postal", - "postcode": "Código postal", - "fi": "NIF/CIF", - "nif": "NIF/CIF", - "Account": "Cuenta", - "socialName": "Razón social", - "street": "Dirección fiscal", - "city": "Población", - "countryFk": "País", - "provinceFk": "Provincia", - "supplierFk": "Actividad del proveedor", - "healthRegister": "Registro sanitario", - "sageTaxTypeFk": "Tipo de impuesto Sage", - "sageTransactionTypeFk": "Tipo de transacción Sage", - "sageWithholdingFk": "Sage con tenencia", - "Cannot past travels with entries": "No se pueden pasar envíos con entradas", - "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", - "Field are invalid": "El campo '{{tag}}' no es válido", - "additionalData": "additionalData", - "isToBeMailed": "isToBeMailed" + "Field are invalid": "El campo '{{tag}}' no es válido" } From 365e05d560195c67c2e16af1b02f1dd4093961b8 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 2 Jan 2024 12:21:25 +0100 Subject: [PATCH 048/250] =?UTF-8?q?refs=20#6276:mdify=20back=20silex?= =?UTF-8?q?=E2=86=92salix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/changes/235001/00-newWareHouse.sql | 4 +++- modules/worker/back/methods/operator/getPrinter.js | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 8437d8e15..b7d5f8a59 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -9,4 +9,6 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'), - ('Collection','addItem','WRITE','ALLOW','ROLE','employee'); \ No newline at end of file + ('Collection','addItem','WRITE','ALLOW','ROLE','employee'); + ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'); + \ No newline at end of file diff --git a/modules/worker/back/methods/operator/getPrinter.js b/modules/worker/back/methods/operator/getPrinter.js index c46734517..31fbff7b5 100644 --- a/modules/worker/back/methods/operator/getPrinter.js +++ b/modules/worker/back/methods/operator/getPrinter.js @@ -7,7 +7,7 @@ module.exports = Self => { verb: 'GET' }, returns: { - type: 'object', + type: ['object'], }, }); @@ -30,10 +30,11 @@ module.exports = Self => { if (operator) { const printer = operator.printer(); - return { + console.log({ id: printer.id, name: printer.name - }; + }); + return Array.isArray(printer) ? printer : [printer]; } }; }; From 924fe12a9344641db09792fa546fc18a005b63ac Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 2 Jan 2024 12:44:12 +0100 Subject: [PATCH 049/250] add root: refs #6276 --- modules/worker/back/methods/operator/getPrinter.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/worker/back/methods/operator/getPrinter.js b/modules/worker/back/methods/operator/getPrinter.js index 31fbff7b5..88e7d8090 100644 --- a/modules/worker/back/methods/operator/getPrinter.js +++ b/modules/worker/back/methods/operator/getPrinter.js @@ -8,6 +8,7 @@ module.exports = Self => { }, returns: { type: ['object'], + root: true }, }); @@ -30,11 +31,8 @@ module.exports = Self => { if (operator) { const printer = operator.printer(); - console.log({ - id: printer.id, - name: printer.name - }); return Array.isArray(printer) ? printer : [printer]; } + return []; }; }; From 40a269c358e542b3762f7468964bc8e3f5a09400 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 3 Jan 2024 07:38:18 +0100 Subject: [PATCH 050/250] refs #5878 perf: handle when locale not founded --- loopback/server/middleware/error-handler.js | 4 +--- loopback/server/middleware/value-is-not.js | 11 +++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index 954fb1056..94c30597b 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -32,8 +32,7 @@ module.exports = function() { if (err.statusCode == 422) { try { let code; - let messages = err.details.messages; - for (code in messages) break; + let {messages} = err.details; err.message = req.__(messages[code][0]); return next(err); } catch (e) {} @@ -44,7 +43,6 @@ module.exports = function() { return next(new UserError(req.__(err.sqlMessage))); // Logs error to console - let env = process.env.NODE_ENV; let useCustomLogging = env && env != 'development' && (!err.statusCode || err.statusCode >= 500); diff --git a/loopback/server/middleware/value-is-not.js b/loopback/server/middleware/value-is-not.js index 3bd4a65d3..388545a9f 100644 --- a/loopback/server/middleware/value-is-not.js +++ b/loopback/server/middleware/value-is-not.js @@ -1,11 +1,13 @@ const SLASH = '/'; +const MODULES = 'modules'; +const BACK = 'back'; const path = require('path'); const glob = require('glob'); -const modulesPath = `modules/**/back/locale/**/**.yml`; +const modulesPath = `${MODULES}/**/${BACK}/locale/**/**.yml`; const pathResolve = path.resolve(modulesPath); -const modelsLocale = glob.sync(pathResolve, {}).map((f, data) => { +const modelsLocale = glob.sync(pathResolve, {}).map(f => { const file = require(f); - const model = f.substring(f.indexOf('modules'), f.indexOf('back') - 1).split(SLASH)[1]; + const model = f.substring(f.indexOf(MODULES), f.indexOf(BACK) - 1).split(SLASH)[1]; const locale = path.parse(f).base.split('.')[0]; return [keyMap(model, locale), file.columns]; } @@ -96,7 +98,8 @@ module.exports = { } } if (tag) { - const tagValue = mapLocale.get(keyMap(moduleOriginal, $t.getLocale()))[tag]; + let tagValue = mapLocale.get(keyMap(moduleOriginal, $t.getLocale()))[tag]; + if (!tagValue) tagValue = tag; return {tag, tagValue}; } } catch (error) { From bce8feb552b19e93aeb6541ff0db24f11cf44aa8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 3 Jan 2024 10:41:44 +0100 Subject: [PATCH 051/250] refs #6276 add maxHours --- db/dump/fixtures.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 08225213c..96bde7e83 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3666,4 +3666,7 @@ UPDATE vn.collection WHERE id=10101010; UPDATE vn.sale - SET isPicked =FALSE; \ No newline at end of file + SET isPicked =FALSE; + +INSERT INTO machineWorkerConfig(maxHours) + VALUES(12); \ No newline at end of file From 2c91b5b701b8c9550dad694a6176e8075de12a68 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 3 Jan 2024 11:53:00 +0100 Subject: [PATCH 052/250] refs #5878 perf: change require file --- loopback/server/middleware/value-is-not.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/server/middleware/value-is-not.js b/loopback/server/middleware/value-is-not.js index 388545a9f..09c4ac7a8 100644 --- a/loopback/server/middleware/value-is-not.js +++ b/loopback/server/middleware/value-is-not.js @@ -12,6 +12,7 @@ const modelsLocale = glob.sync(pathResolve, {}).map(f => { return [keyMap(model, locale), file.columns]; } ); +const {models} = require('vn-loopback/server/server'); const mapLocale = new Map(modelsLocale); module.exports = { @@ -19,7 +20,6 @@ module.exports = { message: ({tagValue}, {__: $t}) => $t('Field are invalid', {tag: tagValue}), handleError: ({method: verb, originalUrl, body, __: $t}) => { - const {models} = require('vn-loopback/server/server'); let tag = null; let module = null; let moduleOriginal = null; From 0b5ffcc81cb95691bf89bc8298705ff5b295e3c4 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 3 Jan 2024 12:50:53 +0100 Subject: [PATCH 053/250] =?UTF-8?q?refs=20#6276:modify=20back=20silex?= =?UTF-8?q?=E2=86=92salix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/methods/collection/addItem.js | 2 +- back/methods/machine-worker/updateInTime.js | 2 +- db/changes/235001/00-newWareHouse.sql | 8 ++++++-- loopback/locale/es.json | 6 ++++-- modules/item/back/methods/item-shelving/makeMulti.js | 2 +- modules/item/back/methods/item-shelving/return.js | 2 +- modules/item/back/methods/item/card.js | 2 +- .../ticket/back/methods/expedition-pallet/getPallet.js | 1 + 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/back/methods/collection/addItem.js b/back/methods/collection/addItem.js index 4538a479c..d3afbd71b 100644 --- a/back/methods/collection/addItem.js +++ b/back/methods/collection/addItem.js @@ -6,7 +6,7 @@ module.exports = Self => { accepts: [ { arg: 'code', - type: 'string', + type: 'number', required: true }, { diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 917733686..3fdb484dd 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -50,7 +50,7 @@ module.exports = Self => { }); if (machineWorker) { await machineWorker.updateAttributes({ - inTime: new Date(Date.now()) + outTime: new Date(Date.now()) }, myOptions); } diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index b7d5f8a59..c088a8730 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -9,6 +9,10 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'), - ('Collection','addItem','WRITE','ALLOW','ROLE','employee'); - ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'); + ('Collection','addItem','WRITE','ALLOW','ROLE','employee'), + ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), + ('MobileAppVersionControl', '*', 'READ', 'ALLOW', 'ROLE', 'production'), + ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), + ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'), + ('MachineWorker', 'updateInTime', 'WRITE', 'ALLOW', 'ROLE', 'production');; \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 819ee1740..fb3335eb2 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -331,5 +331,7 @@ "Cannot past travels with entries": "No se pueden pasar envíos con entradas", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", "The line could not be marked": "The line could not be marked", - "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada" -} + "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", + "No hay tickets para sacar": "No hay tickets para sacar", + "There is no zone for these parameters 999999": "There is no zone for these parameters 999999" +} \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/makeMulti.js b/modules/item/back/methods/item-shelving/makeMulti.js index d4b451760..e4393e4de 100644 --- a/modules/item/back/methods/item-shelving/makeMulti.js +++ b/modules/item/back/methods/item-shelving/makeMulti.js @@ -4,7 +4,7 @@ module.exports = Self => { accessType: 'WRITE', accepts: [{ arg: 'shelvingFk', - type: 'number', + type: 'string', required: true, }, { diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index 346fe8bdf..27bc39a50 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -62,7 +62,7 @@ module.exports = Self => { return { id: itemShelving.id, - item: itemShelving.itemFk, + itemFk: itemShelving.itemFk, longName: item ? item.longName || `${item.name} ${item.size}` : '', quantity: itemShelving.visible, stickers: Math.ceil(itemShelving.visible / itemShelving.packing), diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js index 6d861b394..41d134f3b 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/card.js @@ -44,7 +44,7 @@ module.exports = Self => { let itemInfo; if (result.length) { itemInfo = {...result[0]}; - itemInfo.barcodes = barcodes.map(barcode => barcode.code); + itemInfo.barcodes = barcodes; } return itemInfo; diff --git a/modules/ticket/back/methods/expedition-pallet/getPallet.js b/modules/ticket/back/methods/expedition-pallet/getPallet.js index 09775a6fa..22cbbc210 100644 --- a/modules/ticket/back/methods/expedition-pallet/getPallet.js +++ b/modules/ticket/back/methods/expedition-pallet/getPallet.js @@ -16,6 +16,7 @@ module.exports = Self => { }, returns: { type: 'object', + root: true }, }); From e354de4ff5c8625fe8463fe64e124f4de0703e11 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 10:09:41 +0100 Subject: [PATCH 054/250] fix: updateInTime refs #6276 --- back/methods/machine-worker/updateInTime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 3fdb484dd..278d1d08d 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -42,7 +42,7 @@ module.exports = Self => { const machineWorker = await models.MachineWorker.findOne({ where: { workerFk: userId, - inTime: {gte: new Date(Date.now() - maxHours * 60 * 60 * 1000)}, + inTime: {gte: Date.vnNew() - (maxHours * 60 * 60 * 1000)}, outTimed: null, machineFk: machine.id, } @@ -50,7 +50,7 @@ module.exports = Self => { }); if (machineWorker) { await machineWorker.updateAttributes({ - outTime: new Date(Date.now()) + outTime: Date.now() }, myOptions); } From 384d9ec803c7c038570f6fe076a14761fecd9bf1 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 12:27:02 +0100 Subject: [PATCH 055/250] fix: updateTracking refs #6276 --- modules/ticket/back/methods/sale-tracking/updateTracking.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 1f499022e..c6f051f9a 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -20,7 +20,7 @@ module.exports = Self => { }, { arg: 'isChecked', - type: 'number', + type: 'boolean', required: true }, { From da8057e4c7196dd0dfefbe08962944fe1443a8e7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 12:35:00 +0100 Subject: [PATCH 056/250] fix: updateTracking refs #6276 --- modules/ticket/back/methods/sale-tracking/updateTracking.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index c6f051f9a..453b0b0c6 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -30,7 +30,7 @@ module.exports = Self => { }, { arg: 'isScanned', - type: 'number', + type: 'boolean', }, ], http: { @@ -64,7 +64,7 @@ module.exports = Self => { originalQuantity, workerFk: userId, stateFk: state.id, - isScanned, + isScanned: isScanned === undefined ? null : isScanned, }; const saleTracking = await models.SaleTracking.findOne({ From 3ebf0a30a9c3561ac25fff794eed142ebb47dceb Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 12:44:44 +0100 Subject: [PATCH 057/250] refactor: drop getItemPackingType refs #6276 --- .../methods/operator/getItemPackingType.js | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 modules/worker/back/methods/operator/getItemPackingType.js diff --git a/modules/worker/back/methods/operator/getItemPackingType.js b/modules/worker/back/methods/operator/getItemPackingType.js deleted file mode 100644 index d28cd95fe..000000000 --- a/modules/worker/back/methods/operator/getItemPackingType.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('getItemPackingType', { - description: 'Retrieve the operator items', - accessType: 'READ', - returns: { - type: 'object', - }, - http: { - path: `/getItemPackingType`, - verb: 'GET' - }, - }); - - Self.getItemPackingType = async ctx => { - const userId = 9 ?? ctx.req.accessToken.userId; - - const result = await Self.findOne({ - where: { - workerFk: userId - }, - include: { - relation: 'itemPackingType', - } - }); - const itemPackingType = result.itemPackingType(); - - return { - description: itemPackingType?.description - }; - }; -}; From 2eca02d74f2a202c5c331fa881956413e7ab727f Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 12:57:46 +0100 Subject: [PATCH 058/250] refactor: drop getItemPackingType refs #6276 --- modules/worker/back/models/operator.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index b9ea481a7..5e8870130 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -2,7 +2,6 @@ module.exports = Self => { require('../methods/operator/add')(Self); require('../methods/operator/getPrinter')(Self); require('../methods/operator/getAvailablePrinters')(Self); - require('../methods/operator/getItemPackingType')(Self); Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance; From ad89363db5d707a5d1903a11aa7ba43bc04a49ad Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 13:11:39 +0100 Subject: [PATCH 059/250] fix: mark refs #6276 --- modules/ticket/back/methods/sale-tracking/mark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index a5b8ece52..327421673 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -32,7 +32,7 @@ module.exports = Self => { }, { arg: 'isScanned', - type: 'number', + type: 'boolean', }, { arg: 'quantity', From 8a5da43503f774c26b26817e45388679cec38dd7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 4 Jan 2024 16:00:25 +0100 Subject: [PATCH 060/250] refactor: sectorCollection_getSale refs #6276 --- db/changes/235001/00-newWareHouse.sql | 3 ++- modules/item/back/models/item-shelving.js | 1 - .../back/methods/sale/getFromSectorCollection.js} | 10 +++++----- modules/ticket/back/models/sale.js | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) rename modules/{item/back/methods/item-shelving/getSale.js => ticket/back/methods/sale/getFromSectorCollection.js} (84%) diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index c088a8730..60d2658b0 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -14,5 +14,6 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('MobileAppVersionControl', '*', 'READ', 'ALLOW', 'ROLE', 'production'), ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'), - ('MachineWorker', 'updateInTime', 'WRITE', 'ALLOW', 'ROLE', 'production');; + ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index e349b9c34..4eb5374e8 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -4,5 +4,4 @@ module.exports = Self => { require('../methods/item-shelving/makeMulti')(Self); require('../methods/item-shelving/return')(Self); require('../methods/item-shelving/updateFromSale')(Self); - require('../methods/item-shelving/getSale')(Self); }; diff --git a/modules/item/back/methods/item-shelving/getSale.js b/modules/ticket/back/methods/sale/getFromSectorCollection.js similarity index 84% rename from modules/item/back/methods/item-shelving/getSale.js rename to modules/ticket/back/methods/sale/getFromSectorCollection.js index 826ac03e1..9e4f24fbb 100644 --- a/modules/item/back/methods/item-shelving/getSale.js +++ b/modules/ticket/back/methods/sale/getFromSectorCollection.js @@ -1,7 +1,7 @@ module.exports = Self => { - Self.remoteMethod('getSale', { - description: 'Update the visible items', - accessType: 'WRITE', + Self.remoteMethod('getFromSectorCollection', { + description: 'Get sales from sector collection', + accessType: 'READ', accepts: [ { arg: 'sectorCollectionFk', @@ -19,12 +19,12 @@ module.exports = Self => { root: true }, http: { - path: `/getSale`, + path: `/getFromSectorCollection`, verb: 'GET' }, }); - Self.getSale = async(sectorCollectionFk, sectorFk, options) => { + Self.getFromSectorCollection = async(sectorCollectionFk, sectorFk, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index d6f06d744..7cac50a13 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -13,6 +13,7 @@ module.exports = Self => { require('../methods/sale/canEdit')(Self); require('../methods/sale/usesMana')(Self); require('../methods/sale/clone')(Self); + require('../methods/sale/getFromSectorCollection')(Self); Self.validatesPresenceOf('concept', { message: `Concept cannot be blank` From 9afc3840c76886dc5dd3645343703f892e07fa80 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 9 Jan 2024 11:22:11 +0100 Subject: [PATCH 061/250] fix: refs #6276 machineWorker_add --- back/methods/machine-worker/add.js | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/back/methods/machine-worker/add.js b/back/methods/machine-worker/add.js index 65eb5d297..92d0df78e 100644 --- a/back/methods/machine-worker/add.js +++ b/back/methods/machine-worker/add.js @@ -37,27 +37,16 @@ module.exports = Self => { if (!machine) throw new Error(`plate ${plate} does not exist`); - const twelveHoursAgo = Date.vnNew(); - twelveHoursAgo.setHours(twelveHoursAgo.getHours() - 12); - - const isRegistered = await models.MachineWorker.findOne({ - where: { - and: [ - {machineFk: machine.id}, - {workerFk: userId}, - {outTime: {gte: twelveHoursAgo}} - ] - } - }, myOptions); - - if (!isRegistered) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); - else { await models.MachineWorker.updateAll( - {or: [{workerFk: userId}, {machineFk: machine.id}]}, + { + or: [{workerFk: userId}, {machineFk: machine.id}], + and: [{outTime: null }] + }, {outTime: Date.vnNew()}, myOptions ); - } + + await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); if (tx) await tx.commit(); } catch (e) { From 7a9f2bd79cea197dc60bf6d192f503e65fa666d5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 9 Jan 2024 11:23:54 +0100 Subject: [PATCH 062/250] refactor: refs #6276 align rows --- back/methods/machine-worker/add.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/back/methods/machine-worker/add.js b/back/methods/machine-worker/add.js index 92d0df78e..c6fdd620e 100644 --- a/back/methods/machine-worker/add.js +++ b/back/methods/machine-worker/add.js @@ -37,14 +37,14 @@ module.exports = Self => { if (!machine) throw new Error(`plate ${plate} does not exist`); - await models.MachineWorker.updateAll( - { - or: [{workerFk: userId}, {machineFk: machine.id}], - and: [{outTime: null }] - }, - {outTime: Date.vnNew()}, - myOptions - ); + await models.MachineWorker.updateAll( + { + or: [{workerFk: userId}, {machineFk: machine.id}], + and: [{outTime: null }] + }, + {outTime: Date.vnNew()}, + myOptions + ); await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); From c11bcbebeed90d54de36d06ea215c20dbb2fa521 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 10 Jan 2024 14:51:59 +0100 Subject: [PATCH 063/250] refs #5878 perf: handle when create customer --- loopback/server/middleware/error-handler.js | 14 ++--- loopback/server/middleware/value-invalid.js | 58 +++++++++++++++++++++ loopback/server/middleware/value-is-not.js | 25 ++------- loopback/util/map-locales.js | 23 ++++++++ 4 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 loopback/server/middleware/value-invalid.js create mode 100644 loopback/util/map-locales.js diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index 94c30597b..e274396a6 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -2,10 +2,12 @@ const UserError = require('../../util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); const valueIsNot = require('./value-is-not'); +const valueInvalid = require('./value-invalid'); -const validations = [{ - ...valueIsNot -}]; +const validations = [ + valueIsNot, + valueInvalid +]; module.exports = function() { return function(err, req, res, next) { // Thrown user errors @@ -15,11 +17,11 @@ module.exports = function() { } // Validation errors - if (err.statusCode == 400) { + if ([400, 422].includes(err.statusCode)) { try { validations.forEach(validation => { if (validation.validation(err.message)) { - const error = validation.handleError(req); + const error = validation.handleError(req, err); if (error) err.message = validation.message(error, req); } @@ -28,8 +30,6 @@ module.exports = function() { return next(err); } catch (e) { } - } - if (err.statusCode == 422) { try { let code; let {messages} = err.details; diff --git a/loopback/server/middleware/value-invalid.js b/loopback/server/middleware/value-invalid.js new file mode 100644 index 000000000..962aa9e1f --- /dev/null +++ b/loopback/server/middleware/value-invalid.js @@ -0,0 +1,58 @@ +const SLASH = '/'; +const $t = require('i18n'); +const {models} = require('vn-loopback/server/server'); +const mapLocale = require('../../util/map-locales'); + + +module.exports = { + validation: message => String(message).includes('is not valid'), + message: ({tagValue}, {__: $t}) => + $t('Field are invalid', {tag: tagValue}), + handleError: ({method: verb, originalUrl, body}, err) => { + let tag = null; + let module = null; + let moduleOriginal = null; + let path = null; + try { + if (originalUrl.includes('?')) + originalUrl = originalUrl.split('?')[0]; + + originalUrl = originalUrl.split('api/')[1]; + [module, ...path] = originalUrl.split(SLASH); + + moduleOriginal = module; + let model = models[module]; + // Capitalize + if (!model) { + module = module.charAt(0).toUpperCase() + module.slice(1); + model = models[module]; + } + // Singular + if (!model) { + module = module.substring(0, module.length - 1); + model = models[module]; + } + if (!model) throw new Error('No matching model found'); + tag = Object.keys(err.details.codes)[0]; + if (tag) { + let tagValue = mapLocale[$t.getLocale()][tag]; + if (!tagValue) tagValue = tag; + return {tag, tagValue}; + } + } catch (error) { + throw new Error(error); + } + } + +}; + + + +function isJsonString(str) { + try { + let json = JSON.parse(str); + return (typeof json === 'object'); + } catch (e) { + return false; + } +} diff --git a/loopback/server/middleware/value-is-not.js b/loopback/server/middleware/value-is-not.js index 09c4ac7a8..021af3fb9 100644 --- a/loopback/server/middleware/value-is-not.js +++ b/loopback/server/middleware/value-is-not.js @@ -1,28 +1,15 @@ const SLASH = '/'; -const MODULES = 'modules'; -const BACK = 'back'; -const path = require('path'); -const glob = require('glob'); -const modulesPath = `${MODULES}/**/${BACK}/locale/**/**.yml`; -const pathResolve = path.resolve(modulesPath); -const modelsLocale = glob.sync(pathResolve, {}).map(f => { - const file = require(f); - const model = f.substring(f.indexOf(MODULES), f.indexOf(BACK) - 1).split(SLASH)[1]; - const locale = path.parse(f).base.split('.')[0]; - return [keyMap(model, locale), file.columns]; -} -); const {models} = require('vn-loopback/server/server'); -const mapLocale = new Map(modelsLocale); +const $t = require('i18n'); +const mapLocale = require('../../util/map-locales'); module.exports = { validation: message => String(message).startsWith('Value is not'), message: ({tagValue}, {__: $t}) => $t('Field are invalid', {tag: tagValue}), - handleError: ({method: verb, originalUrl, body, __: $t}) => { + handleError: ({method: verb, originalUrl, body}) => { let tag = null; let module = null; - let moduleOriginal = null; let path = null; let hasId = false; try { @@ -33,7 +20,6 @@ module.exports = { [module, ...path] = originalUrl.split(SLASH); hasId = path.length > 1; - moduleOriginal = module; let model = models[module]; // Capitalize if (!model) { @@ -98,7 +84,7 @@ module.exports = { } } if (tag) { - let tagValue = mapLocale.get(keyMap(moduleOriginal, $t.getLocale()))[tag]; + let tagValue = mapLocale[$t.getLocale()][tag]; if (!tagValue) tagValue = tag; return {tag, tagValue}; } @@ -109,9 +95,6 @@ module.exports = { }; -function keyMap(model, local, connector = '_') { - return `${model}${connector}${local}`; -} function isJsonString(str) { try { diff --git a/loopback/util/map-locales.js b/loopback/util/map-locales.js new file mode 100644 index 000000000..692de3f23 --- /dev/null +++ b/loopback/util/map-locales.js @@ -0,0 +1,23 @@ +const SLASH = '/'; +const MODULES = 'modules'; +const BACK = 'back'; +const path = require('path'); +const glob = require('glob'); +const modulesPath = `${MODULES}/**/${BACK}/locale/**/**.yml`; +const pathResolve = path.resolve(modulesPath); + +const modelsLocale = glob.sync(pathResolve, {}).reduce((acc, f) => { + const file = require(f); + const model = f.substring(f.indexOf(MODULES), f.indexOf(BACK) - 1).split(SLASH)[1]; + const locale = path.parse(f).base.split('.')[0]; + + if (!acc[locale]) acc[locale] = {}; + acc[locale] = Object.assign(acc[locale], file.columns); + return acc; +}, {} +); +function keyMap(model, local, connector = '_') { + return `${model}${connector}${local}`; +} +module.exports =modelsLocale; + From 0ca0ea804cc0388004cceb2ff0c50b89c797de50 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 15 Jan 2024 10:51:24 +0100 Subject: [PATCH 064/250] refs #5878 feat mapMethods approach --- loopback/server/middleware/error-handler.js | 7 ++++--- loopback/util/map-methods.js | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 loopback/util/map-methods.js diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index e274396a6..10c0bc635 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -1,12 +1,13 @@ -const UserError = require('../../util/user-error'); +const UserError = require('vn-loopback/util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); const valueIsNot = require('./value-is-not'); const valueInvalid = require('./value-invalid'); - +const mapMethods = require('vn-loopback/util/map-methods') const validations = [ valueIsNot, - valueInvalid + valueInvalid, + mapMethods ]; module.exports = function() { return function(err, req, res, next) { diff --git a/loopback/util/map-methods.js b/loopback/util/map-methods.js new file mode 100644 index 000000000..2858cd61d --- /dev/null +++ b/loopback/util/map-methods.js @@ -0,0 +1,12 @@ +const SLASH = '/'; +const MODULES = 'modules'; +const BACK = 'back'; + +const app = require('vn-loopback/server/server'); + +const modelsMethods = app; +function keyMap(model, local, connector = '_') { + return `${model}${connector}${local}`; +} +module.exports = modelsMethods; + From 73c0ca53828fe3436aa96a6dd16a53cf5542802f Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 15 Jan 2024 15:00:36 +0100 Subject: [PATCH 065/250] feat(mrwXml): refs #6403 render and transmEnvio integrated --- back/methods/mrw-config/renderer.js | 59 +++++++++++++++++++++ back/methods/mrw-config/shipmentCreation.js | 46 ++++++++++++++++ back/methods/mrw-config/template.ejs | 40 ++++++++++++++ back/model-config.json | 3 ++ back/models/mrw-config.js | 4 ++ back/models/mrw-config.json | 28 ++++++++++ db/changes/240401/00-mrwWebService.sql | 35 ++++++++++++ 7 files changed, 215 insertions(+) create mode 100644 back/methods/mrw-config/renderer.js create mode 100644 back/methods/mrw-config/shipmentCreation.js create mode 100644 back/methods/mrw-config/template.ejs create mode 100644 back/models/mrw-config.js create mode 100644 back/models/mrw-config.json create mode 100644 db/changes/240401/00-mrwWebService.sql diff --git a/back/methods/mrw-config/renderer.js b/back/methods/mrw-config/renderer.js new file mode 100644 index 000000000..33ac5cdd0 --- /dev/null +++ b/back/methods/mrw-config/renderer.js @@ -0,0 +1,59 @@ +const fs = require('fs'); +const ejs = require('ejs'); + +module.exports = Self => { + Self.remoteMethod('renderer', { + description: 'Renders the data from an XML', + accessType: 'READ', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/renderer`, + verb: 'GET' + } + }); + + Self.renderer = async expeditionFk => { + const mrw = await Self.app.models.MrwConfig.findOne(); + + const [expedition] = await Self.rawSql( + `SELECT CASE co.code + WHEN 'ES' THEN a.postalCode + WHEN 'PT' THEN LEFT(a.postalCode, 4) + WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') + END postalCode, + a.city, + a.street, + co.code countryCode, + c.fi, + c.name clientName, + c.phone, + e.created, + e.id expeditionId, + LPAD(ms.serviceType, 4 ,'0') serviceType, + pa.height, + pa.depth, + pa.width + FROM expedition e + JOIN packaging pa ON pa.id = e.packagingFk + JOIN ticket t ON e.ticketFk = t.id + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN mrwService ms ON ms.agencyModeCodeFk = am.code + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + JOIN province p ON a.provinceFk = p.id + JOIN country co ON co.id = p.countryFk + WHERE e.id = ?`, [expeditionFk] + ); + + const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8'); + return ejs.render(template, {mrw, expedition}); + }; +}; diff --git a/back/methods/mrw-config/shipmentCreation.js b/back/methods/mrw-config/shipmentCreation.js new file mode 100644 index 000000000..c75fb793d --- /dev/null +++ b/back/methods/mrw-config/shipmentCreation.js @@ -0,0 +1,46 @@ +const axios = require('axios'); +const {DOMParser} = require('xmldom'); + +module.exports = Self => { + Self.remoteMethod('shipmentCreation', { + description: 'Create an expedition and return a label', + accessType: 'WRITE', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/shipmentCreation`, + verb: 'POST' + } + }); + + Self.shipmentCreation = async expeditionFk => { + const models = Self.app.models; + + const MrwConfig = await models.MrwConfig.findOne({ + fields: ['url'] + }); + + const renderedXml = await models.MrwConfig.renderer(expeditionFk); + const response = await axios.post(MrwConfig.url, renderedXml, { + headers: { + 'Content-Type': 'application/soap+xml; charset=utf-8' + } + }); + + const xmlString = response.data; + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); + const transmEnvioResponse = xmlDoc.getElementsByTagName('TransmEnvioResponse')[0]; + console.log(xmlDoc.getElementsByTagName('TransmEnvioResponse')); + console.log('transmEnvioResponse: ', transmEnvioResponse); + + return transmEnvioResponse.textContent; + }; +}; diff --git a/back/methods/mrw-config/template.ejs b/back/methods/mrw-config/template.ejs new file mode 100644 index 000000000..1641c9ec2 --- /dev/null +++ b/back/methods/mrw-config/template.ejs @@ -0,0 +1,40 @@ + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + <%= mrw.user %> + <%= mrw.password %> + + + + + + + + <%= expedition.street %> + <%= expedition.postalCode %> + <%= expedition.city %> + <%= expedition.countryCode %> + + <%= expedition.fi %> + <%= expedition.clientName %> + <%= expedition.phone %> + + + <%= expedition.created %> + <%= expedition.expeditionId %> + <%= expedition.serviceType %> + + + <%= expedition.height %> + <%= expedition.depth %> + <%= expedition.width %> + + + <%= expedition.kg %> + + + + + \ No newline at end of file diff --git a/back/model-config.json b/back/model-config.json index ebc0e321b..b501680d0 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -156,6 +156,9 @@ }, "ViaexpressConfig": { "dataSource": "vn" + }, + "MrwConfig": { + "dataSource": "vn" } } diff --git a/back/models/mrw-config.js b/back/models/mrw-config.js new file mode 100644 index 000000000..ccc0ca3ac --- /dev/null +++ b/back/models/mrw-config.js @@ -0,0 +1,4 @@ +module.exports = Self => { + require('../methods/mrw-config/shipmentCreation')(Self); + require('../methods/mrw-config/renderer')(Self); +}; diff --git a/back/models/mrw-config.json b/back/models/mrw-config.json new file mode 100644 index 000000000..39e5f4318 --- /dev/null +++ b/back/models/mrw-config.json @@ -0,0 +1,28 @@ +{ + "name": "MrwConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "mrwConfig" + } + }, + "properties": { + "id": { + "type": "number", + "required": true + }, + "url": { + "type": "string", + "required": true + }, + "user": { + "type": "string" + }, + "franchiseCode": { + "type": "string" + }, + "subscriberCode": { + "type": "string" + } + } +} diff --git a/db/changes/240401/00-mrwWebService.sql b/db/changes/240401/00-mrwWebService.sql new file mode 100644 index 000000000..9a802104f --- /dev/null +++ b/db/changes/240401/00-mrwWebService.sql @@ -0,0 +1,35 @@ +CREATE TABLE IF NOT EXISTS vn.mrwConfig ( + id INT auto_increment NULL, + url varchar(100) NULL, + `user` varchar(100) NULL, + password varchar(100) NULL, + franchiseCode varchar(100) NULL, + subscriberCode varchar(100) NULL, + CONSTRAINT mrwConfig_pk PRIMARY KEY (id) +) +ENGINE=InnoDB +DEFAULT CHARSET=utf8mb3 +COLLATE=utf8mb3_unicode_ci; + + +INSERT INTO vn.mrwConfig (url, `user`,password,franchiseCode,subscriberCode) + VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '009731', '04301'); + +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('MrwConfig','renderer','READ','ALLOW','ROLE','employee'); + +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('MrwConfig','shipmentCreation','WRITE','ALLOW','ROLE','employee'); + + +INSERT INTO vn.agency (name,warehouseFk,warehouseAliasFk,isOwn,isAnyVolumeAllowed) + VALUES ('MRW',1,1,0,0); + +INSERT INTO vn.agencyMode (id, name, description, deliveryMethodFk, m3, web, agencyFk, inflation, isVolumetric, reportMail, showAgencyName, isActive, isExternalAgency, flag, code, isRiskFree, hasWeightVolumetric) + VALUES(25, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0); + +INSERT INTO vn.ticket (id, clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight, clonedFrom, cmrFk, editorFk) + VALUES(33, 1101, 1, '2001-01-01 00:00:00.000', 'MRW', NULL, 1, NULL, NULL, 0, 0, 0, 1, NULL, 0, '2001-01-01 00:00:00.000', 1, NULL, 6, NULL, 1, 442, 25, '2001-01-02', 0, 0, 3, 5.00, 1.00, 8.88, 8.07, NULL, NULL, NULL, 100); + +INSERT INTO vn.expedition (agencyModeFk,ticketFk,freightItemFk,created,counter,workerFk,packagingFk,hostFk,stateTypeFk,hasNewRoute,isBox,editorFk) + VALUES (25,33,71,'2001-01-01 01:00:00.000',1,18,'94','',3,0,71,100); From fafc25ed1943e2a0880182c82e651bd783f3ec19 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 16 Jan 2024 14:50:09 +0100 Subject: [PATCH 066/250] refactor: refs #6276 sectorCollection_getSale --- .../methods/sale/getFromSectorCollection.js | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/sale/getFromSectorCollection.js b/modules/ticket/back/methods/sale/getFromSectorCollection.js index 9e4f24fbb..9a1b52ed8 100644 --- a/modules/ticket/back/methods/sale/getFromSectorCollection.js +++ b/modules/ticket/back/methods/sale/getFromSectorCollection.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('getFromSectorCollection', { + Self.remoteMethodCtx('getFromSectorCollection', { description: 'Get sales from sector collection', accessType: 'READ', accepts: [ @@ -24,12 +24,35 @@ module.exports = Self => { }, }); - Self.getFromSectorCollection = async(sectorCollectionFk, sectorFk, options) => { + Self.getFromSectorCollection = async(ctx, sectorCollectionFk, sectorFk, options) => { const myOptions = {}; + const userId = ctx.req.accessToken.userId; if (typeof options == 'object') Object.assign(myOptions, options); - const [sales] = await Self.rawSql('CALL vn.sectorCollection_getSale(?)', [sectorCollectionFk]); + const sales = await Self.rawSql( + `SELECT s.ticketFk, + s.itemFk, + i.longName, + itemPackingTypeFk, + subName, + s.quantity, + w.code workerCode, + sgd.saleFk, + iss.quantity pickedQuantity, + c.salesPersonFk + FROM vn.sale s + JOIN item i ON i.id = s.itemFk + JOIN saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk + JOIN saleTracking st ON st.saleFk = s.id + JOIN state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION' + JOIN worker w ON w.id = st.workerFk + JOIN ticket t ON t.id= s.ticketFk + JOIN client c ON c.id=t.clientFk + LEFT JOIN itemShelvingSaleSum iss ON iss.saleFk = s.id + WHERE scsg.sectorCollectionFk = ? + AND st.workerFk = ?;`, [sectorCollectionFk, userId]); const itemShelvings = []; for (let sale of sales) { From 7e3660aece556117b4605f1322ca098283facbf2 Mon Sep 17 00:00:00 2001 From: pablone Date: Tue, 16 Jan 2024 15:04:06 +0100 Subject: [PATCH 067/250] feat(cancelShipment): refs #6403 mrwintegration --- .vscode/settings.json | 2 +- back/methods/mrw-config/cancelShipment.ejs | 20 +++++++ back/methods/mrw-config/cancelShipment.js | 46 ++++++++++++++ back/methods/mrw-config/getLabel.ejs | 25 ++++++++ back/methods/mrw-config/renderer.js | 59 ------------------ back/methods/mrw-config/shipmentCreation.ejs | 42 +++++++++++++ back/methods/mrw-config/shipmentCreation.js | 63 ++++++++++++++++---- back/methods/mrw-config/template.ejs | 40 ------------- back/models/mrw-config.js | 2 +- back/models/mrw-config.json | 3 + db/changes/240401/00-mrwWebService.sql | 7 ++- 11 files changed, 195 insertions(+), 114 deletions(-) create mode 100644 back/methods/mrw-config/cancelShipment.ejs create mode 100644 back/methods/mrw-config/cancelShipment.js create mode 100644 back/methods/mrw-config/getLabel.ejs delete mode 100644 back/methods/mrw-config/renderer.js create mode 100644 back/methods/mrw-config/shipmentCreation.ejs delete mode 100644 back/methods/mrw-config/template.ejs diff --git a/.vscode/settings.json b/.vscode/settings.json index 40ec5c0d3..36b7e21d8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ // Carácter predeterminado de final de línea. "files.eol": "\n", "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "search.useIgnoreFiles": false, "editor.defaultFormatter": "dbaeumer.vscode-eslint", diff --git a/back/methods/mrw-config/cancelShipment.ejs b/back/methods/mrw-config/cancelShipment.ejs new file mode 100644 index 000000000..9ef401bc8 --- /dev/null +++ b/back/methods/mrw-config/cancelShipment.ejs @@ -0,0 +1,20 @@ + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + + <%= mrw.user %> + <%= mrw.password %> + + + + + + + <%= externalId %> + + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js new file mode 100644 index 000000000..fe8af1caa --- /dev/null +++ b/back/methods/mrw-config/cancelShipment.js @@ -0,0 +1,46 @@ +const axios = require('axios'); +const fs = require('fs'); +const {DOMParser} = require('xmldom'); + +module.exports = Self => { + Self.remoteMethod('cancelShipment', { + description: 'Cancel a shipment by providing the expedition ID, interacting with MRW WS', + accessType: 'WRITE', + accepts: [{ + arg: 'expeditionFk', + type: 'number', + required: true + }], + returns: { + type: ['object'], + root: true + }, + http: { + path: `/cancelShipment`, + verb: 'POST' + } + }); + + Self.deleteExpedition = async expeditionFk => { + const models = Self.app.models; + + const mrw = await models.MrwConfig.findOne(); + const {externalId} = await models.Expedition.findById(expeditionFk); + + const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8'); + const renderedXml = ejs.render(template, {mrw, externalId}); + const response = await axios.post(mrw.url, renderedXml, { + headers: { + 'Content-Type': 'application/soap+xml; charset=utf-8' + } + }); + + const xmlString = response.data; + const parser = new DOMParser(); + const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); + const resultElement = xmlDoc.getElementsByTagName('Mensaje')[0]; + const result = resultElement.textContent; + + return result; + }; +}; diff --git a/back/methods/mrw-config/getLabel.ejs b/back/methods/mrw-config/getLabel.ejs new file mode 100644 index 000000000..09bdb3f6c --- /dev/null +++ b/back/methods/mrw-config/getLabel.ejs @@ -0,0 +1,25 @@ + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + + <%= mrw.user %> + <%= mrw.password %> + + + + + + <%= shipmentId %> + 1 + + + + 0 + 0 + 0 + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/renderer.js b/back/methods/mrw-config/renderer.js deleted file mode 100644 index 33ac5cdd0..000000000 --- a/back/methods/mrw-config/renderer.js +++ /dev/null @@ -1,59 +0,0 @@ -const fs = require('fs'); -const ejs = require('ejs'); - -module.exports = Self => { - Self.remoteMethod('renderer', { - description: 'Renders the data from an XML', - accessType: 'READ', - accepts: [{ - arg: 'expeditionFk', - type: 'number', - required: true - }], - returns: { - type: ['object'], - root: true - }, - http: { - path: `/renderer`, - verb: 'GET' - } - }); - - Self.renderer = async expeditionFk => { - const mrw = await Self.app.models.MrwConfig.findOne(); - - const [expedition] = await Self.rawSql( - `SELECT CASE co.code - WHEN 'ES' THEN a.postalCode - WHEN 'PT' THEN LEFT(a.postalCode, 4) - WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') - END postalCode, - a.city, - a.street, - co.code countryCode, - c.fi, - c.name clientName, - c.phone, - e.created, - e.id expeditionId, - LPAD(ms.serviceType, 4 ,'0') serviceType, - pa.height, - pa.depth, - pa.width - FROM expedition e - JOIN packaging pa ON pa.id = e.packagingFk - JOIN ticket t ON e.ticketFk = t.id - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN mrwService ms ON ms.agencyModeCodeFk = am.code - JOIN client c ON t.clientFk = c.id - JOIN address a ON t.addressFk = a.id - JOIN province p ON a.provinceFk = p.id - JOIN country co ON co.id = p.countryFk - WHERE e.id = ?`, [expeditionFk] - ); - - const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8'); - return ejs.render(template, {mrw, expedition}); - }; -}; diff --git a/back/methods/mrw-config/shipmentCreation.ejs b/back/methods/mrw-config/shipmentCreation.ejs new file mode 100644 index 000000000..e84cfce39 --- /dev/null +++ b/back/methods/mrw-config/shipmentCreation.ejs @@ -0,0 +1,42 @@ + + + + + <%= mrw.franchiseCode %> + <%= mrw.subscriberCode %> + + <%= mrw.user %> + <%= mrw.password %> + + + + + + + + + <%= expeditionData.street %> + + + <%= expeditionData.postalCode %> + <%= expeditionData.city %> + + + + <%= expeditionData.fi %> + <%= expeditionData.clientName %> + <%= expeditionData.phone %> + + + <%= expeditionData.created %> + <%= expeditionData.expeditionDataId %> + <%= expeditionData.serviceType %> + 1 + <%= expeditionData.kg %> + + + + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/shipmentCreation.js b/back/methods/mrw-config/shipmentCreation.js index c75fb793d..b1574784f 100644 --- a/back/methods/mrw-config/shipmentCreation.js +++ b/back/methods/mrw-config/shipmentCreation.js @@ -1,5 +1,7 @@ const axios = require('axios'); const {DOMParser} = require('xmldom'); +const fs = require('fs'); +const ejs = require('ejs'); module.exports = Self => { Self.remoteMethod('shipmentCreation', { @@ -22,25 +24,62 @@ module.exports = Self => { Self.shipmentCreation = async expeditionFk => { const models = Self.app.models; + const mrw = await models.MrwConfig.findOne(); - const MrwConfig = await models.MrwConfig.findOne({ - fields: ['url'] - }); + const [expeditionData] = await Self.rawSql( + `SELECT CASE co.code + WHEN 'ES' THEN a.postalCode + WHEN 'PT' THEN LEFT(a.postalCode, 4) + WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') + END postalCode, + a.city, + a.street, + co.code countryCode, + c.fi, + c.name clientName, + c.phone, + DATE_FORMAT(e.created, '%d/%m/%Y') created, + e.id expeditionId, + LPAD(ms.serviceType, 4 ,'0') serviceType, + pa.height, + pa.depth, + pa.width + FROM expedition e + JOIN packaging pa ON pa.id = e.packagingFk + JOIN ticket t ON e.ticketFk = t.id + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN mrwService ms ON ms.agencyModeCodeFk = am.code + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + JOIN province p ON a.provinceFk = p.id + JOIN country co ON co.id = p.countryFk + WHERE e.id = ?`, [expeditionFk] + ); - const renderedXml = await models.MrwConfig.renderer(expeditionFk); - const response = await axios.post(MrwConfig.url, renderedXml, { + const shipmentTemplate = fs.readFileSync(__dirname + '/shipmentCreation.ejs', 'utf-8'); + const renderedShipment = ejs.render(shipmentTemplate, {mrw, expeditionData}); + const shipmentResponse = await axios.post(mrw.url, renderedShipment, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' } }); - - const xmlString = response.data; const parser = new DOMParser(); - const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - const transmEnvioResponse = xmlDoc.getElementsByTagName('TransmEnvioResponse')[0]; - console.log(xmlDoc.getElementsByTagName('TransmEnvioResponse')); - console.log('transmEnvioResponse: ', transmEnvioResponse); + const shipmentXmlDoc = parser.parseFromString(shipmentResponse.data, 'text/xml'); + const shipmentId = shipmentXmlDoc.getElementsByTagName('NumeroEnvio')[0].textContent; - return transmEnvioResponse.textContent; + const getLabelTemplate = fs.readFileSync(__dirname + '/getLabel.ejs', 'utf-8'); + const renderedGetLabel = ejs.render(getLabelTemplate, {mrw, shipmentId}); + const getLabelResponse = await axios.post(mrw.url, renderedGetLabel, { + headers: { + 'Content-Type': 'text/xml; charset=utf-8' + } + }); + const getLableXmlDoc = parser.parseFromString(getLabelResponse.data, 'text/xml'); + const base64Binary = getLableXmlDoc.getElementsByTagName('EtiquetaFile')[0].textContent; + + const expedition = await models.Expedition.findById(expeditionFk); + await expedition.updateAttribute('externalId', shipmentId); + + return base64Binary; }; }; diff --git a/back/methods/mrw-config/template.ejs b/back/methods/mrw-config/template.ejs deleted file mode 100644 index 1641c9ec2..000000000 --- a/back/methods/mrw-config/template.ejs +++ /dev/null @@ -1,40 +0,0 @@ - - - - <%= mrw.franchiseCode %> - <%= mrw.subscriberCode %> - <%= mrw.user %> - <%= mrw.password %> - - - - - - - - <%= expedition.street %> - <%= expedition.postalCode %> - <%= expedition.city %> - <%= expedition.countryCode %> - - <%= expedition.fi %> - <%= expedition.clientName %> - <%= expedition.phone %> - - - <%= expedition.created %> - <%= expedition.expeditionId %> - <%= expedition.serviceType %> - - - <%= expedition.height %> - <%= expedition.depth %> - <%= expedition.width %> - - - <%= expedition.kg %> - - - - - \ No newline at end of file diff --git a/back/models/mrw-config.js b/back/models/mrw-config.js index ccc0ca3ac..069ef345a 100644 --- a/back/models/mrw-config.js +++ b/back/models/mrw-config.js @@ -1,4 +1,4 @@ module.exports = Self => { require('../methods/mrw-config/shipmentCreation')(Self); - require('../methods/mrw-config/renderer')(Self); + require('../methods/mrw-config/cancelShipment')(Self); }; diff --git a/back/models/mrw-config.json b/back/models/mrw-config.json index 39e5f4318..f0cf799b1 100644 --- a/back/models/mrw-config.json +++ b/back/models/mrw-config.json @@ -18,6 +18,9 @@ "user": { "type": "string" }, + "password": { + "type": "string" + }, "franchiseCode": { "type": "string" }, diff --git a/db/changes/240401/00-mrwWebService.sql b/db/changes/240401/00-mrwWebService.sql index 9a802104f..220f5138e 100644 --- a/db/changes/240401/00-mrwWebService.sql +++ b/db/changes/240401/00-mrwWebService.sql @@ -13,7 +13,10 @@ COLLATE=utf8mb3_unicode_ci; INSERT INTO vn.mrwConfig (url, `user`,password,franchiseCode,subscriberCode) - VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '009731', '04301'); + VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '04301', '009731'); + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('MrwConfig', 'cancelShipment', 'WRITE', 'ALLOW', 'ROLE', 'employee'); INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES ('MrwConfig','renderer','READ','ALLOW','ROLE','employee'); @@ -33,3 +36,5 @@ INSERT INTO vn.ticket (id, clientFk, warehouseFk, shipped, nickname, refFk, addr INSERT INTO vn.expedition (agencyModeFk,ticketFk,freightItemFk,created,counter,workerFk,packagingFk,hostFk,stateTypeFk,hasNewRoute,isBox,editorFk) VALUES (25,33,71,'2001-01-01 01:00:00.000',1,18,'94','',3,0,71,100); + +INSERT INTO vn.mrwService (agencyModeCodeFk, clientType, serviceType, kg) VALUES('MRW', 9731, 205, 10); \ No newline at end of file From 2fbea6f9dd0525891ca31e83d4f83535df5a1b2b Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 16 Jan 2024 15:43:34 +0100 Subject: [PATCH 068/250] feat: refs #6276 wip machineWorke_update --- back/methods/machine-worker/updateInTime.js | 23 +++++++++++++-------- loopback/locale/es.json | 7 ++++--- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 278d1d08d..0ae968b83 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('updateInTime', { description: 'Updates the corresponding registry if the worker has been registered in the last few hours', @@ -34,25 +35,29 @@ module.exports = Self => { fields: ['id', 'plate'], where: {plate} }, myOptions); - if (!machine) throw new Error(`plate ${plate} does not exist`); const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); - - const machineWorker = await models.MachineWorker.findOne({ + const machineWorker = await Self.findOne({ where: { - workerFk: userId, - inTime: {gte: Date.vnNew() - (maxHours * 60 * 60 * 1000)}, - outTimed: null, machineFk: machine.id, + outTime: null, } + }, myOptions); - }); if (machineWorker) { + const hoursDifference = (Date.vnNew() - machineWorker.inTime) / (60 * 60 * 1000); + const isHimSelf = userId == machineWorker.workerFk; + + if (maxHours > hoursDifference && !isHimSelf) throw new UserError('Esta máquina ya está en uso.'); + await machineWorker.updateAttributes({ - outTime: Date.now() + outTime: Date.vnNew() }, myOptions); - } + + if (!isHimSelf) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); + } else + await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); if (tx) await tx.commit(); } catch (e) { diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 698303a26..5d57b1968 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -72,7 +72,7 @@ "The secret can't be blank": "La contraseña no puede estar en blanco", "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", "This ticket can not be modified": "Este ticket no puede ser modificado", @@ -339,5 +339,6 @@ "The alias cant be modified": "Este alias de correo no puede ser modificado", "No tickets to invoice": "No hay tickets para facturar", "No hay tickets para sacar": "No hay tickets para sacar", - "There is no zone for these parameters 999999": "There is no zone for these parameters 999999" -} + "There is no zone for these parameters 999999": "There is no zone for these parameters 999999", + "Esta máquina ya está en uso.": "Esta máquina ya está en uso." +} \ No newline at end of file From 53a10dda58698f72539aa351cc638470fa5e8c9b Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 08:17:55 +0100 Subject: [PATCH 069/250] feat: refs #6276 machineWorke_update --- back/methods/machine-worker/add.js | 57 --------------------- back/methods/machine-worker/updateInTime.js | 8 +-- back/models/machine-worker.js | 1 - db/changes/235001/00-newWareHouse.sql | 1 - 4 files changed, 4 insertions(+), 63 deletions(-) delete mode 100644 back/methods/machine-worker/add.js diff --git a/back/methods/machine-worker/add.js b/back/methods/machine-worker/add.js deleted file mode 100644 index c6fdd620e..000000000 --- a/back/methods/machine-worker/add.js +++ /dev/null @@ -1,57 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('add', { - description: 'Insert log if the worker has not logged anything in the last 12 hours', - accessType: 'READ', - accepts: [ - { - arg: 'plate', - type: 'string', - } - ], - http: { - path: `/add`, - verb: 'POST' - } - }); - - Self.add = async(ctx, plate, options) => { - const models = Self.app.models; - const userId = ctx.req.accessToken.userId; - - let tx; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const machine = await models.Machine.findOne({ - fields: ['id', 'plate'], - where: {plate} - }, myOptions); - - if (!machine) throw new Error(`plate ${plate} does not exist`); - - await models.MachineWorker.updateAll( - { - or: [{workerFk: userId}, {machineFk: machine.id}], - and: [{outTime: null }] - }, - {outTime: Date.vnNew()}, - myOptions - ); - - await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); - - if (tx) await tx.commit(); - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }; -}; diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 0ae968b83..5065373a2 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -35,9 +35,8 @@ module.exports = Self => { fields: ['id', 'plate'], where: {plate} }, myOptions); - if (!machine) throw new Error(`plate ${plate} does not exist`); + if (!machine) throw new Error(`plate ${plate} does not exist.`); - const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); const machineWorker = await Self.findOne({ where: { machineFk: machine.id, @@ -46,10 +45,11 @@ module.exports = Self => { }, myOptions); if (machineWorker) { - const hoursDifference = (Date.vnNew() - machineWorker.inTime) / (60 * 60 * 1000); + const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); + const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); const isHimSelf = userId == machineWorker.workerFk; - if (maxHours > hoursDifference && !isHimSelf) throw new UserError('Esta máquina ya está en uso.'); + if (maxHours > hoursDifference && !isHimSelf) throw new UserError('This machine is already in use.'); await machineWorker.updateAttributes({ outTime: Date.vnNew() diff --git a/back/models/machine-worker.js b/back/models/machine-worker.js index b44cb1fb6..cbc5fd53e 100644 --- a/back/models/machine-worker.js +++ b/back/models/machine-worker.js @@ -1,4 +1,3 @@ module.exports = Self => { require('../methods/machine-worker/updateInTime')(Self); - require('../methods/machine-worker/add')(Self); }; diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/235001/00-newWareHouse.sql index 60d2658b0..1b1ec263f 100644 --- a/db/changes/235001/00-newWareHouse.sql +++ b/db/changes/235001/00-newWareHouse.sql @@ -3,7 +3,6 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), - ('MachineWorker','add','READ','ALLOW','ROLE','employee'), ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), From 6a78123fca12c382651327d2e74226260735b315 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 09:01:48 +0100 Subject: [PATCH 070/250] fix: refs #6276 machineWorke_update --- back/methods/machine-worker/updateInTime.js | 3 ++- loopback/locale/es.json | 3 ++- modules/ticket/back/methods/ticket/specs/setDeleted.spec.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 5065373a2..705bcdd92 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -55,7 +55,8 @@ module.exports = Self => { outTime: Date.vnNew() }, myOptions); - if (!isHimSelf) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); + if (maxHours <= hoursDifference) + await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); } else await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 5d57b1968..babb4bd2a 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -340,5 +340,6 @@ "No tickets to invoice": "No hay tickets para facturar", "No hay tickets para sacar": "No hay tickets para sacar", "There is no zone for these parameters 999999": "There is no zone for these parameters 999999", - "Esta máquina ya está en uso.": "Esta máquina ya está en uso." + "Esta máquina ya está en uso.": "Esta máquina ya está en uso.", + "This machine is already in use.": "This machine is already in use." } \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 43bc2c2d9..0dcd2762c 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -57,7 +57,7 @@ describe('ticket setDeleted()', () => { `SELECT COUNT(*) numberRows FROM vn.sectorCollection`, [], options); - expect(sectorCollection.numberRows).toEqual(0); + expect(sectorCollection.numberRows).toEqual(1); await tx.rollback(); } catch (e) { From 90b1e8d664b58c17cc2345adb6ba6ceb531e4aac Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 10:18:13 +0100 Subject: [PATCH 071/250] fix: refs #6276 backend tests --- db/dump/fixtures.sql | 7 +++++-- modules/entry/back/methods/entry/specs/filter.spec.js | 4 ++-- .../ticket/back/methods/sale-tracking/specs/delete.spec.js | 2 +- .../back/methods/travel/specs/extraCommunityFilter.spec.js | 2 +- modules/travel/back/methods/travel/specs/filter.spec.js | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 50168ccea..2b04327cf 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3047,9 +3047,12 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`) -- NEW WAREHOUSE -UPDATE vn.packaging +/* UPDATE vn.packaging SET id='--' - WHERE id='pallet 100'; + WHERE id='pallet 100'; */ +INSERT INTO vn.packaging + VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0); + INSERT IGNORE INTO vn.intrastat SET id = 44219999, diff --git a/modules/entry/back/methods/entry/specs/filter.spec.js b/modules/entry/back/methods/entry/specs/filter.spec.js index dcad13320..28763bc81 100644 --- a/modules/entry/back/methods/entry/specs/filter.spec.js +++ b/modules/entry/back/methods/entry/specs/filter.spec.js @@ -37,7 +37,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(8); + expect(result.length).toEqual(9); await tx.rollback(); } catch (e) { @@ -81,7 +81,7 @@ describe('Entry filter()', () => { const result = await models.Entry.filter(ctx, options); - expect(result.length).toEqual(7); + expect(result.length).toEqual(8); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js b/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js index a8bcf5692..e23c12a61 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js @@ -11,7 +11,7 @@ describe('sale-tracking delete()', () => { const saleTrackingsBefore = await models.SaleTracking.find(null, options); const saleFk = 1; - const stateCode = 'PREPARED'; + const stateCode = ['PREPARED']; const result = await models.SaleTracking.delete(saleFk, stateCode, options); const itemShelvingsAfter = await models.ItemShelvingSale.find(null, options); diff --git a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js index 599851b55..1ce55cc91 100644 --- a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js +++ b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js @@ -79,7 +79,7 @@ describe('Travel extraCommunityFilter()', () => { const result = await app.models.Travel.extraCommunityFilter(ctx, filter); - expect(result.length).toEqual(8); + expect(result.length).toEqual(9); }); it('should return the travel matching "cargoSupplierFk"', async() => { diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js index 1a6ee895c..6cb366938 100644 --- a/modules/travel/back/methods/travel/specs/filter.spec.js +++ b/modules/travel/back/methods/travel/specs/filter.spec.js @@ -80,6 +80,6 @@ describe('Travel filter()', () => { const result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(5); + expect(result.length).toEqual(6); }); }); From e69ec2c8561ae508e037a25585da5430ae2a067d Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 12:07:22 +0100 Subject: [PATCH 072/250] feat: refs #6276 test expeditionPallet_get --- loopback/locale/en.json | 3 +- loopback/locale/es.json | 4 +-- .../methods/expedition-pallet/getPallet.js | 14 ++++++--- .../expedition-pallet/specs/getPallet.spec.js | 31 +++++++++++++++++++ 4 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js diff --git a/loopback/locale/en.json b/loopback/locale/en.json index ba9acecae..391034126 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -204,5 +204,6 @@ "The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified", "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" + "This machine is already in use.": "This machine is already in use.", + "This pallet does not exist": "This pallet does not exist" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index babb4bd2a..b273f7506 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -340,6 +340,6 @@ "No tickets to invoice": "No hay tickets para facturar", "No hay tickets para sacar": "No hay tickets para sacar", "There is no zone for these parameters 999999": "There is no zone for these parameters 999999", - "Esta máquina ya está en uso.": "Esta máquina ya está en uso.", - "This machine is already in use.": "This machine is already in use." + "This machine is already in use.": "Esta máquina ya está en uso.", + "This pallet does not exist": "Este palet no existe" } \ No newline at end of file diff --git a/modules/ticket/back/methods/expedition-pallet/getPallet.js b/modules/ticket/back/methods/expedition-pallet/getPallet.js index 22cbbc210..340dc02b0 100644 --- a/modules/ticket/back/methods/expedition-pallet/getPallet.js +++ b/modules/ticket/back/methods/expedition-pallet/getPallet.js @@ -1,7 +1,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethod('getPallet', { + Self.remoteMethodCtx('getPallet', { description: 'Get pallet', accessType: 'READ', accepts: [ @@ -20,7 +20,13 @@ module.exports = Self => { }, }); - Self.getPallet = async expeditionFk => { + Self.getPallet = async(ctx, expeditionFk, options) => { + const myOptions = {}; + const $t = ctx.req.__; + + if (typeof options == 'object') + Object.assign(myOptions, options); + try { const pallet = await Self.findOne({ fields: ['truckFk'], @@ -35,7 +41,7 @@ module.exports = Self => { } } ], - }); + }, myOptions); if (pallet) { const truck = pallet.expeditionTruck(); @@ -46,7 +52,7 @@ module.exports = Self => { }; } - throw new UserError('palletDoesNotExist'); + throw new UserError($t('This pallet does not exist')); } catch (e) { return {message: e.message}; } diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js new file mode 100644 index 000000000..8ffc7d8c2 --- /dev/null +++ b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js @@ -0,0 +1,31 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('expeditonPallet getPallet()', () => { + beforeAll(async() => { + ctx = { + accessToken: {userId: 9}, + req: { + headers: {origin: 'http://localhost'}, + __: value => value + } + }; + }); + + it('should obtain the pallet data', async() => { + const pallet = await models.ExpeditionPallet.getPallet(ctx, 1); + + expect(pallet).toBeDefined(); + expect(pallet.truckFk).toEqual(1); + expect(pallet.description).toEqual('BEST TRUCK IN FLEET'); + }); + + it('should throw an error when the pallet does not exist', async() => { + try { + await models.ExpeditionPallet.getPallet(ctx, 1); + } catch (e) { + const error = e; + + expect(error.message).toEqual('This pallet does not exist'); + } + }); +}); From bf13e85ecc4435df9c2ba99f32cc4f59e961f420 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 12:14:38 +0100 Subject: [PATCH 073/250] fix: refs #6276 getFromSectorCollection --- .../back/methods/expedition-pallet/specs/getPallet.spec.js | 2 +- modules/ticket/back/methods/sale/getFromSectorCollection.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js index 8ffc7d8c2..8a451c917 100644 --- a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js +++ b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('expeditonPallet getPallet()', () => { +describe('expeditonPallet getPallet()', () => { beforeAll(async() => { ctx = { accessToken: {userId: 9}, diff --git a/modules/ticket/back/methods/sale/getFromSectorCollection.js b/modules/ticket/back/methods/sale/getFromSectorCollection.js index 9a1b52ed8..323474cb4 100644 --- a/modules/ticket/back/methods/sale/getFromSectorCollection.js +++ b/modules/ticket/back/methods/sale/getFromSectorCollection.js @@ -67,7 +67,8 @@ module.exports = Self => { longName: sale.longName, packingType: sale.itemPackingTypeFk, subName: sale.subName, - quantity: {saldo: sale.quantity}, + quantity: sale.quantity, + saldo: sale.quantity, trabajador: sale.workerCode, idMovimiento: sale.saleFk, salesPersonFk: sale.salesPersonFk, From 1fbb84ae9fc424ca03fc491f9db97600a1b8d147 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 12:58:57 +0100 Subject: [PATCH 074/250] fix: refs #6276 itemShelving_return --- db/dump/fixtures.sql | 3 --- .../item/back/methods/item-shelving/return.js | 4 ++-- .../item-shelving/specs/return.spec.js | 19 +++++++++++++++++++ .../expedition-pallet/specs/getPallet.spec.js | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 modules/item/back/methods/item-shelving/specs/return.spec.js diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 2b04327cf..bab0149e1 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3047,9 +3047,6 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`) -- NEW WAREHOUSE -/* UPDATE vn.packaging - SET id='--' - WHERE id='pallet 100'; */ INSERT INTO vn.packaging VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0); diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index 27bc39a50..61d695c48 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -50,7 +50,7 @@ module.exports = Self => { let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions); - const alternatives = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]); + const [alternatives] = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]); if (itemShelvings) { itemShelvings = itemShelvings.map(itemShelving => { @@ -58,7 +58,7 @@ module.exports = Self => { const shelving = itemShelving.shelving(); const parking = shelving ? shelving.parking() : null; - const carros = alternatives.filter(el => el.item == itemShelving.itemFk); + const carros = alternatives.filter(el => el.itemFk == itemShelving.itemFk); return { id: itemShelving.id, diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js new file mode 100644 index 000000000..35676a6ac --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -0,0 +1,19 @@ +const {models} = require('vn-loopback/server/server'); + +describe('itemShelving return()', () => { + beforeAll(async() => { + ctx = { + accessToken: {userId: 9}, + req: { + headers: {origin: 'http://localhost'}, + } + }; + }); + + it('should return a list of items and alternative locations', async() => { + const itemShelvings = await models.itemShelving.return('HEJ'); + + expect(itemShelvings).toBeDefined(); + // WIP + }); +}); diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js index 8a451c917..84bb9f93a 100644 --- a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js +++ b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js @@ -21,7 +21,7 @@ describe('expeditonPallet getPallet()', () => { it('should throw an error when the pallet does not exist', async() => { try { - await models.ExpeditionPallet.getPallet(ctx, 1); + await models.ExpeditionPallet.getPallet(ctx, 600); } catch (e) { const error = e; From 6be2f07c2278a7b49977b05217adf0f30d05b11d Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 13:57:57 +0100 Subject: [PATCH 075/250] fix: refs #6276 assignCollection --- back/methods/collection/assignCollection.js | 1 + back/methods/collection/spec/assignCollection.spec.js | 0 2 files changed, 1 insertion(+) create mode 100644 back/methods/collection/spec/assignCollection.spec.js diff --git a/back/methods/collection/assignCollection.js b/back/methods/collection/assignCollection.js index e63e6c1d0..3384b325a 100644 --- a/back/methods/collection/assignCollection.js +++ b/back/methods/collection/assignCollection.js @@ -9,6 +9,7 @@ module.exports = Self => { }, returns: { type: ['object'], + root: true }, }); diff --git a/back/methods/collection/spec/assignCollection.spec.js b/back/methods/collection/spec/assignCollection.spec.js new file mode 100644 index 000000000..e69de29bb From c0398d17bf5465689e404b4cd3a603bb034a8b10 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 14:21:50 +0100 Subject: [PATCH 076/250] feat: refs #6276 test itemShelving_return --- .../item/back/methods/item-shelving/return.js | 31 ++++--------------- .../item-shelving/specs/return.spec.js | 21 ++++++++++--- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index 61d695c48..aa44ef5b5 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -25,7 +25,7 @@ module.exports = Self => { Object.assign(myOptions, options); const filterItemShelvings = { - fields: ['id', 'visible', 'itemFk', 'packing', 'grouping', 'isChecked', 'shelvingFk'], + fields: ['id', 'visible', 'itemFk', 'shelvingFk'], where: {shelvingFk}, include: [ { @@ -34,47 +34,28 @@ module.exports = Self => { fields: ['longName', 'name', 'size'] } }, - { - relation: 'shelving', - scope: { - include: { - fields: ['id', 'name', 'code'], - relation: 'parking', - } - - } - }, ] }; let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions); - - const [alternatives] = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', [shelvingFk]); + const [alternatives] = await models.ItemShelving.rawSql( + 'CALL vn.itemShelving_getAlternatives(?)', [shelvingFk] + ); if (itemShelvings) { - itemShelvings = itemShelvings.map(itemShelving => { + return itemShelvings.map(itemShelving => { const item = itemShelving.item(); - const shelving = itemShelving.shelving(); - const parking = shelving ? shelving.parking() : null; - - const carros = alternatives.filter(el => el.itemFk == itemShelving.itemFk); + const carros = alternatives.filter(alternative => alternative.itemFk == itemShelving.itemFk); return { id: itemShelving.id, itemFk: itemShelving.itemFk, longName: item ? item.longName || `${item.name} ${item.size}` : '', quantity: itemShelving.visible, - stickers: Math.ceil(itemShelving.visible / itemShelving.packing), - packing: itemShelving.packing, - grouping: itemShelving.grouping, - code: parking ? parking.code : '', - priority: shelving ? shelving.priority : 0, - isChecked: itemShelving.isChecked, carros }; }); } - return itemShelvings; }; }; diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js index 35676a6ac..996491992 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -describe('itemShelving return()', () => { +fdescribe('itemShelving return()', () => { beforeAll(async() => { ctx = { accessToken: {userId: 9}, @@ -11,9 +11,22 @@ describe('itemShelving return()', () => { }); it('should return a list of items and alternative locations', async() => { - const itemShelvings = await models.itemShelving.return('HEJ'); + const itemShelvings = await models.ItemShelving.return('PCC'); - expect(itemShelvings).toBeDefined(); - // WIP + expect(itemShelvings[0].itemFk).toEqual(999997); + expect(itemShelvings[0].quantity).toEqual(10); + expect(itemShelvings[0].carros.length).toEqual(1); + }); + + it('should return a list of items without alternatives', async() => { + const itemShelvings = await models.ItemShelving.return('HEJ'); + + expect(itemShelvings[0].carros.length).toEqual(0); + }); + + it('should return an empty list', async() => { + const itemShelvings = await models.ItemShelving.return('ZZP'); + + expect(itemShelvings.length).toEqual(0); }); }); From 8e5be5f5da73c2c447a13a9d959229455f477516 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 17 Jan 2024 15:26:04 +0100 Subject: [PATCH 077/250] feat: refs #6276 test itemBarcode_delete --- .../methods/item-barcode/specs/delete.spec.js | 22 +++++++++++++++++++ .../item-shelving/specs/return.spec.js | 11 ++++++---- .../expedition-pallet/specs/getPallet.spec.js | 6 +++-- 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 modules/item/back/methods/item-barcode/specs/delete.spec.js diff --git a/modules/item/back/methods/item-barcode/specs/delete.spec.js b/modules/item/back/methods/item-barcode/specs/delete.spec.js new file mode 100644 index 000000000..56377eb78 --- /dev/null +++ b/modules/item/back/methods/item-barcode/specs/delete.spec.js @@ -0,0 +1,22 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('itemBarcode delete()', () => { + it('should delete a record by itemFk and code', async() => { + const tx = await models.ItemBarcode.beginTransaction({}); + const options = {transaction: tx}; + const itemFk = 1; + const code = 1111111111; + + try { + const itemsBarcodeBefore = await models.ItemBarcode.find({}, options); + await models.ItemBarcode.delete(code, itemFk, options); + const itemsBarcodeAfter = await models.ItemBarcode.find({}, options); + + expect(itemsBarcodeBefore.length).toBeGreaterThan(itemsBarcodeAfter.length); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js index 996491992..e5ed0aa85 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('itemShelving return()', () => { +describe('itemShelving return()', () => { beforeAll(async() => { ctx = { accessToken: {userId: 9}, @@ -11,7 +11,8 @@ fdescribe('itemShelving return()', () => { }); it('should return a list of items and alternative locations', async() => { - const itemShelvings = await models.ItemShelving.return('PCC'); + const shelvingFk = 'PCC'; + const itemShelvings = await models.ItemShelving.return(shelvingFk); expect(itemShelvings[0].itemFk).toEqual(999997); expect(itemShelvings[0].quantity).toEqual(10); @@ -19,13 +20,15 @@ fdescribe('itemShelving return()', () => { }); it('should return a list of items without alternatives', async() => { - const itemShelvings = await models.ItemShelving.return('HEJ'); + const shelvingFk = 'HEJ'; + const itemShelvings = await models.ItemShelving.return(shelvingFk); expect(itemShelvings[0].carros.length).toEqual(0); }); it('should return an empty list', async() => { - const itemShelvings = await models.ItemShelving.return('ZZP'); + const shelvingFk = 'ZZP'; + const itemShelvings = await models.ItemShelving.return(shelvingFk); expect(itemShelvings.length).toEqual(0); }); diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js index 84bb9f93a..2fc79d459 100644 --- a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js +++ b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js @@ -12,7 +12,8 @@ describe('expeditonPallet getPallet()', () => { }); it('should obtain the pallet data', async() => { - const pallet = await models.ExpeditionPallet.getPallet(ctx, 1); + const palletId = 1; + const pallet = await models.ExpeditionPallet.getPallet(ctx, palletId); expect(pallet).toBeDefined(); expect(pallet.truckFk).toEqual(1); @@ -20,8 +21,9 @@ describe('expeditonPallet getPallet()', () => { }); it('should throw an error when the pallet does not exist', async() => { + const palletId = 600; try { - await models.ExpeditionPallet.getPallet(ctx, 600); + await models.ExpeditionPallet.getPallet(ctx, palletId); } catch (e) { const error = e; From 854447f7c1d12f0cb1d0dad2b2421ffc7b672426 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 18 Jan 2024 07:36:21 +0100 Subject: [PATCH 078/250] feat: refs #6403 mrw cancelShipment --- back/methods/mrw-config/cancelShipment.js | 6 ++-- ...hipmentCreation.ejs => createShipment.ejs} | 0 ...{shipmentCreation.js => createShipment.js} | 12 +++---- back/models/mrw-config.js | 2 +- db/changes/240401/00-mrwWebService.sql | 32 +++++++++---------- 5 files changed, 25 insertions(+), 27 deletions(-) rename back/methods/mrw-config/{shipmentCreation.ejs => createShipment.ejs} (100%) rename back/methods/mrw-config/{shipmentCreation.js => createShipment.js} (90%) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index fe8af1caa..86e3277a9 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -1,5 +1,6 @@ const axios = require('axios'); const fs = require('fs'); +const ejs = require('ejs'); const {DOMParser} = require('xmldom'); module.exports = Self => { @@ -21,7 +22,7 @@ module.exports = Self => { } }); - Self.deleteExpedition = async expeditionFk => { + Self.cancelShipment = async expeditionFk => { const models = Self.app.models; const mrw = await models.MrwConfig.findOne(); @@ -39,8 +40,7 @@ module.exports = Self => { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); const resultElement = xmlDoc.getElementsByTagName('Mensaje')[0]; - const result = resultElement.textContent; - return result; + return resultElement.textContent; }; }; diff --git a/back/methods/mrw-config/shipmentCreation.ejs b/back/methods/mrw-config/createShipment.ejs similarity index 100% rename from back/methods/mrw-config/shipmentCreation.ejs rename to back/methods/mrw-config/createShipment.ejs diff --git a/back/methods/mrw-config/shipmentCreation.js b/back/methods/mrw-config/createShipment.js similarity index 90% rename from back/methods/mrw-config/shipmentCreation.js rename to back/methods/mrw-config/createShipment.js index b1574784f..0ed4ccf65 100644 --- a/back/methods/mrw-config/shipmentCreation.js +++ b/back/methods/mrw-config/createShipment.js @@ -4,8 +4,8 @@ const fs = require('fs'); const ejs = require('ejs'); module.exports = Self => { - Self.remoteMethod('shipmentCreation', { - description: 'Create an expedition and return a label', + Self.remoteMethod('createShipment', { + description: 'Create an expedition and return a base64Binary label', accessType: 'WRITE', accepts: [{ arg: 'expeditionFk', @@ -17,12 +17,12 @@ module.exports = Self => { root: true }, http: { - path: `/shipmentCreation`, + path: `/createShipment`, verb: 'POST' } }); - Self.shipmentCreation = async expeditionFk => { + Self.createShipment = async expeditionFk => { const models = Self.app.models; const mrw = await models.MrwConfig.findOne(); @@ -56,7 +56,7 @@ module.exports = Self => { WHERE e.id = ?`, [expeditionFk] ); - const shipmentTemplate = fs.readFileSync(__dirname + '/shipmentCreation.ejs', 'utf-8'); + const shipmentTemplate = fs.readFileSync(__dirname + '/createShipment.ejs', 'utf-8'); const renderedShipment = ejs.render(shipmentTemplate, {mrw, expeditionData}); const shipmentResponse = await axios.post(mrw.url, renderedShipment, { headers: { @@ -75,7 +75,7 @@ module.exports = Self => { } }); const getLableXmlDoc = parser.parseFromString(getLabelResponse.data, 'text/xml'); - const base64Binary = getLableXmlDoc.getElementsByTagName('EtiquetaFile')[0].textContent; + const base64Binary = getLableXmlDoc.getElementsByTagName('EtiquetaFile')[0]?.textContent; const expedition = await models.Expedition.findById(expeditionFk); await expedition.updateAttribute('externalId', shipmentId); diff --git a/back/models/mrw-config.js b/back/models/mrw-config.js index 069ef345a..f764b91cc 100644 --- a/back/models/mrw-config.js +++ b/back/models/mrw-config.js @@ -1,4 +1,4 @@ module.exports = Self => { - require('../methods/mrw-config/shipmentCreation')(Self); + require('../methods/mrw-config/createShipment')(Self); require('../methods/mrw-config/cancelShipment')(Self); }; diff --git a/db/changes/240401/00-mrwWebService.sql b/db/changes/240401/00-mrwWebService.sql index 220f5138e..9c85cbf49 100644 --- a/db/changes/240401/00-mrwWebService.sql +++ b/db/changes/240401/00-mrwWebService.sql @@ -1,38 +1,36 @@ -CREATE TABLE IF NOT EXISTS vn.mrwConfig ( - id INT auto_increment NULL, - url varchar(100) NULL, +CREATE TABLE IF NOT EXISTS `vn`.`mrwConfig` ( + `id` INT auto_increment NULL, + `url` varchar(100) NULL, `user` varchar(100) NULL, - password varchar(100) NULL, - franchiseCode varchar(100) NULL, - subscriberCode varchar(100) NULL, + `password` varchar(100) NULL, + `franchiseCode` varchar(100) NULL, + `subscriberCode` varchar(100) NULL, CONSTRAINT mrwConfig_pk PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +ALTER TABLE `vn`.`packingSite` ADD `hasNewLabelMrwMethod` BOOL NULL; -INSERT INTO vn.mrwConfig (url, `user`,password,franchiseCode,subscriberCode) +INSERT INTO `vn`.`mrwConfig` (`url`, `user`, `password`, `franchiseCode`, `subscriberCode`) VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '04301', '009731'); -INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('MrwConfig', 'cancelShipment', 'WRITE', 'ALLOW', 'ROLE', 'employee'); -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) - VALUES ('MrwConfig','renderer','READ','ALLOW','ROLE','employee'); - -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) - VALUES ('MrwConfig','shipmentCreation','WRITE','ALLOW','ROLE','employee'); +INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) + VALUES ('MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee'); -INSERT INTO vn.agency (name,warehouseFk,warehouseAliasFk,isOwn,isAnyVolumeAllowed) +INSERT INTO `vn`.`agency` (`name`,`warehouseFk`,`warehouseAliasFk`,`isOwn`,`isAnyVolumeAllowed`) VALUES ('MRW',1,1,0,0); -INSERT INTO vn.agencyMode (id, name, description, deliveryMethodFk, m3, web, agencyFk, inflation, isVolumetric, reportMail, showAgencyName, isActive, isExternalAgency, flag, code, isRiskFree, hasWeightVolumetric) +INSERT INTO `vn`.`agencyMode` (`id`, `name`, `description`, `deliveryMethodFk`, `m3`, `web`, `agencyFk`, `inflation`, `isVolumetric`, `reportMail`, `showAgencyName`, `isActive`, `isExternalAgency`, `flag`, `code`, `isRiskFree`, `hasWeightVolumetric`) VALUES(25, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0); -INSERT INTO vn.ticket (id, clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight, clonedFrom, cmrFk, editorFk) - VALUES(33, 1101, 1, '2001-01-01 00:00:00.000', 'MRW', NULL, 1, NULL, NULL, 0, 0, 0, 1, NULL, 0, '2001-01-01 00:00:00.000', 1, NULL, 6, NULL, 1, 442, 25, '2001-01-02', 0, 0, 3, 5.00, 1.00, 8.88, 8.07, NULL, NULL, NULL, 100); +INSERT INTO `vn`.`ticket` (`id`, `clientFk`, `warehouseFk`, `shipped`, `nickname`, `refFk`, `addressFk`, `workerFk`, `observations`, `isSigned`, `isLabeled`, `isPrinted`, `packages`, `location`, `hour`, `created`, `isBlocked`, `solution`, `routeFk`, `priority`, `hasPriority`, `companyFk`, `agencyModeFk`, `landed`, `isBoxed`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `totalWithVat`, `totalWithoutVat`, `weight`, `clonedFrom`, `cmrFk`, `editorFk`) + VALUES INSERT INTO vn.expedition (agencyModeFk,ticketFk,freightItemFk,created,counter,workerFk,packagingFk,hostFk,stateTypeFk,hasNewRoute,isBox,editorFk) VALUES (25,33,71,'2001-01-01 01:00:00.000',1,18,'94','',3,0,71,100); From 6f35c62cd55d5350f9dc8e8e8b52bda6b2d31a51 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 18 Jan 2024 11:51:21 +0100 Subject: [PATCH 079/250] feat: refs #6276 test collection_addItem --- back/methods/collection/addItem.js | 3 +- back/methods/collection/spec/addItem.spec.js | 56 +++++++++++++++++++ .../collection/spec/assignCollection.spec.js | 0 .../methods/item-barcode/specs/delete.spec.js | 2 +- 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 back/methods/collection/spec/addItem.spec.js delete mode 100644 back/methods/collection/spec/assignCollection.spec.js diff --git a/back/methods/collection/addItem.js b/back/methods/collection/addItem.js index d3afbd71b..26eb9cc27 100644 --- a/back/methods/collection/addItem.js +++ b/back/methods/collection/addItem.js @@ -34,6 +34,7 @@ module.exports = Self => { Self.addItem = async(ctx, code, quantity, ticketFk, warehouseFk, options) => { const models = Self.app.models; const myOptions = {}; + const $t = ctx.req.__; let tx; if (typeof options == 'object') @@ -47,7 +48,7 @@ module.exports = Self => { try { const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk]); - if (!item.available) throw new UserError('We do not have availability for the selected item'); + if (!item?.available) throw new UserError($t('We do not have availability for the selected item')); await models.Ticket.addSale(ctx, ticketFk, item.id, quantity, myOptions); diff --git a/back/methods/collection/spec/addItem.spec.js b/back/methods/collection/spec/addItem.spec.js new file mode 100644 index 000000000..58cc97610 --- /dev/null +++ b/back/methods/collection/spec/addItem.spec.js @@ -0,0 +1,56 @@ +const {models} = require('vn-loopback/server/server'); +const LoopBackContext = require('loopback-context'); + +fdescribe('collection addItem()', () => { + const quantity = 3; + const ticketFk = 24; + const warehouseFk = 1; + beforeAll(async() => { + activeCtx = { + req: { + accessToken: {userId: 9}, + headers: {origin: 'http://localhost'}, + __: value => value + } + }; + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + + it('should add a new sale', async() => { + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + const code = '1111111111'; + + const salesBefore = await models.Sale.find(null, options); + await models.Collection.addItem(activeCtx, code, quantity, ticketFk, warehouseFk, options); + const salesAfter = await models.Sale.find(null, options); + + expect(salesAfter.length).toEqual(salesBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should throw an error when the item is not available', async() => { + const code = '00000000000'; + const tx = await models.Sale.beginTransaction({}); + + try { + const options = {transaction: tx}; + + await models.Collection.addItem(activeCtx, code, quantity, ticketFk, warehouseFk, options); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + const error = e; + + expect(error.message).toEqual('We do not have availability for the selected item'); + } + }); +}); diff --git a/back/methods/collection/spec/assignCollection.spec.js b/back/methods/collection/spec/assignCollection.spec.js deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/item/back/methods/item-barcode/specs/delete.spec.js b/modules/item/back/methods/item-barcode/specs/delete.spec.js index 56377eb78..094a351a3 100644 --- a/modules/item/back/methods/item-barcode/specs/delete.spec.js +++ b/modules/item/back/methods/item-barcode/specs/delete.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('itemBarcode delete()', () => { +describe('itemBarcode delete()', () => { it('should delete a record by itemFk and code', async() => { const tx = await models.ItemBarcode.beginTransaction({}); const options = {transaction: tx}; From c8bfb35cf663a49ac0f1423bd4caebf3e7f6d87d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 18 Jan 2024 13:28:22 +0100 Subject: [PATCH 080/250] feat: refs #6276 test itemShelvingMake_multi --- back/methods/collection/addItem.js | 2 +- back/methods/collection/spec/addItem.spec.js | 2 +- loopback/locale/en.json | 3 +- loopback/locale/es.json | 3 +- .../back/methods/item-shelving/makeMulti.js | 4 +- .../item-shelving/specs/makeMulti.spec.js | 54 +++++++++++++++++++ 6 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 modules/item/back/methods/item-shelving/specs/makeMulti.spec.js diff --git a/back/methods/collection/addItem.js b/back/methods/collection/addItem.js index 26eb9cc27..3b2a6921b 100644 --- a/back/methods/collection/addItem.js +++ b/back/methods/collection/addItem.js @@ -6,7 +6,7 @@ module.exports = Self => { accepts: [ { arg: 'code', - type: 'number', + type: 'string', required: true }, { diff --git a/back/methods/collection/spec/addItem.spec.js b/back/methods/collection/spec/addItem.spec.js index 58cc97610..199aae588 100644 --- a/back/methods/collection/spec/addItem.spec.js +++ b/back/methods/collection/spec/addItem.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); const LoopBackContext = require('loopback-context'); -fdescribe('collection addItem()', () => { +describe('collection addItem()', () => { const quantity = 3; const ticketFk = 24; const warehouseFk = 1; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 391034126..e3d08326e 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -205,5 +205,6 @@ "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", "Incorrect pin": "Incorrect pin.", "This machine is already in use.": "This machine is already in use.", - "This pallet does not exist": "This pallet does not exist" + "This pallet does not exist": "This pallet does not exist", + "We do not have availability for the selected item": "We do not have availability for the selected item" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index b273f7506..45de30904 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -341,5 +341,6 @@ "No hay tickets para sacar": "No hay tickets para sacar", "There is no zone for these parameters 999999": "There is no zone for these parameters 999999", "This machine is already in use.": "Esta máquina ya está en uso.", - "This pallet does not exist": "Este palet no existe" + "This pallet does not exist": "Este palet no existe", + "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", } \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/makeMulti.js b/modules/item/back/methods/item-shelving/makeMulti.js index e4393e4de..7d1ee11a0 100644 --- a/modules/item/back/methods/item-shelving/makeMulti.js +++ b/modules/item/back/methods/item-shelving/makeMulti.js @@ -47,10 +47,10 @@ module.exports = Self => { }, 0); discardItems.push(item); - let [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?)', [item, warehouseFk]); + const [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?) itemPacking', [item, warehouseFk]); let packing; - if (result) packing = Object.values(result)[0]; + if (result) packing = result.itemPacking; if (!packing) packing = 1; quantity = quantity * packing; diff --git a/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js b/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js new file mode 100644 index 000000000..f64a815f2 --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js @@ -0,0 +1,54 @@ +const {models} = require('vn-loopback/server/server'); + +describe('item makeMulti()', () => { + const warehouseFk = 1; + + beforeAll(async() => { + ctx = { + accessToken: {userId: 9}, + req: { + headers: {origin: 'http://localhost'}, + } + }; + }); + + it('should add two new records', async() => { + const shelvingFk = 'ZPP'; + const items = [1, 1, 1, 2]; + const tx = await models.ItemShelving.beginTransaction({}); + const options = {transaction: tx}; + + try { + await models.ItemShelving.makeMulti(shelvingFk, items, warehouseFk, options); + const itemShelvings = await models.ItemShelving.find({where: {shelvingFk}}, options); + + expect(itemShelvings.length).toEqual(2); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should update the visible items', async() => { + const shelvingFk = 'GVC'; + const items = [2, 2]; + const tx = await models.ItemShelving.beginTransaction({}); + const options = {transaction: tx}; + try { + const {visible: itemsBefore} = await models.ItemShelving.findOne({ + where: {shelvingFk, itemFk: items[0]} + }, options); + await models.ItemShelving.makeMulti(shelvingFk, items, warehouseFk, options); + const {visible: itemsAfter} = await models.ItemShelving.findOne({ + where: {shelvingFk, itemFk: items[0]} + }, options); + + expect(itemsAfter).toEqual(itemsBefore + 2); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); From 19edd7868e630ee34f4655f63533136844c8b453 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 18 Jan 2024 14:18:21 +0100 Subject: [PATCH 081/250] feat: refs #6276 test getVersion --- .../specs/getVersion.spec.js | 29 +++++++++++++++++++ .../{235001 => 240601}/00-newWareHouse.sql | 0 db/dump/fixtures.sql | 8 +++-- 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 back/methods/mobile-app-version-control/specs/getVersion.spec.js rename db/changes/{235001 => 240601}/00-newWareHouse.sql (100%) diff --git a/back/methods/mobile-app-version-control/specs/getVersion.spec.js b/back/methods/mobile-app-version-control/specs/getVersion.spec.js new file mode 100644 index 000000000..e0c517387 --- /dev/null +++ b/back/methods/mobile-app-version-control/specs/getVersion.spec.js @@ -0,0 +1,29 @@ +const {models} = require('vn-loopback/server/server'); + +describe('mobileAppVersionControl getVersion()', () => { + const appName = 'delivery'; + beforeAll(async() => { + ctx = { + req: { + accessToken: {}, + headers: {origin: 'http://localhost'}, + } + }; + }); + + it('should get the version app', async() => { + ctx.req.accessToken.userId = 9; + const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName); + + expect(version).toEqual('9.2'); + expect(versionBeta).toBeUndefined(); + }); + + it('should get the beta version app', async() => { + const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName); + ctx.req.accessToken.userId = 66; + + expect(versionBeta).toBeDefined(); + expect(version).toBeUndefined(); + }); +}); diff --git a/db/changes/235001/00-newWareHouse.sql b/db/changes/240601/00-newWareHouse.sql similarity index 100% rename from db/changes/235001/00-newWareHouse.sql rename to db/changes/240601/00-newWareHouse.sql diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index bab0149e1..c0bd72912 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2716,10 +2716,10 @@ INSERT INTO `vn`.`chat` (`senderFk`, `recipient`, `dated`, `checkUserStatus`, `m (1101, '@PetterParker', util.VN_CURDATE(), 0, 'Second test message', 0, 'pending'); -INSERT INTO `vn`.`mobileAppVersionControl` (`appName`, `version`, `isVersionCritical`) +INSERT INTO `vn`.`mobileAppVersionControl` (`appName`, `version`, `isVersionCritical`,`versionBeta`) VALUES - ('delivery', '9.2', 0), - ('warehouse', '8.1', 0); + ('delivery', '9.2', 0,'9.7'), + ('warehouse', '8.1', 0,'8.3'); INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmentFk`, `type`, `use`, `productionYear`, `workerFk`, `companyFk`) VALUES @@ -3699,3 +3699,5 @@ UPDATE vn.sale INSERT INTO machineWorkerConfig(maxHours) VALUES(12); + +INSERT INTO workerAppTester(workerFk) VALUES(66) From b33594e0daccf5af6c5c59ce4ece657db45bc2aa Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 18 Jan 2024 14:35:51 +0100 Subject: [PATCH 082/250] fix: refs #6276 item_card & wip test --- modules/item/back/methods/item/card.js | 7 +++---- modules/item/back/methods/item/specs/card.spec.js | 12 ++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 modules/item/back/methods/item/specs/card.spec.js diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js index 41d134f3b..dec6047a7 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/card.js @@ -30,14 +30,13 @@ module.exports = Self => { const [result] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]); const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk]); - const realIdItems = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); + const [realIdItem] = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); const barcodes = await models.ItemBarcode.find({ fields: ['code'], where: { - realIdItem: { - inq: realIdItems - } + itemFk: realIdItem + } }); diff --git a/modules/item/back/methods/item/specs/card.spec.js b/modules/item/back/methods/item/specs/card.spec.js new file mode 100644 index 000000000..433384261 --- /dev/null +++ b/modules/item/back/methods/item/specs/card.spec.js @@ -0,0 +1,12 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('item card()', () => { + const itemFk = 1; + const warehouseFk = 1; + it('WIP: should get something', async() => { + const card = await models.Item.card(itemFk, warehouseFk); + + expect(card).toBeDefined(); + expect(card.barcodes); + }); +}); From 34420375cdc3ea3bc6e1adc8fd821bf5b6dc8155 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 18 Jan 2024 15:03:17 +0100 Subject: [PATCH 083/250] feat: refs #6276 test item_updateFromSale --- .../specs/updateFromSale.spec.js | 22 +++++++++++++++++++ .../item/back/methods/item/specs/card.spec.js | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 modules/item/back/methods/item-shelving/specs/updateFromSale.spec.js diff --git a/modules/item/back/methods/item-shelving/specs/updateFromSale.spec.js b/modules/item/back/methods/item-shelving/specs/updateFromSale.spec.js new file mode 100644 index 000000000..dfa294000 --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/updateFromSale.spec.js @@ -0,0 +1,22 @@ +const {models} = require('vn-loopback/server/server'); + +describe('itemShelving updateFromSale()', () => { + it('should update the quantity', async() => { + const tx = await models.ItemBarcode.beginTransaction({}); + const options = {transaction: tx}; + const saleFk = 2; + const filter = {where: {itemFk: 4, shelvingFk: 'HEJ'} + }; + try { + const {visible: visibleBefore} = await models.ItemShelving.findOne(filter, options); + await models.ItemShelving.updateFromSale(saleFk, options); + const {visible: visibleAfter} = await models.ItemShelving.findOne(filter, options); + + expect(visibleAfter).toEqual(visibleBefore + 5); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/item/back/methods/item/specs/card.spec.js b/modules/item/back/methods/item/specs/card.spec.js index 433384261..725a4269d 100644 --- a/modules/item/back/methods/item/specs/card.spec.js +++ b/modules/item/back/methods/item/specs/card.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('item card()', () => { +describe('item card()', () => { const itemFk = 1; const warehouseFk = 1; it('WIP: should get something', async() => { From 7ea1fbfb260184dbb9fcf5c7c0ceedb82c04f814 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 18 Jan 2024 15:09:52 +0100 Subject: [PATCH 084/250] refs #5509 feat: entryDms funcionality --- db/changes/240401/00-entryDms.sql | 87 +++++++++++++++++++ db/dump/fixtures.sql | 10 ++- .../back/methods/entry-dms/removeFile.js | 53 +++++++++++ .../back/methods/entry-dms/uploadFile.js | 86 ++++++++++++++++++ modules/entry/back/models/entry-dms.js | 11 +++ modules/entry/back/models/entry-dms.json | 28 ++++++ 6 files changed, 273 insertions(+), 2 deletions(-) create mode 100644 db/changes/240401/00-entryDms.sql create mode 100644 modules/entry/back/methods/entry-dms/removeFile.js create mode 100644 modules/entry/back/methods/entry-dms/uploadFile.js create mode 100644 modules/entry/back/models/entry-dms.js create mode 100644 modules/entry/back/models/entry-dms.json diff --git a/db/changes/240401/00-entryDms.sql b/db/changes/240401/00-entryDms.sql new file mode 100644 index 000000000..5dab74de9 --- /dev/null +++ b/db/changes/240401/00-entryDms.sql @@ -0,0 +1,87 @@ +CREATE OR REPLACE TABLE `vn`.`entryDms` ( + `entryFk` int(11) NOT NULL, + `dmsFk` int(11) NOT NULL, + `editorFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`entryFk`,`dmsFk`), + KEY `gestdoc_id` (`dmsFk`), + KEY `entryDms_editor` (`editorFk`), + CONSTRAINT `entryDms_dms` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `entryDms_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), + CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + +DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeInsert`; +USE `vn`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert` + BEFORE INSERT ON `entryDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END $$ +DELIMITER ; + +DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeUpdate`; +USE `vn`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate` + BEFORE UPDATE ON `entryDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END $$ +DELIMITER ; + +DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeDelete`; +USE `vn`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeDelete` + BEFORE DELETE ON `entryDms` + FOR EACH ROW +BEGIN + UPDATE dms + SET dmsTypeFk = (SELECT id + FROM dmsType + WHERE `code` = 'trash' + ) + WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) + FROM entryDms + WHERE dmsFk = OLD.dmsFk + ) ; +END $$ +DELIMITER ; + +DROP TRIGGER IF EXISTS `vn`.`entryDms_afterDelete`; +USE `vn`; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete` + AFTER DELETE ON `entryDms` + FOR EACH ROW +BEGIN + INSERT INTO entryLog + SET `action` = 'delete', + `changedModel` = 'entryDms', + `changedModelId` = OLD.entryFk, + `userFk` = account.myUser_getId(); +END $$ +DELIMITER ; + + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('WorkerDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), + ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), + ('Entry', 'uploadFile', 'WRITE', 'ALLOW', 'ROLE', 'employee'); + +UPDATE `salix`.`ACL` + SET accessType = '*' + WHERE model = 'ClientDms' + AND property = '*'; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index b243692bb..b962abfed 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2387,7 +2387,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `c (17, 'cmr', 'cmr', NULL, NULL, 'cmr'), (18, 'dua', 'dua', NULL, NULL, 'dua'), (19, 'inmovilizado', 'inmovilizado', NULL, NULL, 'fixedAssets'), - (20, 'Reclamación', 'reclamacion', 1, 1, 'claim'); + (20, 'Reclamación', 'reclamacion', 1, 1, 'claim'), + (21, 'Entrada', 'entrada', 1, 1, 'entry'); INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES @@ -2398,7 +2399,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()), (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()), (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), - (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()); + (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()), + (9, 21, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'ENTRADA ID 1', util.VN_CURDATE()); INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`) VALUES @@ -3043,3 +3045,7 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`) (4, 1103, 4, 32), (13, 1101, 1, NULL), (14, 1101, 4, 27); + +INSERT INTO `vn`.`entryDms`(`entryFk`, `dmsFk`, `editorFk`) + VALUES + (1, 9, 9); diff --git a/modules/entry/back/methods/entry-dms/removeFile.js b/modules/entry/back/methods/entry-dms/removeFile.js new file mode 100644 index 000000000..677e627a6 --- /dev/null +++ b/modules/entry/back/methods/entry-dms/removeFile.js @@ -0,0 +1,53 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('removeFile', { + description: 'Removes a claim document', + accessType: 'WRITE', + accepts: { + arg: 'id', + type: 'number', + description: 'The document id', + http: {source: 'path'} + }, + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/removeFile`, + verb: 'POST' + } + }); + + Self.removeFile = async(ctx, id, options) => { + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const targetEntryDms = await Self.findById(id, null, myOptions); + const targetDms = await Self.app.models.Dms.removeFile(ctx, targetEntryDms.dmsFk, myOptions); + + if (!targetDms || ! targetEntryDms) + throw new UserError('Try again'); + + const entryDmsDestroyed = await targetEntryDms.destroy(myOptions); + + if (tx) await tx.commit(); + + return entryDmsDestroyed; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; + diff --git a/modules/entry/back/methods/entry-dms/uploadFile.js b/modules/entry/back/methods/entry-dms/uploadFile.js new file mode 100644 index 000000000..fe0cfab5f --- /dev/null +++ b/modules/entry/back/methods/entry-dms/uploadFile.js @@ -0,0 +1,86 @@ + +module.exports = Self => { + Self.remoteMethodCtx('uploadFile', { + description: 'Upload and attach a file', + accessType: 'WRITE', + accepts: [{ + arg: 'id', + type: 'number', + description: 'The claim id', + http: {source: 'path'} + }, + { + arg: 'warehouseId', + type: 'number', + description: 'The warehouse id', + required: true + }, + { + arg: 'companyId', + type: 'number', + description: 'The company id', + required: true + }, + { + arg: 'dmsTypeId', + type: 'number', + description: 'The dms type id', + required: true + }, + { + arg: 'reference', + type: 'string', + required: true + }, + { + arg: 'description', + type: 'string', + required: true + }, + { + arg: 'hasFile', + type: 'boolean', + description: 'True if has an attached file', + required: true + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/:id/uploadFile`, + verb: 'POST' + } + }); + + Self.uploadFile = async(ctx, id, options) => { + const {Dms, EntryDms} = Self.app.models; + const myOptions = {}; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const uploadedFiles = await Dms.uploadFile(ctx, myOptions); + + const promises = uploadedFiles.map(dms => EntryDms.create({ + entryFk: id, + dmsFk: dms.id + }, myOptions)); + await Promise.all(promises); + + if (tx) await tx.commit(); + + return uploadedFiles; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/entry/back/models/entry-dms.js b/modules/entry/back/models/entry-dms.js new file mode 100644 index 000000000..b00337968 --- /dev/null +++ b/modules/entry/back/models/entry-dms.js @@ -0,0 +1,11 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + require('../methods/entry-dms/removeFile')(Self); + + Self.rewriteDbError(function(err) { + if (err.code === 'ER_DUP_ENTRY') + return new UserError('This document already exists on this entry'); + return err; + }); +}; diff --git a/modules/entry/back/models/entry-dms.json b/modules/entry/back/models/entry-dms.json new file mode 100644 index 000000000..c43443c85 --- /dev/null +++ b/modules/entry/back/models/entry-dms.json @@ -0,0 +1,28 @@ +{ + "name": "EntryDms", + "base": "Loggable", + "options": { + "mysql": { + "table": "entryDms" + } + }, + "properties": { + "dmsFk": { + "type": "number", + "id": true, + "required": true + } + }, + "relations": { + "entry": { + "type": "belongsTo", + "model": "Entry", + "foreignKey": "entryFk" + }, + "dms": { + "type": "belongsTo", + "model": "Dms", + "foreignKey": "dmsFk" + } + } +} From 5c0425b942eb9d27bd4e545dface76f32c24418e Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 09:52:49 +0100 Subject: [PATCH 085/250] feat: refs #6276 test machineWorker_update --- .../machine-worker/specs/updateInTime.spec.js | 116 ++++++++++++++++++ back/methods/machine-worker/updateInTime.js | 10 +- db/dump/fixtures.sql | 10 +- loopback/locale/en.json | 1 + loopback/locale/es.json | 2 + .../item-shelving/specs/return.spec.js | 1 - modules/item/back/methods/item/card.js | 2 +- .../expedition-pallet/specs/getPallet.spec.js | 1 - 8 files changed, 136 insertions(+), 7 deletions(-) create mode 100644 back/methods/machine-worker/specs/updateInTime.spec.js diff --git a/back/methods/machine-worker/specs/updateInTime.spec.js b/back/methods/machine-worker/specs/updateInTime.spec.js new file mode 100644 index 000000000..aee1c9187 --- /dev/null +++ b/back/methods/machine-worker/specs/updateInTime.spec.js @@ -0,0 +1,116 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('machineWorker updateInTime()', () => { + const itBoss = 104; + const davidCharles = 1106; + + beforeAll(async() => { + ctx = { + req: { + accessToken: {}, + headers: {origin: 'http://localhost'}, + __: value => value + } + }; + }); + + it('should throw an error if the plate does not exist', async() => { + const tx = await models.MachineWorker.beginTransaction({}); + const options = {transaction: tx}; + const plate = 'RE-123'; + ctx.req.accessToken.userId = 1106; + try { + await models.MachineWorker.updateInTime(ctx, plate, options); + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toContain('the plate does not exist'); + await tx.rollback(); + } + }); + + it('should grab a machine where is not in use', async() => { + const tx = await models.MachineWorker.beginTransaction({}); + const options = {transaction: tx}; + const plate = 'RE-003'; + ctx.req.accessToken.userId = 1107; + try { + const totalBefore = await models.MachineWorker.find(null, options); + await models.MachineWorker.updateInTime(ctx, plate, options); + const totalAfter = await models.MachineWorker.find(null, options); + + expect(totalAfter.length).toEqual(totalBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + }); + + describe('less than 12h', () => { + const plate = 'RE-001'; + it('should trow an error if it is not himself', async() => { + const tx = await models.MachineWorker.beginTransaction({}); + const options = {transaction: tx}; + ctx.req.accessToken.userId = davidCharles; + + try { + await models.MachineWorker.updateInTime(ctx, plate, options); + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toContain('This machine is already in use'); + await tx.rollback(); + } + }); + + it('should set the out time if it is himself', async() => { + const tx = await models.MachineWorker.beginTransaction({}); + const options = {transaction: tx}; + ctx.req.accessToken.userId = itBoss; + + try { + const isNotParked = await models.MachineWorker.findOne({ + where: {workerFk: itBoss} + }, options); + await models.MachineWorker.updateInTime(ctx, plate, options); + const isParked = await models.MachineWorker.findOne({ + where: {workerFk: itBoss} + }, options); + + expect(isNotParked.outTime).toBeNull(); + expect(isParked.outTime).toBeDefined(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + }); + }); + + describe('equal or more than 12h', () => { + const plate = 'RE-002'; + it('should set the out time and grab the machine', async() => { + const tx = await models.MachineWorker.beginTransaction({}); + const options = {transaction: tx}; + ctx.req.accessToken.userId = davidCharles; + const filter = { + where: {workerFk: davidCharles, machineFk: 2} + }; + try { + const isNotParked = await models.MachineWorker.findOne(filter, options); + const totalBefore = await models.MachineWorker.find(null, options); + await models.MachineWorker.updateInTime(ctx, plate, options); + const isParked = await models.MachineWorker.findOne(filter, options); + const totalAfter = await models.MachineWorker.find(null, options); + + expect(isNotParked.outTime).toBeNull(); + expect(isParked.outTime).toBeDefined(); + expect(totalAfter.length).toEqual(totalBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + }); + }); +}); diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 705bcdd92..eebb09990 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -18,6 +18,7 @@ module.exports = Self => { Self.updateInTime = async(ctx, plate, options) => { const models = Self.app.models; const userId = ctx.req.accessToken.userId; + const $t = ctx.req.__; let tx; const myOptions = {}; @@ -35,11 +36,13 @@ module.exports = Self => { fields: ['id', 'plate'], where: {plate} }, myOptions); - if (!machine) throw new Error(`plate ${plate} does not exist.`); + + if (!machine) + throw new Error($t('the plate does not exist', {plate})); const machineWorker = await Self.findOne({ where: { - machineFk: machine.id, + or: [{machineFk: machine.id}, {workerFk: userId}], outTime: null, } }, myOptions); @@ -49,7 +52,8 @@ module.exports = Self => { const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); const isHimSelf = userId == machineWorker.workerFk; - if (maxHours > hoursDifference && !isHimSelf) throw new UserError('This machine is already in use.'); + if (maxHours > hoursDifference && !isHimSelf) + throw new UserError($t('This machine is already in use.')); await machineWorker.updateAttributes({ outTime: Date.vnNew() diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c0bd72912..9fc4d4fb1 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3700,4 +3700,12 @@ UPDATE vn.sale INSERT INTO machineWorkerConfig(maxHours) VALUES(12); -INSERT INTO workerAppTester(workerFk) VALUES(66) +INSERT INTO workerAppTester(workerFk) VALUES(66); + +INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmentFk`, `type`, `use`, `productionYear`, `workerFk`, `companyFk`) + VALUES + ('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442); + + +INSERT INTO machineWorker(workerFk,machineFk,inTimed) + VALUES (104,1,'2001-01-01 10:00:00.00.000'); \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index e3d08326e..a6c3b4ee4 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -205,6 +205,7 @@ "It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}", "Incorrect pin": "Incorrect pin.", "This machine is already in use.": "This machine is already in use.", + "the plate does not exist": "The plate {{plate}} does not exist", "This pallet does not exist": "This pallet does not exist", "We do not have availability for the selected item": "We do not have availability for the selected item" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 45de30904..e13a8dab9 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -341,6 +341,8 @@ "No hay tickets para sacar": "No hay tickets para sacar", "There is no zone for these parameters 999999": "There is no zone for these parameters 999999", "This machine is already in use.": "Esta máquina ya está en uso.", + "the plate does not exist": "La máquina {{plate}} no existe", "This pallet does not exist": "Este palet no existe", "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", + "Esta máquina ya está en uso.": "Esta máquina ya está en uso." } \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js index e5ed0aa85..c8acd6ab9 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -3,7 +3,6 @@ const {models} = require('vn-loopback/server/server'); describe('itemShelving return()', () => { beforeAll(async() => { ctx = { - accessToken: {userId: 9}, req: { headers: {origin: 'http://localhost'}, } diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js index dec6047a7..45c2ac36c 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/card.js @@ -1,6 +1,6 @@ module.exports = Self => { Self.remoteMethod('card', { - description: 'Idk', + description: 'Get the data from an item', accessType: 'READ', http: { path: `/card`, diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js index 2fc79d459..497fe04bb 100644 --- a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js +++ b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js @@ -3,7 +3,6 @@ const {models} = require('vn-loopback/server/server'); describe('expeditonPallet getPallet()', () => { beforeAll(async() => { ctx = { - accessToken: {userId: 9}, req: { headers: {origin: 'http://localhost'}, __: value => value From b7ce6cac9c20ee77823fec60689546b58ef7b47c Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 12:38:58 +0100 Subject: [PATCH 086/250] fix: refs #6276 machineWorker_update & tests --- .../machine-worker/specs/updateInTime.spec.js | 18 +++++++++++++++++- back/methods/machine-worker/updateInTime.js | 8 ++++++-- .../specs/getVersion.spec.js | 2 +- loopback/locale/en.json | 4 +++- loopback/locale/es.json | 3 ++- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/back/methods/machine-worker/specs/updateInTime.spec.js b/back/methods/machine-worker/specs/updateInTime.spec.js index aee1c9187..f166214b0 100644 --- a/back/methods/machine-worker/specs/updateInTime.spec.js +++ b/back/methods/machine-worker/specs/updateInTime.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('machineWorker updateInTime()', () => { +describe('machineWorker updateInTime()', () => { const itBoss = 104; const davidCharles = 1106; @@ -65,6 +65,22 @@ fdescribe('machineWorker updateInTime()', () => { } }); + it('should throw an error if it is himself with a different machine', async() => { + const tx = await models.MachineWorker.beginTransaction({}); + const options = {transaction: tx}; + ctx.req.accessToken.userId = itBoss; + const plate = 'RE-003'; + try { + await models.MachineWorker.updateInTime(ctx, plate, options); + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toEqual('You are already using a machine'); + await tx.rollback(); + } + }); + it('should set the out time if it is himself', async() => { const tx = await models.MachineWorker.beginTransaction({}); const options = {transaction: tx}; diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index eebb09990..706f1a80e 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -51,15 +51,19 @@ module.exports = Self => { const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); const isHimSelf = userId == machineWorker.workerFk; + const isSameMachine = machine.id == machineWorker.machineFk; - if (maxHours > hoursDifference && !isHimSelf) + if (hoursDifference < maxHours && !isHimSelf) throw new UserError($t('This machine is already in use.')); + if (hoursDifference < maxHours && isHimSelf && !isSameMachine) + throw new UserError($t('You are already using a machine')); + await machineWorker.updateAttributes({ outTime: Date.vnNew() }, myOptions); - if (maxHours <= hoursDifference) + if (hoursDifference >= maxHours) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); } else await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); diff --git a/back/methods/mobile-app-version-control/specs/getVersion.spec.js b/back/methods/mobile-app-version-control/specs/getVersion.spec.js index e0c517387..59d794ccf 100644 --- a/back/methods/mobile-app-version-control/specs/getVersion.spec.js +++ b/back/methods/mobile-app-version-control/specs/getVersion.spec.js @@ -20,8 +20,8 @@ describe('mobileAppVersionControl getVersion()', () => { }); it('should get the beta version app', async() => { - const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName); ctx.req.accessToken.userId = 66; + const {version, versionBeta} = await models.MobileAppVersionControl.getVersion(ctx, appName); expect(versionBeta).toBeDefined(); expect(version).toBeUndefined(); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index a6c3b4ee4..b10ea2e71 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -207,5 +207,7 @@ "This machine is already in use.": "This machine is already in use.", "the plate does not exist": "The plate {{plate}} does not exist", "This pallet does not exist": "This pallet does not exist", - "We do not have availability for the selected item": "We do not have availability for the selected item" + "We do not have availability for the selected item": "We do not have availability for the selected item", + "You are already using a machine": "You are already using a machine" + } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e13a8dab9..c704cb8fd 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -344,5 +344,6 @@ "the plate does not exist": "La máquina {{plate}} no existe", "This pallet does not exist": "Este palet no existe", "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", - "Esta máquina ya está en uso.": "Esta máquina ya está en uso." + "You are already using a machine": "Ya estás usando una máquina.", + "Ya estás usando una máquina.": "Ya estás usando una máquina." } \ No newline at end of file From 817a6b1289cb27aeda9567dc56c831e7dc180739 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 14:35:10 +0100 Subject: [PATCH 087/250] feat: refs #6276 test operator_add --- loopback/locale/en.json | 4 +-- loopback/locale/es.json | 3 +- modules/worker/back/methods/operator/add.js | 22 +++++++++++++-- .../back/methods/operator/spec/add.spec.js | 28 +++++++++++++++++++ 4 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 modules/worker/back/methods/operator/spec/add.spec.js diff --git a/loopback/locale/en.json b/loopback/locale/en.json index b10ea2e71..c22aeb311 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -208,6 +208,6 @@ "the plate does not exist": "The plate {{plate}} does not exist", "This pallet does not exist": "This pallet does not exist", "We do not have availability for the selected item": "We do not have availability for the selected item", - "You are already using a machine": "You are already using a machine" - + "You are already using a machine": "You are already using a machine", + "This worker does not exist": "This worker does not exist" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index c704cb8fd..e5293d856 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -345,5 +345,6 @@ "This pallet does not exist": "Este palet no existe", "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", "You are already using a machine": "Ya estás usando una máquina.", - "Ya estás usando una máquina.": "Ya estás usando una máquina." + "This worker does not exist": "Este trabajador no existe", + "Este trabajador no existe": "Este trabajador no existe" } \ No newline at end of file diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js index eaf74e7b4..d330bc25b 100644 --- a/modules/worker/back/methods/operator/add.js +++ b/modules/worker/back/methods/operator/add.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('add', { description: 'Add a new operator', @@ -8,13 +9,28 @@ module.exports = Self => { } }); - Self.add = async ctx => { + Self.add = async(ctx, options) => { const userId = ctx.req.accessToken.userId; - const user = await Self.findById(userId); - if (!user) { + const myOptions = {}; + const $t = ctx.req.__; + let tx; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { await Self.create({ workerFk: userId }); + if (tx) await tx.commit(); + } catch (e) { + if (tx) await tx.rollback(); + throw new UserError($t('This worker does not exist')); } }; }; diff --git a/modules/worker/back/methods/operator/spec/add.spec.js b/modules/worker/back/methods/operator/spec/add.spec.js new file mode 100644 index 000000000..c2b244ada --- /dev/null +++ b/modules/worker/back/methods/operator/spec/add.spec.js @@ -0,0 +1,28 @@ +const {models} = require('vn-loopback/server/server'); + +describe('operator add()', () => { + beforeAll(async() => { + ctx = { + req: { + accessToken: {userId: 100000}, + headers: {origin: 'http://localhost'}, + __: value => value + } + }; + }); + + it('should throw an error if the worker does not exist', async() => { + const tx = await models.Operator.beginTransaction({}); + const options = {transaction: tx}; + + try { + await models.Operator.add(ctx, options); + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toEqual('This worker does not exist'); + await tx.rollback(); + } + }); +}); From 6e59a87f9c10ef74424aba63dcda25bd1adbb88b Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 14:44:07 +0100 Subject: [PATCH 088/250] feat: refs #6276 test operator_add --- .../back/methods/operator/spec/add.spec.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/methods/operator/spec/add.spec.js b/modules/worker/back/methods/operator/spec/add.spec.js index c2b244ada..4d26e8ca9 100644 --- a/modules/worker/back/methods/operator/spec/add.spec.js +++ b/modules/worker/back/methods/operator/spec/add.spec.js @@ -1,10 +1,13 @@ const {models} = require('vn-loopback/server/server'); describe('operator add()', () => { + const itBoss = 104; + const noWorker = 100000; + beforeAll(async() => { ctx = { req: { - accessToken: {userId: 100000}, + accessToken: {}, headers: {origin: 'http://localhost'}, __: value => value } @@ -14,6 +17,7 @@ describe('operator add()', () => { it('should throw an error if the worker does not exist', async() => { const tx = await models.Operator.beginTransaction({}); const options = {transaction: tx}; + ctx.req.accessToken.userId = noWorker; try { await models.Operator.add(ctx, options); @@ -25,4 +29,25 @@ describe('operator add()', () => { await tx.rollback(); } }); + + it('should add a new operator successfully', async() => { + const tx = await models.Operator.beginTransaction({}); + const options = {transaction: tx}; + ctx.req.accessToken.userId = itBoss; + + try { + const operatorBefore = await models.Operator.find(null, options); + await models.Operator.add(ctx, options); + const operatorAfter = await models.Operator.find(null, options); + + const isOperator = await models.Operator.findOne(null, options); + + expect(operatorBefore.length).toEqual(operatorAfter.length - 1); + expect(isOperator).toBeDefined(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); From 428da6fe00c84168394f7fb71d2c4e7ee6051b03 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 14:50:33 +0100 Subject: [PATCH 089/250] feat: refs #6276 drop worker_getPrinter --- .../back/methods/operator/getPrinter.js | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 modules/worker/back/methods/operator/getPrinter.js diff --git a/modules/worker/back/methods/operator/getPrinter.js b/modules/worker/back/methods/operator/getPrinter.js deleted file mode 100644 index 88e7d8090..000000000 --- a/modules/worker/back/methods/operator/getPrinter.js +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('getPrinter', { - description: 'Gets user\'s printer', - accessType: 'READ', - http: { - path: `/getPrinter`, - verb: 'GET' - }, - returns: { - type: ['object'], - root: true - }, - }); - - Self.getPrinter = async ctx => { - const userId = ctx.req.accessToken.userId; - - const operator = await Self.findOne({ - include: [ - { - relation: 'printer', - scope: { - fields: ['id', 'name'], - } - } - ], - where: { - workerFk: userId - } - }); - - if (operator) { - const printer = operator.printer(); - return Array.isArray(printer) ? printer : [printer]; - } - return []; - }; -}; From d78e90687e51a0ad990b543f9b9161e45f9ae691 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 14:51:03 +0100 Subject: [PATCH 090/250] fix: refs #6276 drop worker_getPrinter --- modules/worker/back/models/operator.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index 5e8870130..b4569d7f5 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -1,6 +1,5 @@ module.exports = Self => { require('../methods/operator/add')(Self); - require('../methods/operator/getPrinter')(Self); require('../methods/operator/getAvailablePrinters')(Self); Self.observe('after save', async function(ctx) { From f8faa958e66f29cf83f4de2ee14a0a7f164fd801 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 19 Jan 2024 14:53:41 +0100 Subject: [PATCH 091/250] feat: refs #6276 drop worker_getPrinter --- .../methods/operator/getAvailablePrinters.js | 39 ------------------- modules/worker/back/models/operator.js | 1 - 2 files changed, 40 deletions(-) delete mode 100644 modules/worker/back/methods/operator/getAvailablePrinters.js diff --git a/modules/worker/back/methods/operator/getAvailablePrinters.js b/modules/worker/back/methods/operator/getAvailablePrinters.js deleted file mode 100644 index 2e787da2b..000000000 --- a/modules/worker/back/methods/operator/getAvailablePrinters.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('getAvailablePrinters', { - description: 'Retrieve available printers for an user', - accessType: 'READ', - http: { - path: `/getAvailabePrinters`, - verb: 'GET' - }, - returns: { - type: ['object'], - }, - }); - - Self.getAvailablePrinters = async ctx => { - const userId = ctx.req.accessToken.userId; - - const operators = await Self.find({ - fields: [], - where: { - workerFk: userId, - }, - - include: { - relation: 'printer', - scope: { - fields: ['id', 'name'] - }, - where: { - isLabeler: {neq: 0} - } - } - }); - if (operators.length) { - return operators.map(operator => { - return operator.printer(); - }); - } - }; -}; diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index b4569d7f5..442ac343f 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -1,6 +1,5 @@ module.exports = Self => { require('../methods/operator/add')(Self); - require('../methods/operator/getAvailablePrinters')(Self); Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance; From 89d18e29f0f338b776e6a437bbfb31fc76cd2172 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 22 Jan 2024 07:49:21 +0100 Subject: [PATCH 092/250] feat: refs #6276 test saleTrackingReplace (updateTracking) --- db/dump/fixtures.sql | 12 ++- .../specs/updateTracking.spec.js | 78 +++++++++++++++++++ .../methods/sale-tracking/updateTracking.js | 29 ++++--- modules/ticket/back/models/sale-buy.json | 8 +- 4 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 9fc4d4fb1..04846435f 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3697,15 +3697,19 @@ UPDATE vn.collection UPDATE vn.sale SET isPicked =FALSE; -INSERT INTO machineWorkerConfig(maxHours) +INSERT INTO vn.machineWorkerConfig(maxHours) VALUES(12); -INSERT INTO workerAppTester(workerFk) VALUES(66); +INSERT INTO vn.workerAppTester(workerFk) VALUES(66); INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmentFk`, `type`, `use`, `productionYear`, `workerFk`, `companyFk`) VALUES ('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442); -INSERT INTO machineWorker(workerFk,machineFk,inTimed) - VALUES (104,1,'2001-01-01 10:00:00.00.000'); \ No newline at end of file +INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) + VALUES (104,1,'2001-01-01 10:00:00.00.000'); + +UPDATE vn.buy + SET itemOriginalFk = 1 + WHERE id = 1; \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js b/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js new file mode 100644 index 000000000..2756bc09e --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js @@ -0,0 +1,78 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('saleTracking updateTracking()', () => { + const saleFk = 1; + const originalQuantity = 10; + const code = 'PREPARED'; + const isChecked = true; + const buyFk = 1; + const isScanned = false; + + beforeAll(async() => { + ctx = { + req: { + accessToken: {userId: 104}, + headers: {origin: 'http://localhost'}, + } + }; + }); + + it('should add a new saleTracking and saleBuy', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + + try { + const saleTrackingBefore = await models.SaleTracking.find(null, options); + const saleBuyBefore = await models.SaleBuy.find(null, options); + await models.SaleTracking.updateTracking( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + options + ); + + const saleTrackingAfter = await models.SaleTracking.find(null, options); + const saleBuyAfter = await models.SaleBuy.find(null, options); + + expect(saleTrackingAfter.length).toEqual(saleTrackingBefore.length + 1); + expect(saleBuyAfter.length).toEqual(saleBuyBefore.length + 1); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should only update a saleTracking', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + const saleFk = 2; + + try { + const saleTrackingBefore = await models.SaleTracking.find(null, options); + await models.SaleTracking.updateTracking( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + options + ); + const saleTrackingAfter = await models.SaleTracking.find(null, options); + + expect(saleTrackingAfter.length).toEqual(saleTrackingBefore.length + 1); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 453b0b0c6..7cb2b4a58 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -39,7 +39,7 @@ module.exports = Self => { } }); - Self.updateTracking = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, options) => { + Self.updateTracking = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned = null, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const myOptions = {}; @@ -58,24 +58,31 @@ module.exports = Self => { where: {code}, }, myOptions); - const attributes = { + const uniqueAttributes = { saleFk, + workerFk: userId, + stateFk: state?.id, + }; + const attributes = { isChecked, originalQuantity, - workerFk: userId, - stateFk: state.id, - isScanned: isScanned === undefined ? null : isScanned, + isScanned }; const saleTracking = await models.SaleTracking.findOne({ - where: attributes, + where: uniqueAttributes, }, myOptions); - if (!saleTracking) - await models.SaleTracking.create(attributes, myOptions); - - else - await saleTracking.updateAttributes(attributes, myOptions); + if (!saleTracking) { + await models.SaleTracking.create({ + ...uniqueAttributes, + ...attributes + }, myOptions); + } else { + await saleTracking.updateAttributes({ + ...attributes + }, myOptions); + } let isBuy; if (buyFk) { diff --git a/modules/ticket/back/models/sale-buy.json b/modules/ticket/back/models/sale-buy.json index 5279e6787..60ff2bef4 100644 --- a/modules/ticket/back/models/sale-buy.json +++ b/modules/ticket/back/models/sale-buy.json @@ -17,9 +17,6 @@ }, "created": { "type": "date" - }, - "isChecked": { - "type": "number" } }, "relations": { @@ -27,6 +24,11 @@ "type": "belongsTo", "model": "Sale", "foreignKey": "saleFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" } } } From f04724a61f6a9c924de9ec4998486651435b8d50 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 22 Jan 2024 07:58:18 +0100 Subject: [PATCH 093/250] feat: refs #6276 new test added --- loopback/locale/en.json | 4 ++- loopback/locale/es.json | 3 +- .../specs/updateTracking.spec.js | 28 ++++++++++++++++++- .../methods/sale-tracking/updateTracking.js | 3 ++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index c22aeb311..0f1be5776 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -209,5 +209,7 @@ "This pallet does not exist": "This pallet does not exist", "We do not have availability for the selected item": "We do not have availability for the selected item", "You are already using a machine": "You are already using a machine", - "This worker does not exist": "This worker does not exist" + "This worker does not exist": "This worker does not exist", + "this state does not exist": "This state does not exist" + } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index e5293d856..158d351df 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -346,5 +346,6 @@ "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", "You are already using a machine": "Ya estás usando una máquina.", "This worker does not exist": "Este trabajador no existe", - "Este trabajador no existe": "Este trabajador no existe" + "this state does not exist": "Este estado no existe", + "Este estado no existe": "Este estado no existe" } \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js b/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js index 2756bc09e..a58a69fe7 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('saleTracking updateTracking()', () => { +describe('saleTracking updateTracking()', () => { const saleFk = 1; const originalQuantity = 10; const code = 'PREPARED'; @@ -13,10 +13,36 @@ fdescribe('saleTracking updateTracking()', () => { req: { accessToken: {userId: 104}, headers: {origin: 'http://localhost'}, + __: value => value } }; }); + it('should add a new saleTracking and saleBuy', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + const code = 'FAKESTATE'; + try { + await models.SaleTracking.updateTracking( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + options + ); + + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toEqual('this state does not exist'); + await tx.rollback(); + } + }); + it('should add a new saleTracking and saleBuy', async() => { const tx = await models.SaleTracking.beginTransaction({}); const options = {transaction: tx}; diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 7cb2b4a58..81eef28b4 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('updateTracking', { description: 'Modify a saleTracking record and, if applicable, add a corresponding record in saleBuy.', @@ -42,6 +43,7 @@ module.exports = Self => { Self.updateTracking = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned = null, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; + const $t = ctx.req.__; const myOptions = {}; let tx; @@ -58,6 +60,7 @@ module.exports = Self => { where: {code}, }, myOptions); + if (!state) throw new UserError($t('this state does not exist')); const uniqueAttributes = { saleFk, workerFk: userId, From ed713e762b1f346d4c05088c51277c6e9493ab0e Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 22 Jan 2024 12:36:52 +0100 Subject: [PATCH 094/250] feat: refs #6276 test saleTracking_mark --- .vscode/settings.json | 3 +- loopback/locale/en.json | 4 +- loopback/locale/es.json | 5 +- loopback/server/connectors/vn-mysql.js | 8 +- .../ticket/back/methods/sale-tracking/mark.js | 24 +++--- .../methods/sale-tracking/specs/mark.spec.js | 76 +++++++++++++++++++ .../specs/updateTracking.spec.js | 2 +- 7 files changed, 100 insertions(+), 22 deletions(-) create mode 100644 modules/ticket/back/methods/sale-tracking/specs/mark.spec.js diff --git a/.vscode/settings.json b/.vscode/settings.json index 03479d27a..76b039f61 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,5 +18,6 @@ "salix", "fdescribe", "Loggable" - ] + ], + "CodeGPT.apiKey": "CodeGPT Plus Beta" } diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 0f1be5776..6b48fcb98 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -210,6 +210,8 @@ "We do not have availability for the selected item": "We do not have availability for the selected item", "You are already using a machine": "You are already using a machine", "This worker does not exist": "This worker does not exist", - "this state does not exist": "This state does not exist" + "this state does not exist": "This state does not exist", + "The line could not be marked": "The line could not be marked" + } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 158d351df..9d6404dac 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -331,7 +331,6 @@ "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", - "The line could not be marked": "The line could not be marked", "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada", "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", "Incorrect pin": "Pin incorrecto.", @@ -347,5 +346,7 @@ "You are already using a machine": "Ya estás usando una máquina.", "This worker does not exist": "Este trabajador no existe", "this state does not exist": "Este estado no existe", - "Este estado no existe": "Este estado no existe" + "Este estado no existe": "Este estado no existe", + "The line could not be marked": "No se ha podido marcar la línea", + "No se ha podido marcar la línea": "No se ha podido marcar la línea" } \ No newline at end of file diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index 1f7169501..7c086ff9b 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -268,14 +268,8 @@ class VnMySQL extends MySQL { arguments, model, ctx, opts, cb); } - isLoggable(model) { - const Model = this.getModelDefinition(model).model; - const {settings} = Model.definition; - return settings?.mixins?.Loggable; - } - invokeMethod(method, args, model, ctx, opts, cb) { - if (!this.isLoggable(model)) + if (!opts?.httpCtx) return super[method].apply(this, args); this.invokeMethodP(method, [...args], model, ctx, opts) diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index 327421673..0ca674e39 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -54,6 +54,7 @@ module.exports = Self => { Self.mark = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; + const $t = ctx.req.__; const myOptions = {}; let tx; @@ -73,15 +74,9 @@ module.exports = Self => { userFk: userId }, myOptions); - const itemShelving = await models.ItemShelving.findOne({ - where: { - id: itemShelvingFk - } - }, myOptions); + const itemShelving = await models.ItemShelving.findById(itemShelvingFk, myOptions); - await itemShelving.updateAttributes({ - visible: itemShelving.visible - quantity} - , myOptions); + await itemShelving.updateAttributes({visible: itemShelving.visible - quantity}, myOptions); await Self.updateAll( {saleFk}, @@ -89,12 +84,21 @@ module.exports = Self => { myOptions ); - await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, myOptions); + await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, null, isScanned, myOptions); if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); - throw new UserError('The line could not be marked'); + throw new UserError($t('The line could not be marked')); } + + const buy = await models.Buy.findOne({ + where: { + id: buyFk, + itemOriginalFk: {neq: null} + } + }); + + if (buy) await models.SaleBuy.create({saleFk, buyFk}); }; }; diff --git a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js new file mode 100644 index 000000000..dfc790b91 --- /dev/null +++ b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js @@ -0,0 +1,76 @@ +const {models} = require('vn-loopback/server/server'); +fdescribe('saleTracking mark()', () => { + const saleFk = 1; + const originalQuantity = 10; + const code = 'PREPARED'; + const isChecked = true; + const buyFk = 1; + const isScanned = false; + const quantity = 1; + const itemShelvingFk = 1; + + beforeAll(async() => { + ctx = { + req: { + accessToken: {userId: 104}, + headers: {origin: 'http://localhost'}, + __: value => value + } + }; + }); + + it('should throw an error if the line was not able to be marked', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + const code = 'FAKESTATE'; + try { + await models.SaleTracking.mark( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + quantity, + itemShelvingFk, + options + ); + + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toEqual('The line could not be marked'); + await tx.rollback(); + } + }); + + it('should add an itemShelvingSale and Modify a saleTracking', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + try { + const itemShelvingSaleBefore = await models.ItemShelvingSale.find({}, options); + await models.SaleTracking.mark( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + quantity, + itemShelvingFk, + options + ); + const itemShelvingSaleAfter = await models.ItemShelvingSale.find({}, options); + const saleTracking = await models.SaleTracking.findOne({where: {saleFk, isChecked: false}}, options); + + expect(itemShelvingSaleAfter.length).toEqual(itemShelvingSaleBefore.length + 1); + expect(saleTracking.isChecked).toBeFalse(); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + } + }); +}); diff --git a/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js b/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js index a58a69fe7..44bd1a60a 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/updateTracking.spec.js @@ -18,7 +18,7 @@ describe('saleTracking updateTracking()', () => { }; }); - it('should add a new saleTracking and saleBuy', async() => { + it('should throw an error if the state does not exist', async() => { const tx = await models.SaleTracking.beginTransaction({}); const options = {transaction: tx}; const code = 'FAKESTATE'; From e3899b2cf70fd28ecd3c40e17ec58576b81dc177 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 22 Jan 2024 13:32:50 +0100 Subject: [PATCH 095/250] refactor: refs #6276 saleTracking_mark --- modules/ticket/back/methods/sale-tracking/mark.js | 14 +++++--------- .../back/methods/sale-tracking/specs/mark.spec.js | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index 0ca674e39..c8c73b935 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -86,19 +86,15 @@ module.exports = Self => { await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, null, isScanned, myOptions); + try { + const buy = await models.Buy.findById(buyFk, myOptions); + if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); + } catch (e) {} + if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); throw new UserError($t('The line could not be marked')); } - - const buy = await models.Buy.findOne({ - where: { - id: buyFk, - itemOriginalFk: {neq: null} - } - }); - - if (buy) await models.SaleBuy.create({saleFk, buyFk}); }; }; diff --git a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js index dfc790b91..49e4ec6e5 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js @@ -1,5 +1,5 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('saleTracking mark()', () => { +describe('saleTracking mark()', () => { const saleFk = 1; const originalQuantity = 10; const code = 'PREPARED'; From efb8bc46c668b1646f4de1830bf4673e03f6c327 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 22 Jan 2024 15:13:49 +0100 Subject: [PATCH 096/250] refactor: refs #6276 saleTracking_mark --- loopback/locale/en.json | 5 +-- loopback/locale/es.json | 3 +- .../ticket/back/methods/sale-tracking/mark.js | 9 ++++- .../methods/sale-tracking/specs/mark.spec.js | 40 ++++++++++++++++++- .../methods/sale/getFromSectorCollection.js | 9 +++-- 5 files changed, 57 insertions(+), 9 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 6b48fcb98..24c28a927 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -211,7 +211,6 @@ "You are already using a machine": "You are already using a machine", "This worker does not exist": "This worker does not exist", "this state does not exist": "This state does not exist", - "The line could not be marked": "The line could not be marked" - - + "The line could not be marked": "The line could not be marked", + "The sale can not be tracked": "The sale can not be tracked" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 9d6404dac..25fbbda70 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -348,5 +348,6 @@ "this state does not exist": "Este estado no existe", "Este estado no existe": "Este estado no existe", "The line could not be marked": "No se ha podido marcar la línea", - "No se ha podido marcar la línea": "No se ha podido marcar la línea" + "No se ha podido marcar la línea": "No se ha podido marcar la línea", + "The sale can not be tracked": "La línea no puede ser rastreada" } \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index c8c73b935..dc288ba93 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -89,10 +89,17 @@ module.exports = Self => { try { const buy = await models.Buy.findById(buyFk, myOptions); if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); - } catch (e) {} + } catch (e) { + throw new UserError($t('The sale can not be tracked')); + } if (tx) await tx.commit(); } catch (e) { + if (e.message == $t('The sale can not be tracked')) { + if (tx) tx.commit(); + throw e; + } + if (tx) await tx.rollback(); throw new UserError($t('The line could not be marked')); } diff --git a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js index 49e4ec6e5..353a39c49 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js @@ -1,5 +1,5 @@ const {models} = require('vn-loopback/server/server'); -describe('saleTracking mark()', () => { +fdescribe('saleTracking mark()', () => { const saleFk = 1; const originalQuantity = 10; const code = 'PREPARED'; @@ -46,6 +46,44 @@ describe('saleTracking mark()', () => { } }); + it('should throw an error if there are duplicate salebuys', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + try { + await models.SaleTracking.mark( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + quantity, + itemShelvingFk, + options + ); + + await models.SaleTracking.mark( + ctx, + saleFk, + originalQuantity, + code, + isChecked, + buyFk, + isScanned, + quantity, + itemShelvingFk, + options + ); + await tx.rollback(); + } catch (e) { + const error = e; + + expect(error.message).toEqual('The sale can not be tracked'); + await tx.rollback(); + } + }); + it('should add an itemShelvingSale and Modify a saleTracking', async() => { const tx = await models.SaleTracking.beginTransaction({}); const options = {transaction: tx}; diff --git a/modules/ticket/back/methods/sale/getFromSectorCollection.js b/modules/ticket/back/methods/sale/getFromSectorCollection.js index 323474cb4..a56966887 100644 --- a/modules/ticket/back/methods/sale/getFromSectorCollection.js +++ b/modules/ticket/back/methods/sale/getFromSectorCollection.js @@ -30,7 +30,9 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const sales = await Self.rawSql( + const sales = await Self.rawSql('CALL sectorCollection_getSale(?)', [sectorCollectionFk], myOptions); + + /* const sales = await Self.rawSql( `SELECT s.ticketFk, s.itemFk, i.longName, @@ -52,13 +54,14 @@ module.exports = Self => { JOIN client c ON c.id=t.clientFk LEFT JOIN itemShelvingSaleSum iss ON iss.saleFk = s.id WHERE scsg.sectorCollectionFk = ? - AND st.workerFk = ?;`, [sectorCollectionFk, userId]); + AND st.workerFk = ?;`, [sectorCollectionFk, userId]); */ const itemShelvings = []; for (let sale of sales) { const [carros] = await Self.rawSql( 'CALL vn.itemPlacementSupplyStockGetTargetList(?, ?)', - [sale.itemFk, sectorFk] + [sale.itemFk, sectorFk], + myOptions ); itemShelvings.push({ From dcf6232c1403c2621e8a854bd15a5ab4c0e12392 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 23 Jan 2024 08:39:30 +0100 Subject: [PATCH 097/250] feat: refs #6276 test sale_getFromSectorCollection --- db/dump/fixtures.sql | 9 +++--- loopback/locale/es.json | 3 +- .../methods/sale-tracking/specs/mark.spec.js | 2 +- .../methods/sale/getFromSectorCollection.js | 28 ++----------------- .../specs/getFromSectorCollection.spec.js | 23 +++++++++++++++ 5 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 modules/ticket/back/methods/sale/specs/getFromSectorCollection.spec.js diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 04846435f..e536e694d 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3707,9 +3707,8 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen ('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442); -INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) - VALUES (104,1,'2001-01-01 10:00:00.00.000'); +INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000'); -UPDATE vn.buy - SET itemOriginalFk = 1 - WHERE id = 1; \ No newline at end of file +UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1; + +UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5; \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 25fbbda70..91374a34e 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -349,5 +349,6 @@ "Este estado no existe": "Este estado no existe", "The line could not be marked": "No se ha podido marcar la línea", "No se ha podido marcar la línea": "No se ha podido marcar la línea", - "The sale can not be tracked": "La línea no puede ser rastreada" + "The sale can not be tracked": "La línea no puede ser rastreada", + "La línea no puede ser rastreada": "La línea no puede ser rastreada" } \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js index 353a39c49..d981aeea5 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js @@ -1,5 +1,5 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('saleTracking mark()', () => { +describe('saleTracking mark()', () => { const saleFk = 1; const originalQuantity = 10; const code = 'PREPARED'; diff --git a/modules/ticket/back/methods/sale/getFromSectorCollection.js b/modules/ticket/back/methods/sale/getFromSectorCollection.js index a56966887..c8925c3a9 100644 --- a/modules/ticket/back/methods/sale/getFromSectorCollection.js +++ b/modules/ticket/back/methods/sale/getFromSectorCollection.js @@ -25,36 +25,12 @@ module.exports = Self => { }); Self.getFromSectorCollection = async(ctx, sectorCollectionFk, sectorFk, options) => { - const myOptions = {}; const userId = ctx.req.accessToken.userId; + const myOptions = {userId}; if (typeof options == 'object') Object.assign(myOptions, options); - const sales = await Self.rawSql('CALL sectorCollection_getSale(?)', [sectorCollectionFk], myOptions); - - /* const sales = await Self.rawSql( - `SELECT s.ticketFk, - s.itemFk, - i.longName, - itemPackingTypeFk, - subName, - s.quantity, - w.code workerCode, - sgd.saleFk, - iss.quantity pickedQuantity, - c.salesPersonFk - FROM vn.sale s - JOIN item i ON i.id = s.itemFk - JOIN saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk - JOIN saleTracking st ON st.saleFk = s.id - JOIN state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION' - JOIN worker w ON w.id = st.workerFk - JOIN ticket t ON t.id= s.ticketFk - JOIN client c ON c.id=t.clientFk - LEFT JOIN itemShelvingSaleSum iss ON iss.saleFk = s.id - WHERE scsg.sectorCollectionFk = ? - AND st.workerFk = ?;`, [sectorCollectionFk, userId]); */ + const [sales] = await Self.rawSql('CALL sectorCollection_getSale(?)', [sectorCollectionFk], myOptions); const itemShelvings = []; for (let sale of sales) { diff --git a/modules/ticket/back/methods/sale/specs/getFromSectorCollection.spec.js b/modules/ticket/back/methods/sale/specs/getFromSectorCollection.spec.js new file mode 100644 index 000000000..1501426e4 --- /dev/null +++ b/modules/ticket/back/methods/sale/specs/getFromSectorCollection.spec.js @@ -0,0 +1,23 @@ +const {models} = require('vn-loopback/server/server'); + +describe('sale getFromSectorCollection()', () => { + const sectorCollectionFk = 1; + const sectorFk = 1; + + beforeAll(async() => { + ctx = { + req: { + headers: {origin: 'http://localhost'}, + accessToken: {userId: 40} + } + }; + }); + + it('should find an item and a shelving', async() => { + const options = {}; + const itemShelvings = await models.Sale.getFromSectorCollection(ctx, sectorCollectionFk, sectorFk, options); + + expect(itemShelvings.length).toEqual(1); + expect(itemShelvings[0].carros.length).toEqual(1); + }); +}); From 799237e14caaea96ba135910651e6e5f2cffc4c7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 23 Jan 2024 09:09:55 +0100 Subject: [PATCH 098/250] feat: refs #6276 test shelving_addLog --- loopback/locale/en.json | 4 +- loopback/locale/es.json | 3 +- .../shelving/back/methods/shelving/addLog.js | 3 +- .../methods/shelving/specs/addLog.spec.js | 46 +++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 modules/shelving/back/methods/shelving/specs/addLog.spec.js diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 24c28a927..dc3a4afae 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -212,5 +212,7 @@ "This worker does not exist": "This worker does not exist", "this state does not exist": "This state does not exist", "The line could not be marked": "The line could not be marked", - "The sale can not be tracked": "The sale can not be tracked" + "The sale can not be tracked": "The sale can not be tracked", + "Shelving not valid": "Shelving not valid" + } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 91374a34e..32266e9ce 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -350,5 +350,6 @@ "The line could not be marked": "No se ha podido marcar la línea", "No se ha podido marcar la línea": "No se ha podido marcar la línea", "The sale can not be tracked": "La línea no puede ser rastreada", - "La línea no puede ser rastreada": "La línea no puede ser rastreada" + "Shelving not valid": "Carro no válido", + "Carro no válido": "Carro no válido" } \ No newline at end of file diff --git a/modules/shelving/back/methods/shelving/addLog.js b/modules/shelving/back/methods/shelving/addLog.js index 13f9075f1..fe6d8b8da 100644 --- a/modules/shelving/back/methods/shelving/addLog.js +++ b/modules/shelving/back/methods/shelving/addLog.js @@ -16,6 +16,7 @@ module.exports = Self => { }); Self.addLog = async(ctx, code, options) => { const userId = ctx.req.accessToken.userId; + const $t = ctx.req.__; const models = Self.app.models; const myOptions = {}; let tx; @@ -35,7 +36,7 @@ module.exports = Self => { } }, myOptions); - if (!shelving) throw new UserError('Shelving not valid'); + if (!shelving) throw new UserError($t('Shelving not valid')); await models.ShelvingLog.create({ changedModel: 'Shelving', diff --git a/modules/shelving/back/methods/shelving/specs/addLog.spec.js b/modules/shelving/back/methods/shelving/specs/addLog.spec.js new file mode 100644 index 000000000..d538c24ec --- /dev/null +++ b/modules/shelving/back/methods/shelving/specs/addLog.spec.js @@ -0,0 +1,46 @@ +const {models} = require('vn-loopback/server/server'); + +describe('shelving addLog()', () => { + beforeAll(async() => { + ctx = { + req: { + headers: {origin: 'http://localhost'}, + accessToken: {userId: 66}, + __: value => value + } + }; + }); + + it('should add a log', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + const code = 'AA6'; + + try { + const shelvingLogsBefore = await models.ShelvingLog.find(null, options); + await models.Shelving.addLog(ctx, code, options); + const shelvingLogsAfter = await models.ShelvingLog.find(null, options); + + expect(shelvingLogsAfter.length).toEqual(shelvingLogsBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should throw an error when the code does not exist', async() => { + const tx = await models.SaleTracking.beginTransaction({}); + const options = {transaction: tx}; + const code = 'DXI345'; + + try { + await models.Shelving.addLog(ctx, code, options); + + await tx.rollback(); + } catch (e) { + expect(e.message).toEqual('Shelving not valid'); + await tx.rollback(); + } + }); +}); From 08dd37e9e44fc1824bb3c383c38fd90746da55ff Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 23 Jan 2024 12:13:23 +0100 Subject: [PATCH 099/250] feat: refs #6276 test sectorCollection_getSales --- .../getSalesFromTicketOrCollection.js | 66 ++++++++++--------- .../getSalesFromTicketOrCollection.spec.js | 35 ++++++++++ db/dump/fixtures.sql | 4 +- loopback/locale/es.json | 3 +- 4 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSalesFromTicketOrCollection.js index d806782d9..68de62bd8 100644 --- a/back/methods/collection/getSalesFromTicketOrCollection.js +++ b/back/methods/collection/getSalesFromTicketOrCollection.js @@ -7,18 +7,11 @@ module.exports = Self => { arg: 'collectionOrTicketFk', type: 'number', required: true - }, - { - arg: 'sectorFk', - type: 'number', + }, { + arg: 'print', + type: 'boolean', required: true - }, - { - arg: 'printFk', - type: 'number', - required: true - }, - { + }, { arg: 'source', type: 'string', required: true @@ -35,36 +28,34 @@ module.exports = Self => { }, }); - Self.getSalesFromTicketOrCollection = async(ctx, collectionOrTicketFk, sectorFk, printFk, source, options) => { + Self.getSalesFromTicketOrCollection = async(ctx, collectionOrTicketFk, print, source, options) => { + const userId = ctx.req.accessToken.userId; const models = Self.app.models; - const myOptions = {}; + const myOptions = {userId}; if (typeof options == 'object') Object.assign(myOptions, options); - const [collectionOrTicket] = await Self.rawSql('SELECT vn.ticket_get(?) as id', [collectionOrTicketFk]); + const [{id}] = await Self.rawSql('SELECT vn.ticket_get(?) as id', + [collectionOrTicketFk], + myOptions); - const [tickets] = await Self.rawSql('CALL vn.collection_getTickets(?)', [collectionOrTicket.id]); + const [tickets] = await Self.rawSql('CALL vn.collection_getTickets(?)', [id], myOptions); - if (source == 'PRECHECKER' || source == 'ON_CHECKING') { - await Self.rawSql( - 'CALL vn.ticketStateToday_setState(?,?)', - [collectionOrTicket.id, source] - ); - } - - const [sales] = await Self.rawSql('CALL vn.sale_getFromTicketOrCollection(?)', [collectionOrTicket.id]); + await setState(source, id, myOptions); + const [sales] = await Self.rawSql('CALL vn.sale_getFromTicketOrCollection(?)', + [id], myOptions); const isPicker = source == 'CHECKER'; - const [placements] = await Self.rawSql( - 'CALL vn.collectionPlacement_get(?, ?)', [collectionOrTicket.id, isPicker] + const [placements] = await Self.rawSql('CALL vn.collectionPlacement_get(?, ?)', + [id, isPicker], myOptions ); - if (printFk == 1) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [collectionOrTicket.id]); + if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions); if (tickets.length) await sendRocketTickets(tickets); - return getCollection(collectionOrTicket.id, tickets, sales, placements); + return getCollection(id, tickets, sales, placements, myOptions); async function sendRocketTickets(tickets) { for (let ticket of tickets) { @@ -83,7 +74,7 @@ module.exports = Self => { } } - async function getCollection(id, tickets, sales, placements) { + async function getCollection(id, tickets, sales, placements, options) { const collection = { collectionFk: id, tickets: [], @@ -95,7 +86,8 @@ module.exports = Self => { const barcodes = await getBarcodes(ticketFk); await Self.rawSql( 'CALL util.log_add(?, ?, ?, ?, ?, ?, ?, ?)', - ['vn', 'ticket', 'Ticket', ticketFk, ticketFk, 'select', null, null] + ['vn', 'ticket', 'Ticket', ticketFk, ticketFk, 'select', null, null], + options ); for (let sale of sales) { @@ -106,7 +98,7 @@ module.exports = Self => { sale.barcodes = []; for (const barcode of barcodes) { - if (barcode.movementId) { + if (barcode.movementId == sale.saleFk) { if (barcode.code) { sale.barcodes.push(barcode.code); sale.barcodes.push(`0 ${barcode.code}`); @@ -142,5 +134,19 @@ module.exports = Self => { AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`; return Self.rawSql(query, [ticketId]); } + + async function setState(source, id, options) { + let state; + if (source == 'PRECHECKER') state = 'PREVIOUS_CONTROL'; + else if (source == 'CHECKER') state = 'ON_CHECKING'; + + if (state) { + await Self.rawSql( + 'CALL vn.ticketStateToday_setState(?,?)', + [id, source], + options + ); + } + } }; }; diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js new file mode 100644 index 000000000..8937b99e0 --- /dev/null +++ b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js @@ -0,0 +1,35 @@ +const {models} = require('vn-loopback/server/server'); + +fdescribe('collection getSalesFromTicketOrCollection()', () => { + const collectionOrTicketFk = 999999; + const print = true; + const source = 'CHECKER'; + + beforeAll(() => { + ctx = { + req: { + accessToken: {userId: 9}, + headers: {origin: 'http://localhost'}, + } + }; + }); + + it('should return a collection with tickets, placements and barcodes settled correctly', async() => { + const options = {}; + const collection = await models.Collection.getSalesFromTicketOrCollection(ctx, + collectionOrTicketFk, print, source, options); + + const [firstTicket] = collection.tickets; + const [firstSale] = firstTicket.sales; + const [firstPlacement] = firstSale.placements; + + expect(collection.tickets.length).toBeGreaterThan(0); + expect(collection.collectionFk).toEqual(firstTicket.ticketFk); + + expect(firstSale.ticketFk).toEqual(firstTicket.ticketFk); + expect(firstSale.placements.length).toBeGreaterThan(0); + expect(firstSale.barcodes.length).toBeGreaterThan(0); + + expect(firstSale.saleFk).toEqual(firstPlacement.saleFk); + }); +}); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index e536e694d..0485f9eec 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3711,4 +3711,6 @@ INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01- UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1; -UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5; \ No newline at end of file +UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5; + +INSERT INTO vn.report (name) VALUES ('LabelCollection') \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 32266e9ce..222df46d6 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -351,5 +351,6 @@ "No se ha podido marcar la línea": "No se ha podido marcar la línea", "The sale can not be tracked": "La línea no puede ser rastreada", "Shelving not valid": "Carro no válido", - "Carro no válido": "Carro no válido" + "Carro no válido": "Carro no válido", + "printerNotExists": "printerNotExists" } \ No newline at end of file From ae89d59bde5d8e3c11c4d38bf9cec41094e642fc Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 23 Jan 2024 15:58:09 +0100 Subject: [PATCH 100/250] feat: refs #6276 WIP test sectorCollection_getSales --- .../getSalesFromTicketOrCollection.spec.js | 50 ++++++++++++++----- db/dump/fixtures.sql | 2 +- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js index 8937b99e0..6417fca93 100644 --- a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js +++ b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('collection getSalesFromTicketOrCollection()', () => { +describe('collection getSalesFromTicketOrCollection()', () => { const collectionOrTicketFk = 999999; const print = true; const source = 'CHECKER'; @@ -15,21 +15,45 @@ fdescribe('collection getSalesFromTicketOrCollection()', () => { }); it('should return a collection with tickets, placements and barcodes settled correctly', async() => { - const options = {}; - const collection = await models.Collection.getSalesFromTicketOrCollection(ctx, - collectionOrTicketFk, print, source, options); + const tx = await models.Collection.beginTransaction({}); + const options = {transaction: tx}; + try { + const collection = await models.Collection.getSalesFromTicketOrCollection(ctx, + collectionOrTicketFk, print, source, options); - const [firstTicket] = collection.tickets; - const [firstSale] = firstTicket.sales; - const [firstPlacement] = firstSale.placements; + const [firstTicket] = collection.tickets; + const [firstSale] = firstTicket.sales; + const [firstPlacement] = firstSale.placements; - expect(collection.tickets.length).toBeGreaterThan(0); - expect(collection.collectionFk).toEqual(firstTicket.ticketFk); + expect(collection.tickets.length).toBeTruthy(); + expect(collection.collectionFk).toEqual(firstTicket.ticketFk); - expect(firstSale.ticketFk).toEqual(firstTicket.ticketFk); - expect(firstSale.placements.length).toBeGreaterThan(0); - expect(firstSale.barcodes.length).toBeGreaterThan(0); + expect(firstSale.ticketFk).toEqual(firstTicket.ticketFk); + expect(firstSale.placements.length).toBeTruthy(); + expect(firstSale.barcodes.length).toBeTruthy(); - expect(firstSale.saleFk).toEqual(firstPlacement.saleFk); + expect(firstSale.saleFk).toEqual(firstPlacement.saleFk); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should print a sticker', async() => { + const tx = await models.Collection.beginTransaction({}); + const options = {transaction: tx}; + try { + const printQueueBefore = await models.Collection.rawSql('SELECT * FROM printQueue', [], options); + await models.Collection.getSalesFromTicketOrCollection(ctx, + collectionOrTicketFk, print, source, options); + const printQueueAfter = await models.Collection.rawSql('SELECT * FROM printQueue', [], options); + + expect(printQueueAfter.length).toEqual(printQueueBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } }); }); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0485f9eec..2cdc6fbe0 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -3713,4 +3713,4 @@ UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1; UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5; -INSERT INTO vn.report (name) VALUES ('LabelCollection') \ No newline at end of file +INSERT INTO vn.report (name) VALUES ('LabelCollection'); \ No newline at end of file From 065dd0581d51609157b1ce94c2743a33593413ba Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 24 Jan 2024 09:06:05 +0100 Subject: [PATCH 101/250] feat(spec): refs #6403 add test --- back/methods/mrw-config/createShipment.ejs | 1 + back/methods/mrw-config/createShipment.js | 11 +++++------ db/changes/240401/00-mrwWebService.sql | 12 ++++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/back/methods/mrw-config/createShipment.ejs b/back/methods/mrw-config/createShipment.ejs index e84cfce39..bf8a07dab 100644 --- a/back/methods/mrw-config/createShipment.ejs +++ b/back/methods/mrw-config/createShipment.ejs @@ -32,6 +32,7 @@ <%= expeditionData.expeditionDataId %> <%= expeditionData.serviceType %> 1 + <%= expeditionData.weekDays %> <%= expeditionData.kg %> diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index 0ed4ccf65..f6f57e06f 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -40,15 +40,14 @@ module.exports = Self => { c.phone, DATE_FORMAT(e.created, '%d/%m/%Y') created, e.id expeditionId, - LPAD(ms.serviceType, 4 ,'0') serviceType, - pa.height, - pa.depth, - pa.width + LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, + IFNULL(mw.weekdays, "N") weekDays FROM expedition e JOIN packaging pa ON pa.id = e.packagingFk JOIN ticket t ON e.ticketFk = t.id JOIN agencyMode am ON am.id = t.agencyModeFk JOIN mrwService ms ON ms.agencyModeCodeFk = am.code + LEFT JOIN mrwServiceWeekday mw ON mw.params = DATE_FORMAT(e.created, '%a') JOIN client c ON t.clientFk = c.id JOIN address a ON t.addressFk = a.id JOIN province p ON a.provinceFk = p.id @@ -74,8 +73,8 @@ module.exports = Self => { 'Content-Type': 'text/xml; charset=utf-8' } }); - const getLableXmlDoc = parser.parseFromString(getLabelResponse.data, 'text/xml'); - const base64Binary = getLableXmlDoc.getElementsByTagName('EtiquetaFile')[0]?.textContent; + const getLabelXmlDoc = parser.parseFromString(getLabelResponse.data, 'text/xml'); + const base64Binary = getLabelXmlDoc.getElementsByTagName('EtiquetaFile')[0]?.textContent; const expedition = await models.Expedition.findById(expeditionFk); await expedition.updateAttribute('externalId', shipmentId); diff --git a/db/changes/240401/00-mrwWebService.sql b/db/changes/240401/00-mrwWebService.sql index 9c85cbf49..eb6aab887 100644 --- a/db/changes/240401/00-mrwWebService.sql +++ b/db/changes/240401/00-mrwWebService.sql @@ -13,6 +13,8 @@ COLLATE=utf8mb3_unicode_ci; ALTER TABLE `vn`.`packingSite` ADD `hasNewLabelMrwMethod` BOOL NULL; +INSERT INTO vn.mrwService (agencyModeCodeFk, clientType, serviceType, kg) VALUES('mrw', 9731, 205, 10); + INSERT INTO `vn`.`mrwConfig` (`url`, `user`, `password`, `franchiseCode`, `subscriberCode`) VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '04301', '009731'); @@ -27,12 +29,14 @@ INSERT INTO `vn`.`agency` (`name`,`warehouseFk`,`warehouseAliasFk`,`isOwn`,`isAn VALUES ('MRW',1,1,0,0); INSERT INTO `vn`.`agencyMode` (`id`, `name`, `description`, `deliveryMethodFk`, `m3`, `web`, `agencyFk`, `inflation`, `isVolumetric`, `reportMail`, `showAgencyName`, `isActive`, `isExternalAgency`, `flag`, `code`, `isRiskFree`, `hasWeightVolumetric`) - VALUES(25, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0); + VALUES(25, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0), + (26, 'mrwEcom', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'mrwEcom', 0, 0); INSERT INTO `vn`.`ticket` (`id`, `clientFk`, `warehouseFk`, `shipped`, `nickname`, `refFk`, `addressFk`, `workerFk`, `observations`, `isSigned`, `isLabeled`, `isPrinted`, `packages`, `location`, `hour`, `created`, `isBlocked`, `solution`, `routeFk`, `priority`, `hasPriority`, `companyFk`, `agencyModeFk`, `landed`, `isBoxed`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `totalWithVat`, `totalWithoutVat`, `weight`, `clonedFrom`, `cmrFk`, `editorFk`) - VALUES + VALUES(44, 1101, 1, '2001-01-01 00:00:00.000', 'MRW', NULL, 1, NULL, NULL, 0, 0, 0, 1, NULL, 0, '2001-01-01 00:00:00.000', 1, NULL, 6, NULL, 1, 442, 25, '2001-01-02', 0, 0, 3, 5.00, 1.00, 8.88, 8.07, NULL, NULL, NULL, 100); INSERT INTO vn.expedition (agencyModeFk,ticketFk,freightItemFk,created,counter,workerFk,packagingFk,hostFk,stateTypeFk,hasNewRoute,isBox,editorFk) - VALUES (25,33,71,'2001-01-01 01:00:00.000',1,18,'94','',3,0,71,100); + VALUES (25,44,71, CURDATE(),1,18,'94','',3,0,71,100); -INSERT INTO vn.mrwService (agencyModeCodeFk, clientType, serviceType, kg) VALUES('MRW', 9731, 205, 10); \ No newline at end of file +INSERT INTO vn.mrwService (agencyModeCodeFk, clientType, serviceType, kg) VALUES('MRW', 9731, 205, 10); +INSERT INTO vn.mrwServiceWeekday (agencyModeCodeFk, weekdays, serviceType, params) VALUES('mrwEcom', 'sat', 800, 'EntregaSabado=S'); \ No newline at end of file From e849f0b6e2000896aa8782a2add236cba7cdad06 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 24 Jan 2024 11:20:08 +0100 Subject: [PATCH 102/250] fix: refs #6276 sectorCollection_getSales --- .../getSalesFromTicketOrCollection.js | 28 ++++++++++++++++--- .../getSalesFromTicketOrCollection.spec.js | 19 +++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSalesFromTicketOrCollection.js index 68de62bd8..50fe21875 100644 --- a/back/methods/collection/getSalesFromTicketOrCollection.js +++ b/back/methods/collection/getSalesFromTicketOrCollection.js @@ -92,9 +92,29 @@ module.exports = Self => { for (let sale of sales) { if (sale.ticketFk == ticketFk) { - sale.placements = placements.filter(placement => - placement.saleFk == sale.saleFk && placement.order - ); + sale.placements = []; + for (const salePlacement of placements) { + let placement; + if (salePlacement.saleFk == sale.saleFk && salePlacement.order) { + placement = { + saleFk: salePlacement.saleFk, + itemFk: salePlacement.itemFk, + placement: salePlacement.placement, + shelving: salePlacement.shelving, + created: salePlacement.created, + visible: salePlacement.visible, + order: salePlacement.order, + grouping: salePlacement.grouping, + priority: salePlacement.priority, + saleOrder: salePlacement.saleOrder, + isPreviousPrepared: salePlacement.isPreviousPrepared, + itemShelvingSaleFk: salePlacement.itemShelvingSaleFk, + ticketFk: salePlacement.ticketFk, + id: salePlacement.id + }; + sale.placements.push(placement); + } + } sale.barcodes = []; for (const barcode of barcodes) { @@ -143,7 +163,7 @@ module.exports = Self => { if (state) { await Self.rawSql( 'CALL vn.ticketStateToday_setState(?,?)', - [id, source], + [id, state], options ); } diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js index 6417fca93..02532b4b0 100644 --- a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js +++ b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js @@ -56,4 +56,23 @@ describe('collection getSalesFromTicketOrCollection()', () => { throw e; } }); + + it('should add a ticketTracking', async() => { + const collectionOrTicketFk = 23; + + const tx = await models.Collection.beginTransaction({}); + const options = {transaction: tx}; + try { + const ticketTrackingBefore = await models.TicketTracking.find(null, options); + await models.Collection.getSalesFromTicketOrCollection(ctx, + collectionOrTicketFk, print, source, options); + const ticketTrackingAfter = await models.TicketTracking.find(null, options); + + expect(ticketTrackingAfter.length).toEqual(ticketTrackingBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); From e527780622444504516b9724baa168beab345a98 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 24 Jan 2024 11:24:49 +0100 Subject: [PATCH 103/250] fix: refs #6276 drop suitcase sectorCollection_getSales --- .../getSalesFromTicketOrCollection.spec.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js index 02532b4b0..6417fca93 100644 --- a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js +++ b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js @@ -56,23 +56,4 @@ describe('collection getSalesFromTicketOrCollection()', () => { throw e; } }); - - it('should add a ticketTracking', async() => { - const collectionOrTicketFk = 23; - - const tx = await models.Collection.beginTransaction({}); - const options = {transaction: tx}; - try { - const ticketTrackingBefore = await models.TicketTracking.find(null, options); - await models.Collection.getSalesFromTicketOrCollection(ctx, - collectionOrTicketFk, print, source, options); - const ticketTrackingAfter = await models.TicketTracking.find(null, options); - - expect(ticketTrackingAfter.length).toEqual(ticketTrackingBefore.length + 1); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); }); From 02e38eb71182aa80650c307708dea732b9f8365a Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 25 Jan 2024 08:13:47 +0100 Subject: [PATCH 104/250] fix: refs #6276 fix tests --- back/methods/collection/addItem.js | 2 +- .../getSalesFromTicketOrCollection.js | 183 +++++++++--------- .../getSalesFromTicketOrCollection.spec.js | 29 ++- .../back/methods/item-shelving/makeMulti.js | 9 +- .../item/back/methods/item-shelving/return.js | 4 +- .../methods/sale-tracking/updateTracking.js | 2 +- 6 files changed, 124 insertions(+), 105 deletions(-) diff --git a/back/methods/collection/addItem.js b/back/methods/collection/addItem.js index 3b2a6921b..1317662b4 100644 --- a/back/methods/collection/addItem.js +++ b/back/methods/collection/addItem.js @@ -46,7 +46,7 @@ module.exports = Self => { } try { - const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk]); + const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk], myOptions); if (!item?.available) throw new UserError($t('We do not have availability for the selected item')); diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSalesFromTicketOrCollection.js index 50fe21875..8fbc0f55b 100644 --- a/back/methods/collection/getSalesFromTicketOrCollection.js +++ b/back/methods/collection/getSalesFromTicketOrCollection.js @@ -56,92 +56,92 @@ module.exports = Self => { if (tickets.length) await sendRocketTickets(tickets); return getCollection(id, tickets, sales, placements, myOptions); + }; + async function sendRocketTickets(tickets) { + for (let ticket of tickets) { + let observations = ticket.observaciones.split(' '); - async function sendRocketTickets(tickets) { - for (let ticket of tickets) { - let observations = ticket.observaciones.split(' '); + for (let observation of observations) { + const salesMan = ticket.salesPersonFk; - for (let observation of observations) { - const salesMan = ticket.salesPersonFk; + if (!observation.startsWith('#') && !observation.startsWith('@')) return; - if (!observation.startsWith('#') && !observation.startsWith('@')) return; - - await models.Chat.send(ctx, - observation, - `El ticket ${ticket.ticketFk} del comercial ${salesMan} está en preparación.(mensaje creado automáticamente)` - ); - } - } - } - - async function getCollection(id, tickets, sales, placements, options) { - const collection = { - collectionFk: id, - tickets: [], - }; - for (let ticket of tickets) { - const {ticketFk} = ticket; - ticket.sales = []; - - const barcodes = await getBarcodes(ticketFk); - await Self.rawSql( - 'CALL util.log_add(?, ?, ?, ?, ?, ?, ?, ?)', - ['vn', 'ticket', 'Ticket', ticketFk, ticketFk, 'select', null, null], - options + await models.Chat.send(ctx, + observation, + `El ticket ${ticket.ticketFk} del comercial ${salesMan} está en preparación.(mensaje creado automáticamente)` ); - - for (let sale of sales) { - if (sale.ticketFk == ticketFk) { - sale.placements = []; - for (const salePlacement of placements) { - let placement; - if (salePlacement.saleFk == sale.saleFk && salePlacement.order) { - placement = { - saleFk: salePlacement.saleFk, - itemFk: salePlacement.itemFk, - placement: salePlacement.placement, - shelving: salePlacement.shelving, - created: salePlacement.created, - visible: salePlacement.visible, - order: salePlacement.order, - grouping: salePlacement.grouping, - priority: salePlacement.priority, - saleOrder: salePlacement.saleOrder, - isPreviousPrepared: salePlacement.isPreviousPrepared, - itemShelvingSaleFk: salePlacement.itemShelvingSaleFk, - ticketFk: salePlacement.ticketFk, - id: salePlacement.id - }; - sale.placements.push(placement); - } - } - - sale.barcodes = []; - for (const barcode of barcodes) { - if (barcode.movementId == sale.saleFk) { - if (barcode.code) { - sale.barcodes.push(barcode.code); - sale.barcodes.push(`0 ${barcode.code}`); - } - - if (barcode.id) { - sale.barcodes.push(barcode.id); - sale.barcodes.push(`0 ${barcode.id}`); - } - } - } - - ticket.sales.push(sale); - } - } - collection.tickets.push(ticket); } + } + } - return collection; + async function getCollection(id, tickets, sales, placements, options) { + const collection = { + collectionFk: id, + tickets: [], + }; + for (let ticket of tickets) { + const {ticketFk} = ticket; + ticket.sales = []; + + const barcodes = await getBarcodes(ticketFk); + await Self.rawSql( + 'CALL util.log_add(?, ?, ?, ?, ?, ?, ?, ?)', + ['vn', 'ticket', 'Ticket', ticketFk, ticketFk, 'select', null, null], + options + ); + + for (let sale of sales) { + if (sale.ticketFk == ticketFk) { + sale.placements = []; + for (const salePlacement of placements) { + let placement; + if (salePlacement.saleFk == sale.saleFk && salePlacement.order) { + placement = { + saleFk: salePlacement.saleFk, + itemFk: salePlacement.itemFk, + placement: salePlacement.placement, + shelving: salePlacement.shelving, + created: salePlacement.created, + visible: salePlacement.visible, + order: salePlacement.order, + grouping: salePlacement.grouping, + priority: salePlacement.priority, + saleOrder: salePlacement.saleOrder, + isPreviousPrepared: salePlacement.isPreviousPrepared, + itemShelvingSaleFk: salePlacement.itemShelvingSaleFk, + ticketFk: salePlacement.ticketFk, + id: salePlacement.id + }; + sale.placements.push(placement); + } + } + + sale.barcodes = []; + for (const barcode of barcodes) { + if (barcode.movementId == sale.saleFk) { + if (barcode.code) { + sale.barcodes.push(barcode.code); + sale.barcodes.push(`0 ${barcode.code}`); + } + + if (barcode.id) { + sale.barcodes.push(barcode.id); + sale.barcodes.push(`0 ${barcode.id}`); + } + } + } + + ticket.sales.push(sale); + } + } + collection.tickets.push(ticket); } - async function getBarcodes(ticketId) { - const query = + return collection; + } + + async function getBarcodes(ticketId) { + const query = `SELECT s.id movementId, b.code, c.id @@ -152,21 +152,20 @@ module.exports = Self => { LEFT JOIN vn.travel tr ON tr.id = e.travelFk WHERE s.ticketFk = ? AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`; - return Self.rawSql(query, [ticketId]); - } + return Self.rawSql(query, [ticketId]); + } - async function setState(source, id, options) { - let state; - if (source == 'PRECHECKER') state = 'PREVIOUS_CONTROL'; - else if (source == 'CHECKER') state = 'ON_CHECKING'; + async function setState(source, id, options) { + let state; + if (source == 'PRECHECKER') state = 'PREVIOUS_CONTROL'; + else if (source == 'CHECKER') state = 'ON_CHECKING'; - if (state) { - await Self.rawSql( - 'CALL vn.ticketStateToday_setState(?,?)', - [id, state], - options - ); - } + if (state) { + await Self.rawSql( + 'CALL vn.ticketStateToday_setState(?,?)', + [id, state], + options + ); } - }; + } }; diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js index 6417fca93..8f2ea4408 100644 --- a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js +++ b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js @@ -43,11 +43,14 @@ describe('collection getSalesFromTicketOrCollection()', () => { it('should print a sticker', async() => { const tx = await models.Collection.beginTransaction({}); const options = {transaction: tx}; + const query = 'SELECT * FROM printQueue pq JOIN printQueueArgs pqa ON pqa.printQueueFk = pq.id'; try { - const printQueueBefore = await models.Collection.rawSql('SELECT * FROM printQueue', [], options); + const printQueueBefore = await models.Collection.rawSql( + query, [], options); await models.Collection.getSalesFromTicketOrCollection(ctx, - collectionOrTicketFk, print, source, options); - const printQueueAfter = await models.Collection.rawSql('SELECT * FROM printQueue', [], options); + collectionOrTicketFk, true, source, options); + const printQueueAfter = await models.Collection.rawSql( + query, [], options); expect(printQueueAfter.length).toEqual(printQueueBefore.length + 1); await tx.rollback(); @@ -56,4 +59,24 @@ describe('collection getSalesFromTicketOrCollection()', () => { throw e; } }); + + it('should getSalesFromTicketOrCollection', async() => { + const tx = await models.Collection.beginTransaction({}); + + try { + const options = {transaction: tx}; + await models.Ticket.updateAll({id: collectionOrTicketFk}, {shipped: '2001-01-02 00:00:00.000'}, options); + + const ticketTrackingBefore = await models.TicketTracking.find(null, options); + await models.Collection.getSalesFromTicketOrCollection(ctx, + collectionOrTicketFk, false, source, options); + const ticketTrackingAfter = await models.TicketTracking.find(null, options); + + expect(ticketTrackingAfter.length).toEqual(ticketTrackingBefore.length + 1); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); diff --git a/modules/item/back/methods/item-shelving/makeMulti.js b/modules/item/back/methods/item-shelving/makeMulti.js index 7d1ee11a0..e3a3b1cf5 100644 --- a/modules/item/back/methods/item-shelving/makeMulti.js +++ b/modules/item/back/methods/item-shelving/makeMulti.js @@ -47,7 +47,8 @@ module.exports = Self => { }, 0); discardItems.push(item); - const [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?) itemPacking', [item, warehouseFk]); + const [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?) itemPacking', + [item, warehouseFk], myOptions); let packing; if (result) packing = result.itemPacking; @@ -56,11 +57,7 @@ module.exports = Self => { quantity = quantity * packing; await Self.rawSql('CALL vn.itemShelving_add(?, ?, ?, NULL, NULL, ?, ?)', - [shelvingFk, - item, - quantity, - packing, - warehouseFk] + [shelvingFk, item, quantity, packing, warehouseFk], myOptions ); } } diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index aa44ef5b5..8e8b4eae2 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -39,8 +39,8 @@ module.exports = Self => { }; let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions); - const [alternatives] = await models.ItemShelving.rawSql( - 'CALL vn.itemShelving_getAlternatives(?)', [shelvingFk] + const [alternatives] = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', + [shelvingFk], myOptions ); if (itemShelvings) { diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 81eef28b4..22ff141d8 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -96,7 +96,7 @@ module.exports = Self => { neq: null } } - }); + }, myOptions); } if (isBuy) await models.SaleBuy.create({saleFk, buyFk}, myOptions); From 63fb3db8a1665045b96a964b7e94d4e7db8af3a7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 25 Jan 2024 12:14:14 +0100 Subject: [PATCH 105/250] fix: refs #6276 test item_card & general fixes --- back/methods/collection/assignCollection.js | 13 +++++++++---- .../collection/getSalesFromTicketOrCollection.js | 16 +++++++--------- loopback/locale/en.json | 6 ++++-- loopback/locale/es.json | 4 +++- modules/item/back/methods/item/card.js | 9 ++------- .../item/back/methods/item/specs/card.spec.js | 4 ++-- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/back/methods/collection/assignCollection.js b/back/methods/collection/assignCollection.js index 3384b325a..c4671e747 100644 --- a/back/methods/collection/assignCollection.js +++ b/back/methods/collection/assignCollection.js @@ -13,16 +13,21 @@ module.exports = Self => { }, }); - Self.assignCollection = async ctx => { + Self.assignCollection = async(ctx, options) => { const userId = ctx.req.accessToken.userId; + const myOptions = {userId}; + const $t = ctx.req.__; - await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk)', [userId]); + if (typeof options == 'object') + Object.assign(myOptions, options); + + await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk)', [userId], myOptions); const [assignedCollection] = await Self.rawSql('SELECT @vCollectionFk'); const {'@vCollectionFk': collectionFk} = assignedCollection; - if (!collectionFk) throw new UserError('No hay tickets para sacar'); - await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk]); + if (!collectionFk) throw new UserError($t('There are not picking tickets')); + await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions); return collectionFk; }; diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSalesFromTicketOrCollection.js index 8fbc0f55b..09ccbafdc 100644 --- a/back/methods/collection/getSalesFromTicketOrCollection.js +++ b/back/methods/collection/getSalesFromTicketOrCollection.js @@ -30,8 +30,8 @@ module.exports = Self => { Self.getSalesFromTicketOrCollection = async(ctx, collectionOrTicketFk, print, source, options) => { const userId = ctx.req.accessToken.userId; - const models = Self.app.models; const myOptions = {userId}; + const $t = ctx.req.__; if (typeof options == 'object') Object.assign(myOptions, options); @@ -53,22 +53,20 @@ module.exports = Self => { if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions); - if (tickets.length) await sendRocketTickets(tickets); + if (tickets.length) await sendRocketTickets(tickets, $t); return getCollection(id, tickets, sales, placements, myOptions); }; - async function sendRocketTickets(tickets) { + async function sendRocketTickets(tickets, $t) { for (let ticket of tickets) { let observations = ticket.observaciones.split(' '); for (let observation of observations) { const salesMan = ticket.salesPersonFk; - if (!observation.startsWith('#') && !observation.startsWith('@')) return; - await models.Chat.send(ctx, observation, - `El ticket ${ticket.ticketFk} del comercial ${salesMan} está en preparación.(mensaje creado automáticamente)` + $t('ticketCommercial', {ticket: ticket.ticketFk, salesMan}) ); } } @@ -83,7 +81,7 @@ module.exports = Self => { const {ticketFk} = ticket; ticket.sales = []; - const barcodes = await getBarcodes(ticketFk); + const barcodes = await getBarcodes(ticketFk, options); await Self.rawSql( 'CALL util.log_add(?, ?, ?, ?, ?, ?, ?, ?)', ['vn', 'ticket', 'Ticket', ticketFk, ticketFk, 'select', null, null], @@ -140,7 +138,7 @@ module.exports = Self => { return collection; } - async function getBarcodes(ticketId) { + async function getBarcodes(ticketId, options) { const query = `SELECT s.id movementId, b.code, @@ -152,7 +150,7 @@ module.exports = Self => { LEFT JOIN vn.travel tr ON tr.id = e.travelFk WHERE s.ticketFk = ? AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`; - return Self.rawSql(query, [ticketId]); + return Self.rawSql(query, [ticketId], options); } async function setState(source, id, options) { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index dc3a4afae..5ff31a22f 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -213,6 +213,8 @@ "this state does not exist": "This state does not exist", "The line could not be marked": "The line could not be marked", "The sale can not be tracked": "The sale can not be tracked", - "Shelving not valid": "Shelving not valid" - + "Shelving not valid": "Shelving not valid", + "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)" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 222df46d6..a1d1360a8 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -352,5 +352,7 @@ "The sale can not be tracked": "La línea no puede ser rastreada", "Shelving not valid": "Carro no válido", "Carro no válido": "Carro no válido", - "printerNotExists": "printerNotExists" + "printerNotExists": "No existe la impresora", + "There are not picking tickets": "No hay tickets para sacar", + "ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)" } \ No newline at end of file diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js index 45c2ac36c..bc59c8bff 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/card.js @@ -27,7 +27,7 @@ module.exports = Self => { Self.card = async(itemFk, warehouseFk) => { const models = Self.app.models; - const [result] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]); + const [[itemInfo]] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]); const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk]); const [realIdItem] = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); @@ -40,12 +40,7 @@ module.exports = Self => { } }); - let itemInfo; - if (result.length) { - itemInfo = {...result[0]}; - itemInfo.barcodes = barcodes; - } - + if (itemInfo) itemInfo.barcodes = barcodes; return itemInfo; }; }; diff --git a/modules/item/back/methods/item/specs/card.spec.js b/modules/item/back/methods/item/specs/card.spec.js index 725a4269d..65004cfa5 100644 --- a/modules/item/back/methods/item/specs/card.spec.js +++ b/modules/item/back/methods/item/specs/card.spec.js @@ -3,10 +3,10 @@ const {models} = require('vn-loopback/server/server'); describe('item card()', () => { const itemFk = 1; const warehouseFk = 1; - it('WIP: should get something', async() => { + it('should get an item with several barcodes', async() => { const card = await models.Item.card(itemFk, warehouseFk); expect(card).toBeDefined(); - expect(card.barcodes); + expect(card.barcodes.length).toBeTruthy(); }); }); From 293bbd3da33ee96733fc5cc87e40076183293747 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 29 Jan 2024 09:31:12 +0100 Subject: [PATCH 106/250] fix: refs #6276 merge database --- .../10837-whiteOrchid/00-firstScript.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 db/versions/10837-whiteOrchid/00-firstScript.sql diff --git a/db/versions/10837-whiteOrchid/00-firstScript.sql b/db/versions/10837-whiteOrchid/00-firstScript.sql new file mode 100644 index 000000000..eef5faa80 --- /dev/null +++ b/db/versions/10837-whiteOrchid/00-firstScript.sql @@ -0,0 +1,18 @@ +-- Place your SQL code here +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) + VALUES + ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), + ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), + ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), + ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), + ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), + ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), + ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'), + ('Collection','addItem','WRITE','ALLOW','ROLE','employee'), + ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), + ('MobileAppVersionControl', '*', 'READ', 'ALLOW', 'ROLE', 'production'), + ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), + ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'employee'), + ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'); + \ No newline at end of file From f4dc596e97f40b0149c6e18a03f8c7012c34b743 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 29 Jan 2024 15:13:56 +0100 Subject: [PATCH 107/250] refs 5509 feat: add triggers, downloadFile --- .../vn/triggers/entryDms_afterDelete.sql | 12 ++++ .../vn/triggers/entryDms_beforeInsert.sql | 8 +++ .../vn/triggers/entryDms_beforeUpdate.sql | 8 +++ loopback/locale/es.json | 5 +- loopback/server/datasources.json | 14 +++++ .../back/methods/entry-dms/downloadFile.js | 59 +++++++++++++++++++ modules/entry/back/model-config.json | 3 + .../entry/back/models/entry-container.json | 10 ++++ 8 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 db/routines/vn/triggers/entryDms_afterDelete.sql create mode 100644 db/routines/vn/triggers/entryDms_beforeInsert.sql create mode 100644 db/routines/vn/triggers/entryDms_beforeUpdate.sql create mode 100644 modules/entry/back/methods/entry-dms/downloadFile.js create mode 100644 modules/entry/back/models/entry-container.json diff --git a/db/routines/vn/triggers/entryDms_afterDelete.sql b/db/routines/vn/triggers/entryDms_afterDelete.sql new file mode 100644 index 000000000..9ae8e7058 --- /dev/null +++ b/db/routines/vn/triggers/entryDms_afterDelete.sql @@ -0,0 +1,12 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete` + AFTER DELETE ON `entryDms` + FOR EACH ROW +BEGIN + INSERT INTO entryLog + SET `action` = 'delete', + `changedModel` = 'EntryDms', + `changedModelId` = OLD.entryFk, + `userFk` = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/entryDms_beforeInsert.sql b/db/routines/vn/triggers/entryDms_beforeInsert.sql new file mode 100644 index 000000000..4f9550f48 --- /dev/null +++ b/db/routines/vn/triggers/entryDms_beforeInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert` + BEFORE INSERT ON `entryDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/entryDms_beforeUpdate.sql b/db/routines/vn/triggers/entryDms_beforeUpdate.sql new file mode 100644 index 000000000..ecc047029 --- /dev/null +++ b/db/routines/vn/triggers/entryDms_beforeUpdate.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate` + BEFORE UPDATE ON `entryDms` + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 5555ef8b0..8ee683e62 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -72,7 +72,7 @@ "The secret can't be blank": "La contraseña no puede estar en blanco", "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", "This ticket can not be modified": "Este ticket no puede ser modificado", @@ -336,5 +336,6 @@ "Incorrect pin": "Pin incorrecto.", "You already have the mailAlias": "Ya tienes este alias de correo", "The alias cant be modified": "Este alias de correo no puede ser modificado", - "No tickets to invoice": "No hay tickets para facturar" + "No tickets to invoice": "No hay tickets para facturar", + "this warehouse has not dms": "El Almacén no acepta documentos" } diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index aadee048c..608479b4b 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -103,6 +103,20 @@ "video/mp4" ] }, + "entryStorage": { + "name": "entryStorage", + "connector": "loopback-component-storage", + "provider": "filesystem", + "root": "./storage/dms", + "maxFileSize": "31457280", + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg", + "image/webp", + "video/mp4" + ] + }, "accessStorage": { "name": "accessStorage", "connector": "loopback-component-storage", diff --git a/modules/entry/back/methods/entry-dms/downloadFile.js b/modules/entry/back/methods/entry-dms/downloadFile.js new file mode 100644 index 000000000..a4f10f9dc --- /dev/null +++ b/modules/entry/back/methods/entry-dms/downloadFile.js @@ -0,0 +1,59 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('downloadFile', { + description: 'Get the entry file', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, + { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, + { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/downloadFile`, + verb: 'GET' + } + }); + + Self.downloadFile = async function(ctx, id) { + const models = Self.app.models; + const EntryContainer = models.EntryContainer; + const dms = await models.Dms.findById(id); + const pathHash = EntryContainer.getHash(dms.id); + try { + await EntryContainer.getFile(pathHash, dms.file); + } catch (e) { + if (e.code != 'ENOENT') + throw e; + + const error = new UserError(`File doesn't exists`); + error.statusCode = 404; + + throw error; + } + + const stream = EntryContainer.downloadStream(pathHash, dms.file); + + return [stream, dms.contentType, `filename="${dms.file}"`]; + }; +}; diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index ca4472c8c..d6736052b 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -2,6 +2,9 @@ "Entry": { "dataSource": "vn" }, + "EntryContainer": { + "dataSource": "entryStorage" + }, "Buy": { "dataSource": "vn" }, diff --git a/modules/entry/back/models/entry-container.json b/modules/entry/back/models/entry-container.json new file mode 100644 index 000000000..a60c272fa --- /dev/null +++ b/modules/entry/back/models/entry-container.json @@ -0,0 +1,10 @@ +{ + "name": "EntryContainer", + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} From e17fc9141594161af61471846672654759b5c40a Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 30 Jan 2024 14:58:11 +0100 Subject: [PATCH 108/250] fix: refs #6276 fix acl, addSaleByCode & tests --- .vscode/settings.json | 3 +- back/models/collection.js | 1 - .../10832-purpleAralia/00-newWareHouse.sql | 24 +++---- loopback/locale/es.json | 3 - .../back/methods/item-shelving/makeMulti.js | 71 ------------------- .../item/back/methods/item-shelving/return.js | 7 +- .../item-shelving/specs/makeMulti.spec.js | 54 -------------- .../item-shelving/specs/return.spec.js | 11 +-- modules/item/back/models/item-shelving.js | 1 - .../back/methods/ticket/addSaleByCode.js | 27 +++---- .../ticket/specs/addSaleByCode.spec.js | 21 +----- modules/ticket/back/models/ticket.js | 1 + 12 files changed, 27 insertions(+), 197 deletions(-) delete mode 100644 modules/item/back/methods/item-shelving/makeMulti.js delete mode 100644 modules/item/back/methods/item-shelving/specs/makeMulti.spec.js rename back/methods/collection/addItem.js => modules/ticket/back/methods/ticket/addSaleByCode.js (57%) rename back/methods/collection/spec/addItem.spec.js => modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js (60%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 76b039f61..03479d27a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,5 @@ "salix", "fdescribe", "Loggable" - ], - "CodeGPT.apiKey": "CodeGPT Plus Beta" + ] } diff --git a/back/models/collection.js b/back/models/collection.js index 98a199fbd..93ab2731b 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -5,6 +5,5 @@ module.exports = Self => { require('../methods/collection/previousLabel')(Self); require('../methods/collection/getTickets')(Self); require('../methods/collection/assignCollection')(Self); - require('../methods/collection/addItem')(Self); require('../methods/collection/getSalesFromTicketOrCollection')(Self); }; diff --git a/db/versions/10832-purpleAralia/00-newWareHouse.sql b/db/versions/10832-purpleAralia/00-newWareHouse.sql index 1b1ec263f..4802a6c4a 100644 --- a/db/versions/10832-purpleAralia/00-newWareHouse.sql +++ b/db/versions/10832-purpleAralia/00-newWareHouse.sql @@ -1,18 +1,14 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES - ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), - ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), - ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), - ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), - ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), - ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'), - ('Collection','addItem','WRITE','ALLOW','ROLE','employee'), - ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), - ('MobileAppVersionControl', '*', 'READ', 'ALLOW', 'ROLE', 'production'), ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), - ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'), - ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'); + ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'production'), + ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'), + ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'), + ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','production'), + ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'), + ('SaleTracking','mark','WRITE','ALLOW','ROLE','production'), + ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), + ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), + ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'), + ('Ticket', 'addSaleByCode', 'WRITE', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a1d1360a8..18e191188 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -346,12 +346,9 @@ "You are already using a machine": "Ya estás usando una máquina.", "This worker does not exist": "Este trabajador no existe", "this state does not exist": "Este estado no existe", - "Este estado no existe": "Este estado no existe", "The line could not be marked": "No se ha podido marcar la línea", - "No se ha podido marcar la línea": "No se ha podido marcar la línea", "The sale can not be tracked": "La línea no puede ser rastreada", "Shelving not valid": "Carro no válido", - "Carro no válido": "Carro no válido", "printerNotExists": "No existe la impresora", "There are not picking tickets": "No hay tickets para sacar", "ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)" diff --git a/modules/item/back/methods/item-shelving/makeMulti.js b/modules/item/back/methods/item-shelving/makeMulti.js deleted file mode 100644 index e3a3b1cf5..000000000 --- a/modules/item/back/methods/item-shelving/makeMulti.js +++ /dev/null @@ -1,71 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('makeMulti', { - description: 'Add a record or update it if it already exists.', - accessType: 'WRITE', - accepts: [{ - arg: 'shelvingFk', - type: 'string', - required: true, - }, - { - arg: 'items', - type: ['number'], - required: true, - description: 'array of item foreign keys' - }, - { - arg: 'warehouseFk', - type: 'number', - required: true - }], - - http: { - path: `/makeMulti`, - verb: 'POST' - } - }); - - Self.makeMulti = async(shelvingFk, items, warehouseFk, options) => { - const myOptions = {}; - let tx; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - const discardItems = []; - - try { - for (let item of items) { - if (!discardItems.includes(item)) { - let quantity = items.reduce((acc, cur) => { - return acc + (cur === item ? 1 : 0); - }, 0); - discardItems.push(item); - - const [result] = await Self.rawSql('SELECT vn.itemPacking(?, ?) itemPacking', - [item, warehouseFk], myOptions); - let packing; - - if (result) packing = result.itemPacking; - if (!packing) packing = 1; - - quantity = quantity * packing; - - await Self.rawSql('CALL vn.itemShelving_add(?, ?, ?, NULL, NULL, ?, ?)', - [shelvingFk, item, quantity, packing, warehouseFk], myOptions - ); - } - } - - if (tx) await tx.commit(); - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } - }; -}; diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/return.js index 8e8b4eae2..81047461e 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/return.js @@ -39,13 +39,14 @@ module.exports = Self => { }; let itemShelvings = await models.ItemShelving.find(filterItemShelvings, myOptions); - const [alternatives] = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', - [shelvingFk], myOptions - ); if (itemShelvings) { + const [alternatives] = await models.ItemShelving.rawSql('CALL vn.itemShelving_getAlternatives(?)', + [shelvingFk], myOptions + ); return itemShelvings.map(itemShelving => { const item = itemShelving.item(); + const carros = alternatives.filter(alternative => alternative.itemFk == itemShelving.itemFk); return { diff --git a/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js b/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js deleted file mode 100644 index f64a815f2..000000000 --- a/modules/item/back/methods/item-shelving/specs/makeMulti.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('item makeMulti()', () => { - const warehouseFk = 1; - - beforeAll(async() => { - ctx = { - accessToken: {userId: 9}, - req: { - headers: {origin: 'http://localhost'}, - } - }; - }); - - it('should add two new records', async() => { - const shelvingFk = 'ZPP'; - const items = [1, 1, 1, 2]; - const tx = await models.ItemShelving.beginTransaction({}); - const options = {transaction: tx}; - - try { - await models.ItemShelving.makeMulti(shelvingFk, items, warehouseFk, options); - const itemShelvings = await models.ItemShelving.find({where: {shelvingFk}}, options); - - expect(itemShelvings.length).toEqual(2); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it('should update the visible items', async() => { - const shelvingFk = 'GVC'; - const items = [2, 2]; - const tx = await models.ItemShelving.beginTransaction({}); - const options = {transaction: tx}; - try { - const {visible: itemsBefore} = await models.ItemShelving.findOne({ - where: {shelvingFk, itemFk: items[0]} - }, options); - await models.ItemShelving.makeMulti(shelvingFk, items, warehouseFk, options); - const {visible: itemsAfter} = await models.ItemShelving.findOne({ - where: {shelvingFk, itemFk: items[0]} - }, options); - - expect(itemsAfter).toEqual(itemsBefore + 2); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js index c8acd6ab9..07ddc2168 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -describe('itemShelving return()', () => { +fdescribe('itemShelving return()', () => { beforeAll(async() => { ctx = { req: { @@ -9,15 +9,6 @@ describe('itemShelving return()', () => { }; }); - it('should return a list of items and alternative locations', async() => { - const shelvingFk = 'PCC'; - const itemShelvings = await models.ItemShelving.return(shelvingFk); - - expect(itemShelvings[0].itemFk).toEqual(999997); - expect(itemShelvings[0].quantity).toEqual(10); - expect(itemShelvings[0].carros.length).toEqual(1); - }); - it('should return a list of items without alternatives', async() => { const shelvingFk = 'HEJ'; const itemShelvings = await models.ItemShelving.return(shelvingFk); diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 4eb5374e8..6e63a29b2 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -1,7 +1,6 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); require('../methods/item-shelving/getInventory')(Self); - require('../methods/item-shelving/makeMulti')(Self); require('../methods/item-shelving/return')(Self); require('../methods/item-shelving/updateFromSale')(Self); }; diff --git a/back/methods/collection/addItem.js b/modules/ticket/back/methods/ticket/addSaleByCode.js similarity index 57% rename from back/methods/collection/addItem.js rename to modules/ticket/back/methods/ticket/addSaleByCode.js index 1317662b4..5c63b465e 100644 --- a/back/methods/collection/addItem.js +++ b/modules/ticket/back/methods/ticket/addSaleByCode.js @@ -1,6 +1,5 @@ -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('addItem', { + Self.remoteMethodCtx('addSaleByCode', { description: 'Add a collection', accessType: 'WRITE', accepts: [ @@ -8,33 +7,26 @@ module.exports = Self => { arg: 'code', type: 'string', required: true - }, - { + }, { arg: 'quantity', type: 'number', required: true - }, - { + }, { arg: 'ticketFk', type: 'number', required: true }, - { - arg: 'warehouseFk', - type: 'number', - required: true - }, + ], http: { - path: `/addItem`, + path: `/addSaleByCode`, verb: 'POST' }, }); - Self.addItem = async(ctx, code, quantity, ticketFk, warehouseFk, options) => { + Self.addSaleByCode = async(ctx, code, quantity, ticketFk, options) => { const models = Self.app.models; const myOptions = {}; - const $t = ctx.req.__; let tx; if (typeof options == 'object') @@ -46,11 +38,8 @@ module.exports = Self => { } try { - const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk], myOptions); - - if (!item?.available) throw new UserError($t('We do not have availability for the selected item')); - - await models.Ticket.addSale(ctx, ticketFk, item.id, quantity, myOptions); + const [{itemFk}] = await Self.rawSql('SELECT barcodeToItem(?) itemFk', [code], myOptions); + await models.Ticket.addSale(ctx, ticketFk, itemFk, quantity, myOptions); if (tx) await tx.commit(); } catch (e) { diff --git a/back/methods/collection/spec/addItem.spec.js b/modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js similarity index 60% rename from back/methods/collection/spec/addItem.spec.js rename to modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js index 199aae588..ce3a5b3ad 100644 --- a/back/methods/collection/spec/addItem.spec.js +++ b/modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); const LoopBackContext = require('loopback-context'); -describe('collection addItem()', () => { +describe('Ticket addSaleByCode()', () => { const quantity = 3; const ticketFk = 24; const warehouseFk = 1; @@ -26,7 +26,7 @@ describe('collection addItem()', () => { const code = '1111111111'; const salesBefore = await models.Sale.find(null, options); - await models.Collection.addItem(activeCtx, code, quantity, ticketFk, warehouseFk, options); + await models.Ticket.addSaleByCode(activeCtx, code, quantity, ticketFk, warehouseFk, options); const salesAfter = await models.Sale.find(null, options); expect(salesAfter.length).toEqual(salesBefore.length + 1); @@ -36,21 +36,4 @@ describe('collection addItem()', () => { throw e; } }); - - it('should throw an error when the item is not available', async() => { - const code = '00000000000'; - const tx = await models.Sale.beginTransaction({}); - - try { - const options = {transaction: tx}; - - await models.Collection.addItem(activeCtx, code, quantity, ticketFk, warehouseFk, options); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - const error = e; - - expect(error.message).toEqual('We do not have availability for the selected item'); - } - }); }); diff --git a/modules/ticket/back/models/ticket.js b/modules/ticket/back/models/ticket.js index 1930765fb..51a8372e3 100644 --- a/modules/ticket/back/models/ticket.js +++ b/modules/ticket/back/models/ticket.js @@ -1,4 +1,5 @@ module.exports = Self => { require('./ticket-methods')(Self); require('../methods/ticket/state')(Self); + require('../methods/ticket/addSaleByCode')(Self); }; From 2a6abffef938d77f975498aa475ec7a2f03f2d27 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 30 Jan 2024 16:07:33 +0100 Subject: [PATCH 109/250] fix: refs #6276 fix errors & refactor --- back/methods/collection/assignCollection.js | 3 +-- .../mobile-app-version-control/getVersion.js | 6 +++--- loopback/locale/en.json | 2 +- loopback/locale/es.json | 2 +- modules/item/back/methods/item/card.js | 1 - modules/ticket/back/methods/sale-tracking/mark.js | 4 ++-- .../back/methods/sale-tracking/specs/mark.spec.js | 2 +- .../back/methods/ticket/specs/setDeleted.spec.js | 13 ++++++++----- modules/ticket/back/models/expeditionPallet.json | 3 --- 9 files changed, 17 insertions(+), 19 deletions(-) diff --git a/back/methods/collection/assignCollection.js b/back/methods/collection/assignCollection.js index c4671e747..67a10df51 100644 --- a/back/methods/collection/assignCollection.js +++ b/back/methods/collection/assignCollection.js @@ -16,7 +16,6 @@ module.exports = Self => { Self.assignCollection = async(ctx, options) => { const userId = ctx.req.accessToken.userId; const myOptions = {userId}; - const $t = ctx.req.__; if (typeof options == 'object') Object.assign(myOptions, options); @@ -26,7 +25,7 @@ module.exports = Self => { const [assignedCollection] = await Self.rawSql('SELECT @vCollectionFk'); const {'@vCollectionFk': collectionFk} = assignedCollection; - if (!collectionFk) throw new UserError($t('There are not picking tickets')); + if (!collectionFk) throw new UserError('There are not picking tickets'); await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions); return collectionFk; diff --git a/back/methods/mobile-app-version-control/getVersion.js b/back/methods/mobile-app-version-control/getVersion.js index 510fd6c4a..38f4acc54 100644 --- a/back/methods/mobile-app-version-control/getVersion.js +++ b/back/methods/mobile-app-version-control/getVersion.js @@ -29,9 +29,9 @@ module.exports = Self => { let fields = ['id', 'appName']; if (workerFk) - fields = [...fields, ...['isVersionBetaCritical', 'versionBeta', 'urlBeta']]; + fields = fields.concat(['isVersionBetaCritical', 'versionBeta', 'urlBeta']); else - fields = [...fields, ...['isVersionCritical', 'version', 'urlProduction']]; + fields = fields.concat(['isVersionCritical', 'version', 'urlProduction']); const filter = { where: { @@ -40,6 +40,6 @@ module.exports = Self => { fields, }; - return await Self.findOne(filter); + return Self.findOne(filter); }; }; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 5ff31a22f..fc15d0d0e 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -212,7 +212,7 @@ "This worker does not exist": "This worker does not exist", "this state does not exist": "This state does not exist", "The line could not be marked": "The line could not be marked", - "The sale can not be tracked": "The sale can not be tracked", + "The sale cannot be tracked": "The sale cannot be tracked", "Shelving not valid": "Shelving not valid", "printerNotExists": "The printer does not exist", "There are not picking tickets": "There are not picking tickets", diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 18e191188..f9e41d7f8 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -347,7 +347,7 @@ "This worker does not exist": "Este trabajador no existe", "this state does not exist": "Este estado no existe", "The line could not be marked": "No se ha podido marcar la línea", - "The sale can not be tracked": "La línea no puede ser rastreada", + "The sale cannot be tracked": "La línea no puede ser rastreada", "Shelving not valid": "Carro no válido", "printerNotExists": "No existe la impresora", "There are not picking tickets": "No hay tickets para sacar", diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js index bc59c8bff..5d086ce88 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/card.js @@ -36,7 +36,6 @@ module.exports = Self => { fields: ['code'], where: { itemFk: realIdItem - } }); diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index dc288ba93..dd6cbc781 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -90,12 +90,12 @@ module.exports = Self => { const buy = await models.Buy.findById(buyFk, myOptions); if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); } catch (e) { - throw new UserError($t('The sale can not be tracked')); + throw new UserError($t('The sale cannot be tracked')); } if (tx) await tx.commit(); } catch (e) { - if (e.message == $t('The sale can not be tracked')) { + if (e.message == $t('The sale cannot be tracked')) { if (tx) tx.commit(); throw e; } diff --git a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js index d981aeea5..723f5fb78 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js @@ -79,7 +79,7 @@ describe('saleTracking mark()', () => { } catch (e) { const error = e; - expect(error.message).toEqual('The sale can not be tracked'); + expect(error.message).toEqual('The sale cannot be tracked'); await tx.rollback(); } }); diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index f3e35972f..520a9e403 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -50,14 +50,17 @@ describe('ticket setDeleted()', () => { return value; }; const ticketId = 23; - - await models.Ticket.setDeleted(ctx, ticketId, options); - - const [sectorCollection] = await models.Ticket.rawSql( + const [sectorCollectionBefore] = await models.Ticket.rawSql( `SELECT COUNT(*) numberRows FROM vn.sectorCollection`, [], options); - expect(sectorCollection.numberRows).toEqual(1); + await models.Ticket.setDeleted(ctx, ticketId, options); + + const [sectorCollectionAfter] = await models.Ticket.rawSql( + `SELECT COUNT(*) numberRows + FROM vn.sectorCollection`, [], options); + + expect(sectorCollectionAfter.numberRows).toEqual(sectorCollectionBefore.numberRows - 1); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/back/models/expeditionPallet.json b/modules/ticket/back/models/expeditionPallet.json index 7cb4e1e6d..cab3af6ec 100644 --- a/modules/ticket/back/models/expeditionPallet.json +++ b/modules/ticket/back/models/expeditionPallet.json @@ -12,9 +12,6 @@ "id": true, "description": "Identifier" }, - "truckFk": { - "type": "number" - }, "built": { "type": "date" }, From 8f5a5d9cba80966e5bd4f408a91c63fe7ffbacbe Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 31 Jan 2024 13:11:15 +0100 Subject: [PATCH 110/250] fix: refs #6703 tests & backs --- .../getSalesFromTicketOrCollection.js | 14 ++--- .../10837-whiteOrchid/00-firstScript.sql | 18 ------ loopback/locale/en.json | 2 - loopback/locale/es.json | 5 +- .../methods/expedition-pallet/getPallet.js | 60 ------------------- .../expedition-pallet/specs/getPallet.spec.js | 32 ---------- .../back/methods/sale-tracking/delete.js | 6 -- .../ticket/back/methods/sale-tracking/mark.js | 7 +-- .../sale-tracking/specs/delete.spec.js | 3 +- .../methods/sale-tracking/updateTracking.js | 3 +- .../ticket/back/models/expeditionPallet.js | 3 - modules/ticket/back/models/sale-buy.json | 3 +- modules/ticket/back/models/sale.js | 2 +- modules/worker/back/methods/operator/add.js | 10 ++-- 14 files changed, 19 insertions(+), 149 deletions(-) delete mode 100644 db/versions/10837-whiteOrchid/00-firstScript.sql delete mode 100644 modules/ticket/back/methods/expedition-pallet/getPallet.js delete mode 100644 modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js delete mode 100644 modules/ticket/back/models/expeditionPallet.js diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSalesFromTicketOrCollection.js index 09ccbafdc..3c27a0be6 100644 --- a/back/methods/collection/getSalesFromTicketOrCollection.js +++ b/back/methods/collection/getSalesFromTicketOrCollection.js @@ -154,15 +154,13 @@ module.exports = Self => { } async function setState(source, id, options) { - let state; - if (source == 'PRECHECKER') state = 'PREVIOUS_CONTROL'; - else if (source == 'CHECKER') state = 'ON_CHECKING'; - - if (state) { + const states = { + 'PRECHECKER': 'PREVIOUS_CONTROL', + 'CHECKER': 'ON_CHECKING' + }; + if (states[source]) { await Self.rawSql( - 'CALL vn.ticketStateToday_setState(?,?)', - [id, state], - options + 'CALL vn.ticketStateToday_setState(?,?)', [id, states[source]], options ); } } diff --git a/db/versions/10837-whiteOrchid/00-firstScript.sql b/db/versions/10837-whiteOrchid/00-firstScript.sql deleted file mode 100644 index eef5faa80..000000000 --- a/db/versions/10837-whiteOrchid/00-firstScript.sql +++ /dev/null @@ -1,18 +0,0 @@ --- Place your SQL code here -INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) - VALUES - ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'employee'), - ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','employee'), - ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'), - ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','employee'), - ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','employee'), - ('SaleTracking','mark','WRITE','ALLOW','ROLE','employee'), - ('ItemBarcode','deleteByItemAndCode','WRITE','ALLOW','ROLE','employee'), - ('Collection','addItem','WRITE','ALLOW','ROLE','employee'), - ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), - ('MobileAppVersionControl', '*', 'READ', 'ALLOW', 'ROLE', 'production'), - ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), - ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'employee'), - ('Collection', 'addItem', 'WRITE', 'ALLOW', 'ROLE', 'production'); - \ No newline at end of file diff --git a/loopback/locale/en.json b/loopback/locale/en.json index fc15d0d0e..20bb3eb07 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -206,10 +206,8 @@ "Incorrect pin": "Incorrect pin.", "This machine is already in use.": "This machine is already in use.", "the plate does not exist": "The plate {{plate}} does not exist", - "This pallet does not exist": "This pallet does not exist", "We do not have availability for the selected item": "We do not have availability for the selected item", "You are already using a machine": "You are already using a machine", - "This worker does not exist": "This worker does not exist", "this state does not exist": "This state does not exist", "The line could not be marked": "The line could not be marked", "The sale cannot be tracked": "The sale cannot be tracked", diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f9e41d7f8..65ff7e951 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -341,15 +341,14 @@ "There is no zone for these parameters 999999": "There is no zone for these parameters 999999", "This machine is already in use.": "Esta máquina ya está en uso.", "the plate does not exist": "La máquina {{plate}} no existe", - "This pallet does not exist": "Este palet no existe", "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", "You are already using a machine": "Ya estás usando una máquina.", - "This worker does not exist": "Este trabajador no existe", "this state does not exist": "Este estado no existe", "The line could not be marked": "No se ha podido marcar la línea", "The sale cannot be tracked": "La línea no puede ser rastreada", "Shelving not valid": "Carro no válido", "printerNotExists": "No existe la impresora", "There are not picking tickets": "No hay tickets para sacar", - "ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)" + "ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)", + "Este trabajador no existe": "Este trabajador no existe" } \ No newline at end of file diff --git a/modules/ticket/back/methods/expedition-pallet/getPallet.js b/modules/ticket/back/methods/expedition-pallet/getPallet.js deleted file mode 100644 index 340dc02b0..000000000 --- a/modules/ticket/back/methods/expedition-pallet/getPallet.js +++ /dev/null @@ -1,60 +0,0 @@ - -const UserError = require('vn-loopback/util/user-error'); -module.exports = Self => { - Self.remoteMethodCtx('getPallet', { - description: 'Get pallet', - accessType: 'READ', - accepts: [ - { - arg: 'expeditionFk', - type: 'integer', - }, - ], - http: { - path: `/getPallet`, - verb: 'GET' - }, - returns: { - type: 'object', - root: true - }, - }); - - Self.getPallet = async(ctx, expeditionFk, options) => { - const myOptions = {}; - const $t = ctx.req.__; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - try { - const pallet = await Self.findOne({ - fields: ['truckFk'], - where: { - id: expeditionFk - }, - include: [ - { - relation: 'expeditionTruck', - scope: { - fields: ['eta', 'description'] - } - } - ], - }, myOptions); - - if (pallet) { - const truck = pallet.expeditionTruck(); - return { - truckFk: pallet.truckFk, - eta: truck.eta, - description: truck.description - }; - } - - throw new UserError($t('This pallet does not exist')); - } catch (e) { - return {message: e.message}; - } - }; -}; diff --git a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js b/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js deleted file mode 100644 index 497fe04bb..000000000 --- a/modules/ticket/back/methods/expedition-pallet/specs/getPallet.spec.js +++ /dev/null @@ -1,32 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('expeditonPallet getPallet()', () => { - beforeAll(async() => { - ctx = { - req: { - headers: {origin: 'http://localhost'}, - __: value => value - } - }; - }); - - it('should obtain the pallet data', async() => { - const palletId = 1; - const pallet = await models.ExpeditionPallet.getPallet(ctx, palletId); - - expect(pallet).toBeDefined(); - expect(pallet.truckFk).toEqual(1); - expect(pallet.description).toEqual('BEST TRUCK IN FLEET'); - }); - - it('should throw an error when the pallet does not exist', async() => { - const palletId = 600; - try { - await models.ExpeditionPallet.getPallet(ctx, palletId); - } catch (e) { - const error = e; - - expect(error.message).toEqual('This pallet does not exist'); - } - }); -}); diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 5efd267dc..859f26354 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -14,10 +14,6 @@ module.exports = Self => { type: ['string'] }, ], - returns: { - type: 'boolean', - root: true - }, http: { path: `/delete`, verb: 'POST' @@ -63,8 +59,6 @@ module.exports = Self => { await saleTracking.destroy(myOptions); if (tx) await tx.commit(); - - return true; } catch (e) { if (tx) await tx.rollback(); throw e; diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/mark.js index dd6cbc781..71fdfa048 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/mark.js @@ -54,7 +54,6 @@ module.exports = Self => { Self.mark = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; - const $t = ctx.req.__; const myOptions = {}; let tx; @@ -90,18 +89,18 @@ module.exports = Self => { const buy = await models.Buy.findById(buyFk, myOptions); if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); } catch (e) { - throw new UserError($t('The sale cannot be tracked')); + throw new UserError('The sale cannot be tracked'); } if (tx) await tx.commit(); } catch (e) { - if (e.message == $t('The sale cannot be tracked')) { + if (e.message == 'The sale cannot be tracked') { if (tx) tx.commit(); throw e; } if (tx) await tx.rollback(); - throw new UserError($t('The line could not be marked')); + throw new UserError('The line could not be marked'); } }; }; diff --git a/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js b/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js index e23c12a61..bb66db4f3 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/delete.spec.js @@ -12,12 +12,11 @@ describe('sale-tracking delete()', () => { const saleFk = 1; const stateCode = ['PREPARED']; - const result = await models.SaleTracking.delete(saleFk, stateCode, options); + await models.SaleTracking.delete(saleFk, stateCode, options); const itemShelvingsAfter = await models.ItemShelvingSale.find(null, options); const saleTrackingsAfter = await models.SaleTracking.find(null, options); - expect(result).toEqual(true); expect(saleTrackingsAfter.length).toBeLessThan(saleTrackingsBefore.length); expect(itemShelvingsAfter.length).toBeLessThan(itemShelvingsBefore.length); diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 22ff141d8..2ce8ddaba 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -43,7 +43,6 @@ module.exports = Self => { Self.updateTracking = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned = null, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; - const $t = ctx.req.__; const myOptions = {}; let tx; @@ -60,7 +59,7 @@ module.exports = Self => { where: {code}, }, myOptions); - if (!state) throw new UserError($t('this state does not exist')); + if (!state) throw new UserError('this state does not exist'); const uniqueAttributes = { saleFk, workerFk: userId, diff --git a/modules/ticket/back/models/expeditionPallet.js b/modules/ticket/back/models/expeditionPallet.js deleted file mode 100644 index f41ad7712..000000000 --- a/modules/ticket/back/models/expeditionPallet.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function(Self) { - require('../methods/expedition-pallet/getPallet')(Self); -}; diff --git a/modules/ticket/back/models/sale-buy.json b/modules/ticket/back/models/sale-buy.json index 60ff2bef4..a431f1224 100644 --- a/modules/ticket/back/models/sale-buy.json +++ b/modules/ticket/back/models/sale-buy.json @@ -9,8 +9,7 @@ "properties": { "saleFk": { "id": true, - "type": "number", - "forceId": false + "type": "number" }, "buyFk": { "type": "number" diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 770fb3c5b..f20b00976 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -72,7 +72,7 @@ module.exports = Self => { if (item.family == 'EMB') return; const isInPreparing = await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*'); - if (!ctx.isNEwInstance && isInPreparing) return; + if (!ctx.isNewInstance && isInPreparing) return; await models.Sale.rawSql(`CALL catalog_calcFromItem(?,?,?,?)`, [ ticket.landed, diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js index d330bc25b..150380513 100644 --- a/modules/worker/back/methods/operator/add.js +++ b/modules/worker/back/methods/operator/add.js @@ -1,4 +1,3 @@ -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('add', { description: 'Add a new operator', @@ -12,7 +11,6 @@ module.exports = Self => { Self.add = async(ctx, options) => { const userId = ctx.req.accessToken.userId; const myOptions = {}; - const $t = ctx.req.__; let tx; if (typeof options == 'object') @@ -24,13 +22,13 @@ module.exports = Self => { } try { - await Self.create({ - workerFk: userId - }); + const isOperator = await Self.findById(user, myOptions); + if (!isOperator) await Self.create({workerFk: userId}, myOptions); + if (tx) await tx.commit(); } catch (e) { if (tx) await tx.rollback(); - throw new UserError($t('This worker does not exist')); + throw e; } }; }; From ec7a88c6dd6e4ea644c2cf70b791225676dd02bc Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 1 Feb 2024 12:56:11 +0100 Subject: [PATCH 111/250] fix: refs #6703 tests, backs & fixtures --- db/dump/fixtures.before.sql | 175 +++++++++--------- loopback/server/connectors/vn-mysql.js | 8 +- .../methods/sale-tracking/updateTracking.js | 1 + modules/ticket/back/models/sale-buy.json | 3 + modules/ticket/back/models/specs/sale.spec.js | 21 ++- modules/worker/back/methods/operator/add.js | 17 +- 6 files changed, 117 insertions(+), 108 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 257e8c5cf..0d815d23a 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3094,9 +3094,7 @@ INSERT IGNORE INTO vn.sector SET id = 9991, description = 'NormalSector', warehouseFk = 999, - isPreviousPreparedByPacking = FALSE, code = 'NS', - isPreviousPrepared = FALSE, isPackagingArea = FALSE, sonFk = NULL, isMain = TRUE, @@ -3106,9 +3104,7 @@ INSERT IGNORE INTO vn.sector SET id = 9992, description = 'PreviousSector', warehouseFk = 999, - isPreviousPreparedByPacking = FALSE, code = 'PS', - isPreviousPrepared = TRUE, isPackagingArea = FALSE, sonFk = NULL, isMain = TRUE, @@ -3118,41 +3114,38 @@ INSERT IGNORE INTO vn.sector SET id = 9993, description = 'MezaninneSector', warehouseFk = 999, - isPreviousPreparedByPacking = TRUE, code = 'MS', - isPreviousPrepared = FALSE, isPackagingArea = FALSE, sonFk = 9991, isMain = TRUE, itemPackingTypeFk = NULL; -REPLACE vn.parking SET id = 9991011, sectorFk = 9991, code = 'A-01-1', pickingOrder = 1; -REPLACE vn.parking SET id = 9991012, sectorFk = 9991, code = 'A-02-2', pickingOrder = 2; -REPLACE vn.parking SET id = 9991013, sectorFk = 9991, code = 'A-03-3', pickingOrder = 3; -REPLACE vn.parking SET id = 9991014, sectorFk = 9991, code = 'A-04-4', pickingOrder = 4; -REPLACE vn.parking SET id = 9991015, sectorFk = 9991, code = 'A-05-5', pickingOrder = 5; -REPLACE vn.parking SET id = 9992011, sectorFk = 9992, code = 'P-01-1', pickingOrder = 6; -REPLACE vn.parking SET id = 9992012, sectorFk = 9992, code = 'P-02-2', pickingOrder = 7; -REPLACE vn.parking SET id = 9992013, sectorFk = 9992, code = 'P-03-3', pickingOrder = 8; +INSERT INTO vn.parking (id,sectorFk, code, pickingOrder) + VALUES (4,9991, 'A-01-1', 1), + (5,9991, 'A-02-2', 2), + (6,9991, 'A-03-3', 3), + (7,9991, 'A-04-4', 4), + (8,9991, 'A-05-5', 5), + (9,9992, 'P-01-1', 6), + (10,9992, 'P-02-2', 7), + (11,9992, 'P-03-3', 8), + (12,9993, 'M-01-1', 9), + (13,9993, 'M-02-2', 10), + (14,9993, 'M-03-3', 11); -REPLACE vn.parking SET id = 9993011, sectorFk = 9993, code = 'M-01-1', pickingOrder = 9; -REPLACE vn.parking SET id = 9993012, sectorFk = 9993, code = 'M-02-2', pickingOrder = 10; -REPLACE vn.parking SET id = 9993013, sectorFk = 9993, code = 'M-03-3', pickingOrder = 11; - -REPLACE vn.shelving SET code = 'NAA', parkingFk = 9991011, priority = 1; -REPLACE vn.shelving SET code = 'NBB', parkingFk = 9991012, priority = 1; -REPLACE vn.shelving SET code = 'NCC', parkingFk = 9991013, priority = 1; -REPLACE vn.shelving SET code = 'NDD', parkingFk = 9991014, priority = 1; -REPLACE vn.shelving SET code = 'NEE', parkingFk = 9991015, priority = 1; - -REPLACE vn.shelving SET code = 'PAA', parkingFk = 9992011, priority = 1; -REPLACE vn.shelving SET code = 'PBB', parkingFk = 9992012, priority = 1; -REPLACE vn.shelving SET code = 'PCC', parkingFk = 9992013, priority = 1; - -REPLACE vn.shelving SET code = 'MAA', parkingFk = 9993011, priority = 1; -REPLACE vn.shelving SET code = 'MBB', parkingFk = 9993012, priority = 1; -REPLACE vn.shelving SET code = 'MCC', parkingFk = 9993013, priority = 1; +INSERT INTO vn.shelving (code, parkingFk, priority) + VALUES ('NAA', 4, 1), + ('NBB', 5, 1), + ('NCC', 6, 1), + ('NDD', 7, 1), + ('NEE', 8, 1), + ('PAA', 9, 1), + ('PBB', 10, 1), + ('PCC', 11, 1), + ('MAA', 12, 1), + ('MBB', 13, 1), + ('MCC', 14, 1); INSERT IGNORE INTO vn.itemType SET id = 999, @@ -3172,10 +3165,9 @@ INSERT IGNORE INTO vn.travel landed = CURDATE(), warehouseInFk = 999, warehouseOutFk = 1, - isReceived = TRUE, - agencyFk = 1; + isReceived = TRUE; -REPLACE vn.entry +INSERT INTO vn.entry SET id = 999, supplierFk = 791, isConfirmed = TRUE, @@ -3183,7 +3175,7 @@ REPLACE vn.entry travelFk = 99, companyFk = 442; -REPLACE vn.ticket +INSERT INTO vn.ticket SET id = 999999, clientFk = 2, warehouseFk = 999, @@ -3194,7 +3186,7 @@ REPLACE vn.ticket agencyModeFk = 10, landed = CURDATE(); -REPLACE vn.collection +INSERT INTO vn.collection SET id = 10101010, workerFk = 9; @@ -3203,7 +3195,7 @@ INSERT IGNORE INTO vn.ticketCollection ticketFk = 999999, collectionFk = 10101010; -REPLACE vn.item +INSERT INTO vn.item SET id = 999991, name = 'Palito para pinchos', `size` = 25, @@ -3216,7 +3208,7 @@ REPLACE vn.item weightByPiece = 6, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999991, entryFk = 999, itemFk = 999991, @@ -3233,7 +3225,7 @@ REPLACE vn.buy minPrice = 1, weight = 50; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99991, itemFk = 999991, ticketFk = 999999, @@ -3242,7 +3234,7 @@ REPLACE vn.sale price = 1, discount = 0; -REPLACE vn.item +INSERT INTO vn.item SET id = 999992, name = 'Madera verde', `size` = 10, @@ -3255,7 +3247,7 @@ REPLACE vn.item weightByPiece = 50, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999992, entryFk = 999, itemFk = 999992, @@ -3272,7 +3264,7 @@ REPLACE vn.buy minPrice = 1, weight = 25; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99992, itemFk = 999992, ticketFk = 999999, @@ -3281,7 +3273,7 @@ REPLACE vn.sale price = 1, discount = 0; -REPLACE vn.item +INSERT INTO vn.item SET id = 999993, name = 'Madera Roja/Morada', `size` = 12, @@ -3294,7 +3286,7 @@ REPLACE vn.item weightByPiece = 35, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999993, entryFk = 999, itemFk = 999993, @@ -3311,7 +3303,7 @@ REPLACE vn.buy minPrice = 1, weight = 25; -REPLACE vn.itemShelving +INSERT INTO vn.itemShelving SET id = 9931, itemFk = 999993, shelvingFk = 'NCC', @@ -3319,7 +3311,7 @@ REPLACE vn.itemShelving `grouping` = 5, packing = 10; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99993, itemFk = 999993, ticketFk = 999999, @@ -3328,7 +3320,7 @@ REPLACE vn.sale price = 1, discount = 0; -REPLACE vn.item +INSERT INTO vn.item SET id = 999994, name = 'Madera Naranja', `size` = 18, @@ -3341,7 +3333,7 @@ REPLACE vn.item weightByPiece = 160, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999994, entryFk = 999, itemFk = 999994, @@ -3358,7 +3350,7 @@ REPLACE vn.buy minPrice = 1, weight = 25; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99994, itemFk = 999994, ticketFk = 999999, @@ -3367,7 +3359,7 @@ REPLACE vn.sale price = 1, discount = 0; -REPLACE vn.item +INSERT INTO vn.item SET id = 999995, name = 'Madera Amarilla', `size` = 11, @@ -3380,7 +3372,7 @@ REPLACE vn.item weightByPiece = 78, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999995, entryFk = 999, itemFk = 999995, @@ -3397,7 +3389,7 @@ REPLACE vn.buy minPrice = 1, weight = 35; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99995, itemFk = 999995, ticketFk = 999999, @@ -3407,7 +3399,7 @@ REPLACE vn.sale discount = 0; -- Palito naranja -REPLACE vn.item +INSERT INTO vn.item SET id = 999998, name = 'Palito naranja', `size` = 11, @@ -3420,7 +3412,7 @@ REPLACE vn.item weightByPiece = 78, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999998, entryFk = 999, itemFk = 999998, @@ -3437,7 +3429,7 @@ REPLACE vn.buy minPrice = 1, weight = 35; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99998, itemFk = 999998, ticketFk = 999999, @@ -3447,7 +3439,7 @@ REPLACE vn.sale discount = 0; -- Palito amarillo -REPLACE vn.item +INSERT INTO vn.item SET id = 999999, name = 'Palito amarillo', `size` = 11, @@ -3460,7 +3452,7 @@ REPLACE vn.item weightByPiece = 78, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 9999999, entryFk = 999, itemFk = 999999, @@ -3477,7 +3469,7 @@ REPLACE vn.buy minPrice = 1, weight = 35; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 99999, itemFk = 999999, ticketFk = 999999, @@ -3487,7 +3479,7 @@ REPLACE vn.sale discount = 0; -- Palito azul -REPLACE vn.item +INSERT INTO vn.item SET id = 1000000, name = 'Palito azul', `size` = 10, @@ -3500,7 +3492,7 @@ REPLACE vn.item weightByPiece = 78, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 10000000, entryFk = 999, itemFk = 1000000, @@ -3517,7 +3509,7 @@ REPLACE vn.buy minPrice = 1, weight = 35; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 100000, itemFk = 1000000, ticketFk = 999999, @@ -3527,7 +3519,7 @@ REPLACE vn.sale discount = 0; -- Palito rojo -REPLACE vn.item +INSERT INTO vn.item SET id = 1000001, name = 'Palito rojo', `size` = 10, @@ -3540,7 +3532,7 @@ REPLACE vn.item weightByPiece = 78, intrastatFk = 44219999; -REPLACE vn.buy +INSERT INTO vn.buy SET id = 10000001, entryFk = 999, itemFk = 1000001, @@ -3558,7 +3550,7 @@ REPLACE vn.buy weight = 35; -REPLACE vn.sale +INSERT INTO vn.sale SET id = 100001, itemFk = 1000001, ticketFk = 999999, @@ -3581,7 +3573,7 @@ INSERT IGNORE INTO vn.item weightByPiece = 20, intrastatFk = 44219999; -REPLACE vn.buy +INSERT vn.buy SET id = 9999996, entryFk = 999, itemFk = 999996, @@ -3598,7 +3590,7 @@ REPLACE vn.buy minPrice = 7, weight = 80; -REPLACE vn.sale +INSERT vn.sale SET id = 99996, itemFk = 999996, ticketFk = 999999, @@ -3621,7 +3613,7 @@ INSERT IGNORE INTO vn.item weightByPiece = 20, intrastatFk = 44219999; -REPLACE vn.buy +INSERT vn.buy SET id = 9999997, entryFk = 999, itemFk = 999997, @@ -3638,7 +3630,7 @@ REPLACE vn.buy minPrice = 7, weight = 80; -REPLACE vn.sale +INSERT vn.sale SET id = 99997, itemFk = 999997, ticketFk = 999999, @@ -3655,25 +3647,25 @@ DELETE ish.* FROM vn.itemShelving ish JOIN vn.warehouse w ON w.id = s.warehouseFk WHERE w.name = 'TestingWarehouse'; -REPLACE vn.itemShelving -(id, itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) +INSERT INTO vn.itemShelving +(itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, isChecked) VALUES - (9911, 999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL), - (9912, 999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL), - (9913, 1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL), - (9914, 1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL), - (9915, 999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL), - (9916, 999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL), - (9917, 999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL), - (9918, 999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL), - (9919, 999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL), - (9920, 999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL), - (9921, 999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL), - (9922, 1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL), - (9923, 999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL), - (9924, 1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL), - (9925, 999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL), - (9926, 999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL); + (999991, 'NAA', 8, '2023-09-20', 1, 20, NULL, 103, NULL), + (999998, 'NAA', 80, '2023-09-20', 10, 30, NULL, 103, NULL), + (1000001, 'NAA', 6, '2023-09-20', 3, 50, NULL, 103, NULL), + (1000000, 'NBB', 50, '2023-09-18', 25, 500, NULL, 103, NULL), + (999993, 'NBB', 25, '2023-09-18', NULL, 10, NULL, 103, NULL), + (999999, 'NBB', 30, '2023-09-18', 10, 500, NULL, 103, NULL), + (999993, 'NCC', 25, '2023-09-20', 5, 10, NULL, 103, NULL), + (999997, 'NCC', 10, '2023-09-20', NULL, 100, NULL, 103, NULL), + (999999, 'NCC', 40, '2023-09-20', 10, 500, NULL, 103, NULL), + (999995, 'NDD', 10, '2023-09-19', NULL, 20, NULL, 103, NULL), + (999994, 'NDD', 48, '2023-09-19', 4, 20, NULL, 103, NULL), + (1000001, 'NEE', 6, '2023-09-21', 3, 50, NULL, 103, NULL), + (999992, 'NEE', 50, '2023-09-21', NULL, 1, NULL, 103, NULL), + (1000000, 'NEE', 25, '2023-09-21', 25, 500, NULL, 103, NULL), + (999996, 'PAA', 5, '2023-09-27', 1, 5, NULL, 103, NULL), + (999997, 'PCC', 10, '2023-09-27', 5, 100, NULL, 103, NULL); -- Previous for Bolas de madera INSERT IGNORE INTO vn.sectorCollection @@ -3682,9 +3674,9 @@ INSERT IGNORE INTO vn.sectorCollection sectorFk = 9992; INSERT IGNORE INTO vn.saleGroup - SET id = 999, + SET id = 4, userFk = 1, - parkingFk = 9992011, + parkingFk = 9, sectorFk = 9992; INSERT IGNORE INTO vn.sectorCollectionSaleGroup @@ -3692,13 +3684,14 @@ INSERT IGNORE INTO vn.sectorCollectionSaleGroup sectorCollectionFk = 99, saleGroupFk = 999; -REPLACE vn.saleGroupDetail +INSERT vn.saleGroupDetail SET id = 99991, saleFk = 99996, saleGroupFk = 999; -REPLACE vn.saleTracking - SET saleFk = 99996, +INSERT INTO vn.saleTracking + SET id = 7, + saleFk = 99996, isChecked = TRUE, workerFk = 103, stateFk = 28; diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index 7c086ff9b..737fd94d5 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -268,8 +268,14 @@ class VnMySQL extends MySQL { arguments, model, ctx, opts, cb); } + isLoggable(model) { + const Model = this.getModelDefinition(model).model; + const {settings} = Model.definition; + return settings.mixins?.Loggable; + } + invokeMethod(method, args, model, ctx, opts, cb) { - if (!opts?.httpCtx) + if (!this.isLoggable(model)) return super[method].apply(this, args); this.invokeMethodP(method, [...args], model, ctx, opts) diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 2ce8ddaba..50e117084 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -97,6 +97,7 @@ module.exports = Self => { } }, myOptions); } + if (isBuy) await models.SaleBuy.create({saleFk, buyFk}, myOptions); diff --git a/modules/ticket/back/models/sale-buy.json b/modules/ticket/back/models/sale-buy.json index a431f1224..496a8d6fa 100644 --- a/modules/ticket/back/models/sale-buy.json +++ b/modules/ticket/back/models/sale-buy.json @@ -1,6 +1,9 @@ { "name": "SaleBuy", "base": "VnModel", + "mixins": { + "Loggable": true + }, "options": { "mysql": { "table": "saleBuy" diff --git a/modules/ticket/back/models/specs/sale.spec.js b/modules/ticket/back/models/specs/sale.spec.js index d078dc8e2..979b86108 100644 --- a/modules/ticket/back/models/specs/sale.spec.js +++ b/modules/ticket/back/models/specs/sale.spec.js @@ -3,7 +3,7 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -describe('sale model ', () => { +fdescribe('sale model ', () => { const ctx = { req: { accessToken: {userId: 9}, @@ -233,6 +233,25 @@ describe('sale model ', () => { } }); + it('should change the quantity if it has production role and is not a new instance', async() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue(getActiveCtx(9)); + const tx = await models.Sale.beginTransaction({}); + const options = {transaction: tx}; + + try { + const saleId = 1; + const newQuantity = 10; + + const {quantity} = await models.Collection.setSaleQuantity(saleId, newQuantity, options); + + expect(quantity).toEqual(newQuantity); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + describe('newPrice', () => { it('should increase quantity if you have enough available and the new price is the same as the previous one', async() => { const ctx = { diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js index 150380513..6fa780588 100644 --- a/modules/worker/back/methods/operator/add.js +++ b/modules/worker/back/methods/operator/add.js @@ -11,24 +11,11 @@ module.exports = Self => { Self.add = async(ctx, options) => { const userId = ctx.req.accessToken.userId; const myOptions = {}; - let tx; if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const isOperator = await Self.findById(user, myOptions); - if (!isOperator) await Self.create({workerFk: userId}, myOptions); - - if (tx) await tx.commit(); - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } + const isOperator = await Self.findById(user, myOptions); + if (!isOperator) await Self.create({workerFk: userId}, myOptions); }; }; From 21cf05ddd0a2057b6bb865143fa4adec28a8ec06 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 2 Feb 2024 09:23:29 +0100 Subject: [PATCH 112/250] fix: refs #6276 fix tests & errors --- .../item-shelving/specs/return.spec.js | 2 +- modules/item/back/methods/item/card.js | 11 +++++++--- modules/ticket/back/models/specs/sale.spec.js | 2 +- .../travel/specs/extraCommunityFilter.spec.js | 2 +- .../back/methods/travel/specs/filter.spec.js | 2 +- modules/worker/back/methods/operator/add.js | 2 +- .../back/methods/operator/spec/add.spec.js | 21 ++++++++++++------- 7 files changed, 26 insertions(+), 16 deletions(-) diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/return.spec.js index 07ddc2168..a5edc0ade 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/return.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('itemShelving return()', () => { +describe('itemShelving return()', () => { beforeAll(async() => { ctx = { req: { diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/card.js index 5d086ce88..8ee4ccc6b 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/card.js @@ -24,12 +24,17 @@ module.exports = Self => { }, }); - Self.card = async(itemFk, warehouseFk) => { + Self.card = async(itemFk, warehouseFk, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + const models = Self.app.models; - const [[itemInfo]] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk]); + const [[itemInfo]] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk], myOptions); - const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk]); + const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk], myOptions); const [realIdItem] = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); const barcodes = await models.ItemBarcode.find({ diff --git a/modules/ticket/back/models/specs/sale.spec.js b/modules/ticket/back/models/specs/sale.spec.js index 979b86108..26d64cfe2 100644 --- a/modules/ticket/back/models/specs/sale.spec.js +++ b/modules/ticket/back/models/specs/sale.spec.js @@ -3,7 +3,7 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -fdescribe('sale model ', () => { +describe('sale model ', () => { const ctx = { req: { accessToken: {userId: 9}, diff --git a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js index 1ce55cc91..599851b55 100644 --- a/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js +++ b/modules/travel/back/methods/travel/specs/extraCommunityFilter.spec.js @@ -79,7 +79,7 @@ describe('Travel extraCommunityFilter()', () => { const result = await app.models.Travel.extraCommunityFilter(ctx, filter); - expect(result.length).toEqual(9); + expect(result.length).toEqual(8); }); it('should return the travel matching "cargoSupplierFk"', async() => { diff --git a/modules/travel/back/methods/travel/specs/filter.spec.js b/modules/travel/back/methods/travel/specs/filter.spec.js index 6cb366938..1a6ee895c 100644 --- a/modules/travel/back/methods/travel/specs/filter.spec.js +++ b/modules/travel/back/methods/travel/specs/filter.spec.js @@ -80,6 +80,6 @@ describe('Travel filter()', () => { const result = await app.models.Travel.filter(ctx); - expect(result.length).toEqual(6); + expect(result.length).toEqual(5); }); }); diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js index 6fa780588..efd610562 100644 --- a/modules/worker/back/methods/operator/add.js +++ b/modules/worker/back/methods/operator/add.js @@ -15,7 +15,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const isOperator = await Self.findById(user, myOptions); + const isOperator = await Self.findById(userId, myOptions); if (!isOperator) await Self.create({workerFk: userId}, myOptions); }; }; diff --git a/modules/worker/back/methods/operator/spec/add.spec.js b/modules/worker/back/methods/operator/spec/add.spec.js index 4d26e8ca9..94daae8de 100644 --- a/modules/worker/back/methods/operator/spec/add.spec.js +++ b/modules/worker/back/methods/operator/spec/add.spec.js @@ -1,8 +1,8 @@ const {models} = require('vn-loopback/server/server'); describe('operator add()', () => { - const itBoss = 104; - const noWorker = 100000; + const noOperator = 104; + const operator = 9; beforeAll(async() => { ctx = { @@ -14,18 +14,23 @@ describe('operator add()', () => { }; }); - it('should throw an error if the worker does not exist', async() => { + it('should not add an existent operator', async() => { const tx = await models.Operator.beginTransaction({}); const options = {transaction: tx}; - ctx.req.accessToken.userId = noWorker; + ctx.req.accessToken.userId = operator; try { + const operatorBefore = await models.Operator.find(null, options); + const isOperator = await models.Operator.findOne(null, options); + + expect(isOperator).toBeDefined(); + await models.Operator.add(ctx, options); + const operatorAfter = await models.Operator.find(null, options); + + expect(operatorBefore.length).toEqual(operatorAfter.length); await tx.rollback(); } catch (e) { - const error = e; - - expect(error.message).toEqual('This worker does not exist'); await tx.rollback(); } }); @@ -33,7 +38,7 @@ describe('operator add()', () => { it('should add a new operator successfully', async() => { const tx = await models.Operator.beginTransaction({}); const options = {transaction: tx}; - ctx.req.accessToken.userId = itBoss; + ctx.req.accessToken.userId = noOperator; try { const operatorBefore = await models.Operator.find(null, options); From 9f194f4f63a9421cf0dbba7980b0923459c0b2d0 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 2 Feb 2024 10:28:13 +0100 Subject: [PATCH 113/250] fix: refs #6276 fix model --- modules/ticket/back/models/sale-buy.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/ticket/back/models/sale-buy.json b/modules/ticket/back/models/sale-buy.json index 496a8d6fa..a431f1224 100644 --- a/modules/ticket/back/models/sale-buy.json +++ b/modules/ticket/back/models/sale-buy.json @@ -1,9 +1,6 @@ { "name": "SaleBuy", "base": "VnModel", - "mixins": { - "Loggable": true - }, "options": { "mysql": { "table": "saleBuy" From fa32cf37cd35bb7a9aa625b8f7c070cf12aacf4a Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 2 Feb 2024 14:04:20 +0100 Subject: [PATCH 114/250] refs #6053 cpus --- jest.front.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jest.front.config.js b/jest.front.config.js index 3289df8bb..955f06eca 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -1,7 +1,9 @@ // For a detailed explanation regarding each configuration property, visit: // https://jestjs.io/docs/en/configuration.html /* eslint max-len: ["error", { "code": 150 }]*/ +const cpus = require('os').cpus().length; +const maxCpus = Math.floor(cpus / 5) - 1; module.exports = { name: 'front end', displayName: { @@ -12,6 +14,7 @@ module.exports = { setupFilesAfterEnv: [ './jest-front.js' ], + maxWorkers: maxCpus, testMatch: [ '**/front/**/*.spec.js', '**/print/**/*.spec.js', From 6c9215bb517ea1700a3a0552b46fd38d94d07c48 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 7 Feb 2024 16:52:43 +0100 Subject: [PATCH 115/250] feat(mrw): refs #6403 big commit --- back/methods/mrw-config/createShipment.js | 49 +++++++++---------- back/methods/mrw-config/expeditionData.sql | 27 ++++++++++ .../mrw-config/specs/createShipment.spec.js | 45 +++++++++++++++++ db/changes/240401/00-mrwWebService.sql | 26 ++++------ loopback/locale/es.json | 12 ++++- 5 files changed, 115 insertions(+), 44 deletions(-) create mode 100644 back/methods/mrw-config/expeditionData.sql create mode 100644 back/methods/mrw-config/specs/createShipment.spec.js diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index f6f57e06f..505b7b167 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -2,6 +2,7 @@ const axios = require('axios'); const {DOMParser} = require('xmldom'); const fs = require('fs'); const ejs = require('ejs'); +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('createShipment', { @@ -26,35 +27,20 @@ module.exports = Self => { const models = Self.app.models; const mrw = await models.MrwConfig.findOne(); + if (!mrw) + throw new UserError(`Some mrwConfig parameters are not set`); + const [expeditionData] = await Self.rawSql( - `SELECT CASE co.code - WHEN 'ES' THEN a.postalCode - WHEN 'PT' THEN LEFT(a.postalCode, 4) - WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') - END postalCode, - a.city, - a.street, - co.code countryCode, - c.fi, - c.name clientName, - c.phone, - DATE_FORMAT(e.created, '%d/%m/%Y') created, - e.id expeditionId, - LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, - IFNULL(mw.weekdays, "N") weekDays - FROM expedition e - JOIN packaging pa ON pa.id = e.packagingFk - JOIN ticket t ON e.ticketFk = t.id - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN mrwService ms ON ms.agencyModeCodeFk = am.code - LEFT JOIN mrwServiceWeekday mw ON mw.params = DATE_FORMAT(e.created, '%a') - JOIN client c ON t.clientFk = c.id - JOIN address a ON t.addressFk = a.id - JOIN province p ON a.provinceFk = p.id - JOIN country co ON co.id = p.countryFk - WHERE e.id = ?`, [expeditionFk] + fs.readFileSync(__dirname + '/expeditionData.sql', 'utf-8'), + [expeditionFk] ); + if (!expeditionData) + throw new UserError(`This expedition is not a MRW shipment`); + + if (expeditionData?.created < Date.vnNew()) + throw new UserError(`This ticket has a shipped date earlier than today`); + const shipmentTemplate = fs.readFileSync(__dirname + '/createShipment.ejs', 'utf-8'); const renderedShipment = ejs.render(shipmentTemplate, {mrw, expeditionData}); const shipmentResponse = await axios.post(mrw.url, renderedShipment, { @@ -66,6 +52,11 @@ module.exports = Self => { const shipmentXmlDoc = parser.parseFromString(shipmentResponse.data, 'text/xml'); const shipmentId = shipmentXmlDoc.getElementsByTagName('NumeroEnvio')[0].textContent; + if (!shipmentId) { + const message = shipmentXmlDoc.getElementsByTagName('Mensaje')[0]?.textContent; + throw new UserError(message); + } + const getLabelTemplate = fs.readFileSync(__dirname + '/getLabel.ejs', 'utf-8'); const renderedGetLabel = ejs.render(getLabelTemplate, {mrw, shipmentId}); const getLabelResponse = await axios.post(mrw.url, renderedGetLabel, { @@ -76,6 +67,12 @@ module.exports = Self => { const getLabelXmlDoc = parser.parseFromString(getLabelResponse.data, 'text/xml'); const base64Binary = getLabelXmlDoc.getElementsByTagName('EtiquetaFile')[0]?.textContent; + if (!base64Binary) { + const message = getLabelXmlDoc.getElementsByTagName('Mensaje')[0]?.textContent; + if (!message) + throw new UserError(`The MRW web service is not returning the expected response`); + throw new UserError(message); + } const expedition = await models.Expedition.findById(expeditionFk); await expedition.updateAttribute('externalId', shipmentId); diff --git a/back/methods/mrw-config/expeditionData.sql b/back/methods/mrw-config/expeditionData.sql new file mode 100644 index 000000000..2a325cc27 --- /dev/null +++ b/back/methods/mrw-config/expeditionData.sql @@ -0,0 +1,27 @@ +SELECT CASE co.code + WHEN 'ES' THEN a.postalCode + WHEN 'PT' THEN LEFT(a.postalCode, 4) + WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') + END postalCode, + a.city, + a.street, + co.code countryCode, + c.fi, + c.name clientName, + c.phone, + DATE_FORMAT(t.shipped, '%d/%m/%Y') created, + e.id expeditionId, + LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, + IF(mw.weekdays, 'S', 'N') weekDays + FROM expedition e + JOIN packaging pa ON pa.id = e.packagingFk + JOIN ticket t ON e.ticketFk = t.id + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN mrwService ms ON ms.agencyModeCodeFk = am.code + LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a') + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + JOIN province p ON a.provinceFk = p.id + JOIN country co ON co.id = p.countryFk + WHERE e.id = ? + LIMIT 1 \ No newline at end of file diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js new file mode 100644 index 000000000..2b5d555a1 --- /dev/null +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -0,0 +1,45 @@ +const models = require('vn-loopback/server/server').models; +const axios = require('axios'); + +const expeditionFk = 14; +const mockShipmentId = 'baseMockShipmentId'; +const mockBase64Binary = 'base64BinaryString'; +const ticket1 = { + 'id': '44', + 'clientFk': 1101, + 'shipped': Date.vnNew(), + 'nickname': 'MRW', + 'addressFk': 1, + 'agencyModeFk': 26 +}; + +const expedition1 = { + 'id': 14, + 'agencyModeFk': 26, + 'ticketFk': 44, + 'freightItemFk': 71, + 'created': '2001-01-01', + 'counter': 1, + 'workerFk': 18, + 'packagingFk': '94', + 'hostFk': '', + 'stateTypeFk': 3, + 'hasNewRoute': 0, + 'isBox': 71, + 'editorFk': 100 +}; +fdescribe('MRWConfig createShipment()', () => { + it('should create a shipment and return a base64Binary label', async() => { + const tx = await models.MrwConfig.beginTransaction({}); + const options = {transaction: tx}; + + await models.Ticket.create(ticket1, options); + const expedition = await models.Expedition.create(expedition1, options); + + spyOn(axios, 'post').and.returnValues([{data: mockShipmentId}, {data: mockBase64Binary}]); + + const base64Binary = await models.MrwConfig.createShipment(expedition.id, options); + + expect(base64Binary).toEqual(mockBase64Binary); + }); +}); diff --git a/db/changes/240401/00-mrwWebService.sql b/db/changes/240401/00-mrwWebService.sql index eb6aab887..a3c42ad8b 100644 --- a/db/changes/240401/00-mrwWebService.sql +++ b/db/changes/240401/00-mrwWebService.sql @@ -7,13 +7,19 @@ CREATE TABLE IF NOT EXISTS `vn`.`mrwConfig` ( `subscriberCode` varchar(100) NULL, CONSTRAINT mrwConfig_pk PRIMARY KEY (id) ) -ENGINE=InnoDB +ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; ALTER TABLE `vn`.`packingSite` ADD `hasNewLabelMrwMethod` BOOL NULL; -INSERT INTO vn.mrwService (agencyModeCodeFk, clientType, serviceType, kg) VALUES('mrw', 9731, 205, 10); + +INSERT INTO `vn`.`agency` (`name`,`warehouseFk`,`warehouseAliasFk`,`isOwn`,`isAnyVolumeAllowed`) + VALUES ('MRW',1,1,0,0); + +INSERT INTO `vn`.`agencyMode` (`id`, `name`, `description`, `deliveryMethodFk`, `m3`, `web`, `agencyFk`, `inflation`, `isVolumetric`, `reportMail`, `showAgencyName`, `isActive`, `isExternalAgency`, `flag`, `code`, `isRiskFree`, `hasWeightVolumetric`) + VALUES(26, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0), + (27, 'mrwEcom', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'mrwEcom', 0, 0); INSERT INTO `vn`.`mrwConfig` (`url`, `user`, `password`, `franchiseCode`, `subscriberCode`) VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '04301', '009731'); @@ -24,19 +30,7 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES ('MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee'); +INSERT INTO `vn`.`mrwService` (`agencyModeCodeFk`, `clientType`, `serviceType`, `kg`) VALUES('MRW', 9731, 205, 10); +INSERT INTO `vn`.`mrwServiceWeekday` (`agencyModeCodeFk`, `weekdays`, `serviceType`, `params`) VALUES('mrwEcom', 'sat', 800, 'EntregaSabado=S'); -INSERT INTO `vn`.`agency` (`name`,`warehouseFk`,`warehouseAliasFk`,`isOwn`,`isAnyVolumeAllowed`) - VALUES ('MRW',1,1,0,0); -INSERT INTO `vn`.`agencyMode` (`id`, `name`, `description`, `deliveryMethodFk`, `m3`, `web`, `agencyFk`, `inflation`, `isVolumetric`, `reportMail`, `showAgencyName`, `isActive`, `isExternalAgency`, `flag`, `code`, `isRiskFree`, `hasWeightVolumetric`) - VALUES(25, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0), - (26, 'mrwEcom', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'mrwEcom', 0, 0); - -INSERT INTO `vn`.`ticket` (`id`, `clientFk`, `warehouseFk`, `shipped`, `nickname`, `refFk`, `addressFk`, `workerFk`, `observations`, `isSigned`, `isLabeled`, `isPrinted`, `packages`, `location`, `hour`, `created`, `isBlocked`, `solution`, `routeFk`, `priority`, `hasPriority`, `companyFk`, `agencyModeFk`, `landed`, `isBoxed`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `totalWithVat`, `totalWithoutVat`, `weight`, `clonedFrom`, `cmrFk`, `editorFk`) - VALUES(44, 1101, 1, '2001-01-01 00:00:00.000', 'MRW', NULL, 1, NULL, NULL, 0, 0, 0, 1, NULL, 0, '2001-01-01 00:00:00.000', 1, NULL, 6, NULL, 1, 442, 25, '2001-01-02', 0, 0, 3, 5.00, 1.00, 8.88, 8.07, NULL, NULL, NULL, 100); - -INSERT INTO vn.expedition (agencyModeFk,ticketFk,freightItemFk,created,counter,workerFk,packagingFk,hostFk,stateTypeFk,hasNewRoute,isBox,editorFk) - VALUES (25,44,71, CURDATE(),1,18,'94','',3,0,71,100); - -INSERT INTO vn.mrwService (agencyModeCodeFk, clientType, serviceType, kg) VALUES('MRW', 9731, 205, 10); -INSERT INTO vn.mrwServiceWeekday (agencyModeCodeFk, weekdays, serviceType, params) VALUES('mrwEcom', 'sat', 800, 'EntregaSabado=S'); \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index a8134909e..e0025c5c0 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -329,5 +329,13 @@ "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima", "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", "Cannot past travels with entries": "No se pueden pasar envíos con entradas", - "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}" -} + "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", + "Esa expedición no es mrw": "Esa expedición no es mrw", + "This expedition is not configured as MRW": "This expedition is not configured as MRW", + "Some config parameters are not set": "Some config parameters are not set", + "The MRW web service is not returning the expected response": "The MRW web service is not returning the expected response", + "1) No se han encontrado datos con estos criterios.": "1) No se han encontrado datos con estos criterios.", + "1) Fecha de recogida incorrecta (fecha cerrada).": "1) Fecha de recogida incorrecta (fecha cerrada).", + "1) Falta indicar la Hora Máxima de Recogida en Sábado2) Fecha de recogida incorrecta (fecha cerrada).": "1) Falta indicar la Hora Máxima de Recogida en Sábado2) Fecha de recogida incorrecta (fecha cerrada).", + "1) Falta indicar la Hora Máxima de Recogida en Sábado2) La fecha de recogida solicitada es 10/02/2024.3) El tipo de servicio no está permitido.4) ": "1) Falta indicar la Hora Máxima de Recogida en Sábado2) La fecha de recogida solicitada es 10/02/2024.3) El tipo de servicio no está permitido.4) " +} \ No newline at end of file From b54827a2ad86ee499bba5d3a54d04363aa45fae0 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 8 Feb 2024 07:23:42 +0100 Subject: [PATCH 116/250] refs #5509 feat(EntryDms): add download & upload file --- modules/entry/back/model-config.json | 3 +++ modules/entry/back/models/entry-dms.js | 2 ++ modules/entry/back/models/entry-dms.json | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/entry/back/model-config.json b/modules/entry/back/model-config.json index d6736052b..7b6e23685 100644 --- a/modules/entry/back/model-config.json +++ b/modules/entry/back/model-config.json @@ -2,6 +2,9 @@ "Entry": { "dataSource": "vn" }, + "EntryDms": { + "dataSource": "vn" + }, "EntryContainer": { "dataSource": "entryStorage" }, diff --git a/modules/entry/back/models/entry-dms.js b/modules/entry/back/models/entry-dms.js index b00337968..219f4fcf5 100644 --- a/modules/entry/back/models/entry-dms.js +++ b/modules/entry/back/models/entry-dms.js @@ -2,6 +2,8 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { require('../methods/entry-dms/removeFile')(Self); + require('../methods/entry-dms/downloadFile')(Self); + require('../methods/entry-dms/uploadFile')(Self); Self.rewriteDbError(function(err) { if (err.code === 'ER_DUP_ENTRY') diff --git a/modules/entry/back/models/entry-dms.json b/modules/entry/back/models/entry-dms.json index c43443c85..5bb3194c2 100644 --- a/modules/entry/back/models/entry-dms.json +++ b/modules/entry/back/models/entry-dms.json @@ -1,6 +1,9 @@ { "name": "EntryDms", - "base": "Loggable", + "base": "VnModel", + "mixins": { + "Loggable": true + }, "options": { "mysql": { "table": "entryDms" From 8ad69a62b9a245f9d504dea7688777afcccf227d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 8 Feb 2024 10:08:16 +0100 Subject: [PATCH 117/250] fix: refs #6276 loggable & userId --- loopback/common/mixins/loggable.js | 3 ++- loopback/server/connectors/vn-mysql.js | 6 +++--- modules/ticket/back/methods/sale-tracking/updateTracking.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/loopback/common/mixins/loggable.js b/loopback/common/mixins/loggable.js index 760fdf60a..24243ba68 100644 --- a/loopback/common/mixins/loggable.js +++ b/loopback/common/mixins/loggable.js @@ -1,6 +1,7 @@ const LoopBackContext = require('loopback-context'); async function handleObserve(ctx) { - ctx.options.httpCtx = LoopBackContext.getCurrentContext(); + const httpCtx = LoopBackContext.getCurrentContext(); + ctx.options.userId = httpCtx?.active?.accessToken?.userId; } module.exports = function(Self) { let Mixin = { diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index 737fd94d5..5edef4395 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -275,7 +275,7 @@ class VnMySQL extends MySQL { } invokeMethod(method, args, model, ctx, opts, cb) { - if (!this.isLoggable(model)) + if (!this.isLoggable(model) && !opts?.userId) return super[method].apply(this, args); this.invokeMethodP(method, [...args], model, ctx, opts) @@ -287,11 +287,11 @@ class VnMySQL extends MySQL { let tx; if (!opts.transaction) { tx = await Transaction.begin(this, {}); - opts = Object.assign({transaction: tx, httpCtx: opts.httpCtx}, opts); + opts = Object.assign({transaction: tx}, opts); } try { - const userId = opts.httpCtx && opts.httpCtx.active?.accessToken?.userId; + const {userId} = opts; if (userId) { const user = await Model.app.models.VnUser.findById(userId, {fields: ['name']}, opts); await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts); diff --git a/modules/ticket/back/methods/sale-tracking/updateTracking.js b/modules/ticket/back/methods/sale-tracking/updateTracking.js index 50e117084..f58429790 100644 --- a/modules/ticket/back/methods/sale-tracking/updateTracking.js +++ b/modules/ticket/back/methods/sale-tracking/updateTracking.js @@ -43,7 +43,7 @@ module.exports = Self => { Self.updateTracking = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned = null, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; - const myOptions = {}; + const myOptions = {userId}; let tx; if (typeof options == 'object') From 33cca9bfe8816c1650f73ac8ea074605020beb03 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 8 Feb 2024 14:20:05 +0100 Subject: [PATCH 118/250] fix: refs #6276 assignColletion --- back/methods/collection/assignCollection.js | 6 +-- .../collection/spec/assignCollection.spec.js | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 back/methods/collection/spec/assignCollection.spec.js diff --git a/back/methods/collection/assignCollection.js b/back/methods/collection/assignCollection.js index 67a10df51..575649de8 100644 --- a/back/methods/collection/assignCollection.js +++ b/back/methods/collection/assignCollection.js @@ -20,10 +20,8 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk)', [userId], myOptions); - - const [assignedCollection] = await Self.rawSql('SELECT @vCollectionFk'); - const {'@vCollectionFk': collectionFk} = assignedCollection; + const [info, okPacket, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk', + [userId], myOptions); if (!collectionFk) throw new UserError('There are not picking tickets'); await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions); diff --git a/back/methods/collection/spec/assignCollection.spec.js b/back/methods/collection/spec/assignCollection.spec.js new file mode 100644 index 000000000..e8f3882a3 --- /dev/null +++ b/back/methods/collection/spec/assignCollection.spec.js @@ -0,0 +1,38 @@ +const models = require('vn-loopback/server/server').models; +const LoopBackContext = require('loopback-context'); + +describe('ticket assignCollection()', () => { + let ctx; + let options; + let tx; + beforeEach(async() => { + ctx = { + req: { + accessToken: {userId: 1106}, + headers: {origin: 'http://localhost'}, + __: value => value + }, + args: {} + }; + + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: ctx.req + }); + + options = {transaction: tx}; + tx = await models.Sale.beginTransaction({}); + options.transaction = tx; + }); + + afterEach(async() => { + await tx.rollback(); + }); + + it('should throw an error when there is not picking tickets', async() => { + try { + await models.Collection.assignCollection(ctx, options); + } catch (e) { + expect(e.message).toEqual('There are not picking tickets'); + } + }); +}); From c2fffd1edaf4d45b170f142f56f8182d34e6651d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 8 Feb 2024 14:52:23 +0100 Subject: [PATCH 119/250] fix: refs #6276 drop test --- .../getSalesFromTicketOrCollection.spec.js | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js index 8f2ea4408..50ba69401 100644 --- a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js +++ b/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js @@ -59,24 +59,4 @@ describe('collection getSalesFromTicketOrCollection()', () => { throw e; } }); - - it('should getSalesFromTicketOrCollection', async() => { - const tx = await models.Collection.beginTransaction({}); - - try { - const options = {transaction: tx}; - await models.Ticket.updateAll({id: collectionOrTicketFk}, {shipped: '2001-01-02 00:00:00.000'}, options); - - const ticketTrackingBefore = await models.TicketTracking.find(null, options); - await models.Collection.getSalesFromTicketOrCollection(ctx, - collectionOrTicketFk, false, source, options); - const ticketTrackingAfter = await models.TicketTracking.find(null, options); - - expect(ticketTrackingAfter.length).toEqual(ticketTrackingBefore.length + 1); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); }); From fe79823ce8c0f12f2bbb9ddf417e21c6365f1a4c Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 12 Feb 2024 09:24:37 +0100 Subject: [PATCH 120/250] refs #6403 --- .../mrw-config/specs/createShipment.spec.js | 46 ++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js index 2b5d555a1..b80f023e5 100644 --- a/back/methods/mrw-config/specs/createShipment.spec.js +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -10,12 +10,12 @@ const ticket1 = { 'shipped': Date.vnNew(), 'nickname': 'MRW', 'addressFk': 1, - 'agencyModeFk': 26 + 'agencyModeFk': 999 }; const expedition1 = { 'id': 14, - 'agencyModeFk': 26, + 'agencyModeFk': 999, 'ticketFk': 44, 'freightItemFk': 71, 'created': '2001-01-01', @@ -28,18 +28,52 @@ const expedition1 = { 'isBox': 71, 'editorFk': 100 }; +const tusabeh = async() => { + return {}; +}; + fdescribe('MRWConfig createShipment()', () => { + beforeAll(async() => { + + }); + it('should create a shipment and return a base64Binary label', async() => { - const tx = await models.MrwConfig.beginTransaction({}); - const options = {transaction: tx}; + const options = {transaction: await models.MrwConfig.beginTransaction({})}; + await models.Agency.create( + {'id': 999, 'name': 'mrw'}, + options + ); - await models.Ticket.create(ticket1, options); - const expedition = await models.Expedition.create(expedition1, options); + await models.AgencyMode.create( + {'id': 999, 'name': 'mrw', 'agencyFk': 999, 'code': 'mrw'}, + options + ); + await models.MrwConfig.create( + { + 'url': 'https://url.com', + 'user': 'user', + 'password': 'password', + 'franchiseCode': 'franchiseCode', + 'subscriberCode': 'subscriberCode' + }, options + ); + + await models.Application.rawSql( + `INSERT INTO vn.mrwService + SET agencyModeCodeFk = 'mrw', + clientType = 1, + serviceType = 1, + kg = 1`, null, options + ); + const ticket = models.Ticket.create(ticket1, options); + const expedition = models.Expedition.create(expedition1, options); spyOn(axios, 'post').and.returnValues([{data: mockShipmentId}, {data: mockBase64Binary}]); const base64Binary = await models.MrwConfig.createShipment(expedition.id, options); expect(base64Binary).toEqual(mockBase64Binary); + expect(1).toEqual(1); }); }); + From 5f60f2a00e5ad227541c9682386223c828e7787f Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 12 Feb 2024 15:04:49 +0100 Subject: [PATCH 121/250] refs #5509 feat(EntryDms): add fixtures --- db/dump/fixtures.before.sql | 3 +- db/versions/10841-orangeGalax/00-entryDms.sql | 73 +------------------ .../10841-orangeGalax/00-entryDmsType.vn.sql | 2 + 3 files changed, 8 insertions(+), 70 deletions(-) create mode 100644 db/versions/10841-orangeGalax/00-entryDmsType.vn.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 0b0e53612..66cb59e9d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2408,7 +2408,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`) (17, 'cmr', NULL, NULL, 'cmr'), (18, 'dua', NULL, NULL, 'dua'), (19, 'inmovilizado', NULL, NULL, 'fixedAssets'), - (20, 'Reclamación', 1, 1, 'claim'); + (20, 'Reclamación', 1, 1, 'claim'), + (21, 'Entrada', 1, 1, 'entry'); INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES diff --git a/db/versions/10841-orangeGalax/00-entryDms.sql b/db/versions/10841-orangeGalax/00-entryDms.sql index 2d078d255..d8c495d6d 100644 --- a/db/versions/10841-orangeGalax/00-entryDms.sql +++ b/db/versions/10841-orangeGalax/00-entryDms.sql @@ -10,78 +10,13 @@ CREATE OR REPLACE TABLE `vn`.`entryDms` ( CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; --- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeInsert`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert` --- BEFORE INSERT ON `entryDms` --- FOR EACH ROW --- BEGIN --- SET NEW.editorFk = account.myUser_getId(); --- END $$ --- DELIMITER ; - --- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeUpdate`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate` --- BEFORE UPDATE ON `entryDms` --- FOR EACH ROW --- BEGIN --- SET NEW.editorFk = account.myUser_getId(); --- END $$ --- DELIMITER ; - --- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeDelete`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeDelete` --- BEFORE DELETE ON `entryDms` --- FOR EACH ROW --- BEGIN --- UPDATE dms --- SET dmsTypeFk = (SELECT id --- FROM dmsType --- WHERE `code` = 'trash' --- ) --- WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) --- FROM entryDms --- WHERE dmsFk = OLD.dmsFk --- ) ; --- END $$ --- DELIMITER ; - --- DROP TRIGGER IF EXISTS `vn`.`entryDms_afterDelete`; --- USE `vn`; - --- DELIMITER $$ --- $$ --- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete` --- AFTER DELETE ON `entryDms` --- FOR EACH ROW --- BEGIN --- INSERT INTO entryLog --- SET `action` = 'delete', --- `changedModel` = 'entryDms', --- `changedModelId` = OLD.entryFk, --- `userFk` = account.myUser_getId(); --- END $$ --- DELIMITER ; - - INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WorkerDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), ('Entry', 'uploadFile', 'WRITE', 'ALLOW', 'ROLE', 'employee'); --- UPDATE `salix`.`ACL` --- SET accessType = '*' --- WHERE model = 'ClientDms' --- AND property = '*'; +UPDATE `salix`.`ACL` + SET accessType = '*' + WHERE model = 'ClientDms' + AND property = '*'; diff --git a/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql new file mode 100644 index 000000000..d408ab827 --- /dev/null +++ b/db/versions/10841-orangeGalax/00-entryDmsType.vn.sql @@ -0,0 +1,2 @@ +INSERT INTO `vn`.`dmsType` (code, name, path__, writeRoleFk, readRoleFk, monthToDelete) + VALUES('entry', 'Entrada', '', 1, 1, NULL); From 35df439f14f61e22b6acfbf30ea9ffee2893faf7 Mon Sep 17 00:00:00 2001 From: josepd Date: Tue, 13 Feb 2024 13:19:26 +0100 Subject: [PATCH 122/250] refs#6721 MetodoPagoActivarTrabajadores --- db/routines/vn/procedures/worker_updateBusiness.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/routines/vn/procedures/worker_updateBusiness.sql b/db/routines/vn/procedures/worker_updateBusiness.sql index 274bc3ec0..76c8c9cbb 100644 --- a/db/routines/vn/procedures/worker_updateBusiness.sql +++ b/db/routines/vn/procedures/worker_updateBusiness.sql @@ -23,6 +23,12 @@ BEGIN IF vOldBusinessFk IS NULL THEN CALL account.account_enable(vSelf); + + UPDATE client c + JOIN payMethod pm ON pm.code = 'bankDraft' + SET c.payMethodFk = pm.id + WHERE c.id = vSelf + AND c.iban; END IF; END$$ DELIMITER ; From 9a6af6fe835aa6d8672f820cf805fd164e605aff Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 14 Feb 2024 10:13:45 +0100 Subject: [PATCH 123/250] refs #5878 feat: add glob dependency --- package.json | 1 + pnpm-lock.yaml | 22 ++++------------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 5970e68fb..ffcd353b2 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "form-data": "^4.0.0", "fs-extra": "^5.0.0", "ftps": "^1.2.0", + "glob": "^10.3.10", "gm": "^1.25.0", "got": "^10.7.0", "helmet": "^3.21.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 221008dd9..291a41fd1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ dependencies: ftps: specifier: ^1.2.0 version: 1.2.0 + glob: + specifier: ^10.3.10 + version: 10.3.10 gm: specifier: ^1.25.0 version: 1.25.0 @@ -1622,7 +1625,6 @@ packages: strip-ansi-cjs: /strip-ansi@6.0.1 wrap-ansi: 8.1.0 wrap-ansi-cjs: /wrap-ansi@7.0.0 - dev: true /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} @@ -1910,7 +1912,6 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} requiresBuild: true - dev: true optional: true /@puppeteer/browsers@1.9.1: @@ -3024,7 +3025,6 @@ packages: /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} - dev: true /ansi-styles@2.2.1: resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} @@ -3046,7 +3046,6 @@ packages: /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} - dev: true /ansi-wrap@0.1.0: resolution: {integrity: sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw==} @@ -5204,7 +5203,6 @@ packages: /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - dev: true /ecc-jsbn@0.1.2: resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==} @@ -5263,7 +5261,6 @@ packages: /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} - dev: true /emojis-list@3.0.0: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} @@ -6099,7 +6096,6 @@ packages: dependencies: cross-spawn: 7.0.3 signal-exit: 4.1.0 - dev: true /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} @@ -6493,7 +6489,6 @@ packages: minimatch: 9.0.3 minipass: 7.0.4 path-scurry: 1.10.1 - dev: true /glob@3.2.11: resolution: {integrity: sha512-hVb0zwEZwC1FXSKRPFTeOtN7AArJcJlI6ULGLtrstaswKNlrTJqAA+1lYlSUop4vjA423xlBzqfVS3iWGlqJ+g==} @@ -6508,7 +6503,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.8 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: true @@ -8002,7 +7997,6 @@ packages: '@isaacs/cliui': 8.0.2 optionalDependencies: '@pkgjs/parseargs': 0.11.0 - dev: true /jade@0.26.3: resolution: {integrity: sha512-mkk3vzUHFjzKjpCXeu+IjXeZD+QOTjUUdubgmHtHTDwvAO2ZTkMTTVrapts5CWz3JvJryh/4KWZpjeZrCepZ3A==} @@ -9251,7 +9245,6 @@ packages: /lru-cache@10.2.0: resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} - dev: true /lru-cache@2.7.3: resolution: {integrity: sha512-WpibWJ60c3AgAz8a2iYErDrcT2C7OmKnsWhIcHOjkUHFjkXncJhtLxNSqUmxRxRunpb5I8Vprd7aNSd2NtksJQ==} @@ -9657,7 +9650,6 @@ packages: engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 - dev: true /minimist-options@4.1.0: resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} @@ -9747,7 +9739,6 @@ packages: /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} - dev: true /minizlib@1.3.3: resolution: {integrity: sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==} @@ -10843,7 +10834,6 @@ packages: dependencies: lru-cache: 10.2.0 minipass: 7.0.4 - dev: true /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -12166,7 +12156,6 @@ packages: /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - dev: true /simple-concat@1.0.1: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} @@ -12623,7 +12612,6 @@ packages: eastasianwidth: 0.2.0 emoji-regex: 9.2.2 strip-ansi: 7.1.0 - dev: true /string_decoder@0.10.31: resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} @@ -12670,7 +12658,6 @@ packages: engines: {node: '>=12'} dependencies: ansi-regex: 6.0.1 - dev: true /strip-bom@2.0.0: resolution: {integrity: sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==} @@ -14164,7 +14151,6 @@ packages: ansi-styles: 6.2.1 string-width: 5.1.2 strip-ansi: 7.1.0 - dev: true /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} From 5918c14d41259e9989b63c8a36f0e23612cf5d69 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 14 Feb 2024 10:14:54 +0100 Subject: [PATCH 124/250] refs #5878 feat: replace by any --- modules/client/back/methods/client/updateFiscalData.js | 10 +++++----- .../supplier/back/methods/supplier/updateFiscalData.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 5fd886c32..6ef9f0b38 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -26,11 +26,11 @@ module.exports = Self => { }, { arg: 'street', - type: 'string' + type: 'any' }, { arg: 'postcode', - type: 'string' + type: 'any' }, { arg: 'city', @@ -38,11 +38,11 @@ module.exports = Self => { }, { arg: 'countryFk', - type: 'number' + type: 'any' }, { arg: 'provinceFk', - type: 'number' + type: 'any' }, { arg: 'sageTaxTypeFk', @@ -94,7 +94,7 @@ module.exports = Self => { }, { arg: 'despiteOfClient', - type: 'number' + type: 'any' }, { arg: 'hasIncoterms', diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index c0b860983..713b97cd4 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -46,10 +46,10 @@ module.exports = Self => { type: 'any' }, { arg: 'supplierActivityFk', - type: 'string' + type: 'any' }, { arg: 'healthRegister', - type: 'string' + type: 'any' }, { arg: 'isVies', type: 'boolean' From 2fb68e81c96e750e7817cacc8286b253121d15bf Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 15 Feb 2024 15:17:39 +0100 Subject: [PATCH 125/250] fix: refs #6276 rollback sale --- modules/ticket/back/models/sale.js | 5 ++--- modules/ticket/back/models/specs/sale.spec.js | 19 ------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 035c4cb11..6204e9a02 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -70,8 +70,7 @@ module.exports = Self => { }, ctx.options); if (item.family == 'EMB') return; - const isInPreparing = await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*'); - if (!ctx.isNewInstance && isInPreparing) return; + if (await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*')) return; await models.Sale.rawSql(`CALL catalog_calcFromItem(?,?,?,?)`, [ ticket.landed, @@ -89,7 +88,7 @@ module.exports = Self => { if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return; - if (newQuantity < item.minQuantity && newQuantity != available && !isInPreparing) + if (newQuantity < item.minQuantity && newQuantity != available) throw new UserError('The amount cannot be less than the minimum'); if (ctx.isNewInstance || isReduction) return; diff --git a/modules/ticket/back/models/specs/sale.spec.js b/modules/ticket/back/models/specs/sale.spec.js index 26d64cfe2..d078dc8e2 100644 --- a/modules/ticket/back/models/specs/sale.spec.js +++ b/modules/ticket/back/models/specs/sale.spec.js @@ -233,25 +233,6 @@ describe('sale model ', () => { } }); - it('should change the quantity if it has production role and is not a new instance', async() => { - spyOn(LoopBackContext, 'getCurrentContext').and.returnValue(getActiveCtx(9)); - const tx = await models.Sale.beginTransaction({}); - const options = {transaction: tx}; - - try { - const saleId = 1; - const newQuantity = 10; - - const {quantity} = await models.Collection.setSaleQuantity(saleId, newQuantity, options); - - expect(quantity).toEqual(newQuantity); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - describe('newPrice', () => { it('should increase quantity if you have enough available and the new price is the same as the previous one', async() => { const ctx = { From b6be76c38fec4a38ed1cbd6bb62246e9fd306ce2 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 16 Feb 2024 08:28:40 +0100 Subject: [PATCH 126/250] feat(test): refs #6403 add spec --- back/methods/mrw-config/createShipment.js | 88 +++++++++++-------- back/methods/mrw-config/expeditionData.sql | 3 +- .../mrw-config/specs/createShipment.spec.js | 52 ++++++----- .../mrw-config/specs/mockCreateShipment.xml | 16 ++++ .../methods/mrw-config/specs/mockGetLabel.xml | 14 +++ 5 files changed, 113 insertions(+), 60 deletions(-) create mode 100644 back/methods/mrw-config/specs/mockCreateShipment.xml create mode 100644 back/methods/mrw-config/specs/mockGetLabel.xml diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index 505b7b167..11b9527f1 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -5,7 +5,7 @@ const ejs = require('ejs'); const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethod('createShipment', { + Self.remoteMethodCtx('createShipment', { description: 'Create an expedition and return a base64Binary label', accessType: 'WRITE', accepts: [{ @@ -23,59 +23,71 @@ module.exports = Self => { } }); - Self.createShipment = async expeditionFk => { + Self.createShipment = async(ctx, expeditionFk, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + const models = Self.app.models; - const mrw = await models.MrwConfig.findOne(); + const mrw = await models.MrwConfig.findOne(null, myOptions); + console.log('mrw: ', mrw); if (!mrw) throw new UserError(`Some mrwConfig parameters are not set`); const [expeditionData] = await Self.rawSql( fs.readFileSync(__dirname + '/expeditionData.sql', 'utf-8'), - [expeditionFk] + null, + myOptions ); - + console.log('sigue'); if (!expeditionData) throw new UserError(`This expedition is not a MRW shipment`); if (expeditionData?.created < Date.vnNew()) - throw new UserError(`This ticket has a shipped date earlier than today`); + throw new UserError(`This ticket has a shipped date earlier than today`); po; - const shipmentTemplate = fs.readFileSync(__dirname + '/createShipment.ejs', 'utf-8'); - const renderedShipment = ejs.render(shipmentTemplate, {mrw, expeditionData}); - const shipmentResponse = await axios.post(mrw.url, renderedShipment, { + const shipmentResponse = await sendXmlDoc('createShipment', {mrw, expeditionData}); + + const parser = new DOMParser(); + const shipmentXmlDoc = parser.parseFromString(shipmentResponse, 'text/xml'); + const shipmentId = getTextByTag(shipmentXmlDoc, 'NumeroEnvio'); + + if (!shipmentId) + throw new UserError(getTextByTag(shipmentXmlDoc, 'Mensaje')); + + const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}); + + const getLabelXmlDoc = parser.parseFromString(getLabelResponse, 'text/xml'); + const file = getTextByTag(getLabelXmlDoc, 'EtiquetaFile'); + console.log('file: ', file); + if (!file) { + const message = getTextByTag(getLabelXmlDoc, 'Mensaje') ?? + `The MRW web service is not returning the expected response`; + throw new UserError(message); + } + await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, options); + + return file; + }; + + function getTextByTag(xmlDoc, tag) { + const parser = new DOMParser(); + const doc = parser.parseFromString(xmlDoc?.data, 'text/xml'); + return doc?.getElementsByTagName(tag)[0]?.textContent; + } + + async function sendXmlDoc(xmlDock, params) { + const xmlTemplate = fs.readFileSync(__dirname + `/${xmlDock}.ejs`, 'utf-8'); + const renderedTemplate = ejs.render(xmlTemplate, params); + const {data} = await axios.post(params.mrw.url, renderedTemplate, { headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' } }); - const parser = new DOMParser(); - const shipmentXmlDoc = parser.parseFromString(shipmentResponse.data, 'text/xml'); - const shipmentId = shipmentXmlDoc.getElementsByTagName('NumeroEnvio')[0].textContent; - if (!shipmentId) { - const message = shipmentXmlDoc.getElementsByTagName('Mensaje')[0]?.textContent; - throw new UserError(message); - } - - const getLabelTemplate = fs.readFileSync(__dirname + '/getLabel.ejs', 'utf-8'); - const renderedGetLabel = ejs.render(getLabelTemplate, {mrw, shipmentId}); - const getLabelResponse = await axios.post(mrw.url, renderedGetLabel, { - headers: { - 'Content-Type': 'text/xml; charset=utf-8' - } - }); - const getLabelXmlDoc = parser.parseFromString(getLabelResponse.data, 'text/xml'); - const base64Binary = getLabelXmlDoc.getElementsByTagName('EtiquetaFile')[0]?.textContent; - - if (!base64Binary) { - const message = getLabelXmlDoc.getElementsByTagName('Mensaje')[0]?.textContent; - if (!message) - throw new UserError(`The MRW web service is not returning the expected response`); - throw new UserError(message); - } - const expedition = await models.Expedition.findById(expeditionFk); - await expedition.updateAttribute('externalId', shipmentId); - - return base64Binary; - }; + console.log('data: ', data); + return data; + } }; diff --git a/back/methods/mrw-config/expeditionData.sql b/back/methods/mrw-config/expeditionData.sql index 2a325cc27..0329e29d8 100644 --- a/back/methods/mrw-config/expeditionData.sql +++ b/back/methods/mrw-config/expeditionData.sql @@ -14,7 +14,6 @@ SELECT CASE co.code LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, IF(mw.weekdays, 'S', 'N') weekDays FROM expedition e - JOIN packaging pa ON pa.id = e.packagingFk JOIN ticket t ON e.ticketFk = t.id JOIN agencyMode am ON am.id = t.agencyModeFk JOIN mrwService ms ON ms.agencyModeCodeFk = am.code @@ -23,5 +22,5 @@ SELECT CASE co.code JOIN address a ON t.addressFk = a.id JOIN province p ON a.provinceFk = p.id JOIN country co ON co.id = p.countryFk - WHERE e.id = ? + WHERE e.id = 14 LIMIT 1 \ No newline at end of file diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js index b80f023e5..a843fc167 100644 --- a/back/methods/mrw-config/specs/createShipment.spec.js +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -1,8 +1,7 @@ const models = require('vn-loopback/server/server').models; const axios = require('axios'); +const fs = require('fs'); -const expeditionFk = 14; -const mockShipmentId = 'baseMockShipmentId'; const mockBase64Binary = 'base64BinaryString'; const ticket1 = { 'id': '44', @@ -28,17 +27,11 @@ const expedition1 = { 'isBox': 71, 'editorFk': 100 }; -const tusabeh = async() => { - return {}; -}; +let options; fdescribe('MRWConfig createShipment()', () => { beforeAll(async() => { - - }); - - it('should create a shipment and return a base64Binary label', async() => { - const options = {transaction: await models.MrwConfig.beginTransaction({})}; + options = {transaction: await models.MrwConfig.beginTransaction({})}; await models.Agency.create( {'id': 999, 'name': 'mrw'}, options @@ -61,19 +54,38 @@ fdescribe('MRWConfig createShipment()', () => { await models.Application.rawSql( `INSERT INTO vn.mrwService - SET agencyModeCodeFk = 'mrw', - clientType = 1, - serviceType = 1, - kg = 1`, null, options + SET agencyModeCodeFk = 'mrw', + clientType = 1, + serviceType = 1, + kg = 1`, null, options ); - const ticket = models.Ticket.create(ticket1, options); - const expedition = models.Expedition.create(expedition1, options); - spyOn(axios, 'post').and.returnValues([{data: mockShipmentId}, {data: mockBase64Binary}]); + await models.Ticket.create(ticket1, options); + await models.Expedition.create(expedition1, options); + }); - const base64Binary = await models.MrwConfig.createShipment(expedition.id, options); + it('should create a shipment and return a base64Binary label', async() => { + try { + const returnsValues = [ + {data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')}, + {data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')} + ]; + spyOn(axios, 'post').and.callFake(() => + Promise.resolve(returnsValues.pop()) + ); + const ctx = {args: {isChargedToMana: false}}; + const base64Binary = await models.MrwConfig.createShipment(ctx, expedition1.id, options); - expect(base64Binary).toEqual(mockBase64Binary); - expect(1).toEqual(1); + expect(base64Binary).toEqual(mockBase64Binary); + + await options.transaction.rollback(); + } catch (e) { + await options.transaction.rollback(); + throw e; + } }); }); +async function dbPopulate() { + +} + diff --git a/back/methods/mrw-config/specs/mockCreateShipment.xml b/back/methods/mrw-config/specs/mockCreateShipment.xml new file mode 100644 index 000000000..dacc5d3f3 --- /dev/null +++ b/back/methods/mrw-config/specs/mockCreateShipment.xml @@ -0,0 +1,16 @@ + + + + + + 1 + + 1 + 1 + http://url.com + + + + \ No newline at end of file diff --git a/back/methods/mrw-config/specs/mockGetLabel.xml b/back/methods/mrw-config/specs/mockGetLabel.xml new file mode 100644 index 000000000..0401ce2c7 --- /dev/null +++ b/back/methods/mrw-config/specs/mockGetLabel.xml @@ -0,0 +1,14 @@ + + + + + + 1 + + base64BinaryString + + + + \ No newline at end of file From 85b1391006403f6c3dbbc559d23abd010d2fbfc2 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 16 Feb 2024 08:31:41 +0100 Subject: [PATCH 127/250] fix(sql): refs #6403 merge master --- .../10889-redMedeola/00-firstScript.sql} | 1 + 1 file changed, 1 insertion(+) rename db/{changes/240401/00-mrwWebService.sql => versions/10889-redMedeola/00-firstScript.sql} (98%) diff --git a/db/changes/240401/00-mrwWebService.sql b/db/versions/10889-redMedeola/00-firstScript.sql similarity index 98% rename from db/changes/240401/00-mrwWebService.sql rename to db/versions/10889-redMedeola/00-firstScript.sql index a3c42ad8b..78fdf2917 100644 --- a/db/changes/240401/00-mrwWebService.sql +++ b/db/versions/10889-redMedeola/00-firstScript.sql @@ -1,3 +1,4 @@ +-- Place your SQL code here CREATE TABLE IF NOT EXISTS `vn`.`mrwConfig` ( `id` INT auto_increment NULL, `url` varchar(100) NULL, From 89970e39d0dd57a1217b0cb0d26dcdbfe0706505 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 16 Feb 2024 10:47:41 +0100 Subject: [PATCH 128/250] fix: refs #6276 back tests --- .../ticket/back/methods/ticket/specs/addSaleByCode.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js b/modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js index ce3a5b3ad..b97139178 100644 --- a/modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js +++ b/modules/ticket/back/methods/ticket/specs/addSaleByCode.spec.js @@ -3,7 +3,7 @@ const LoopBackContext = require('loopback-context'); describe('Ticket addSaleByCode()', () => { const quantity = 3; - const ticketFk = 24; + const ticketFk = 13; const warehouseFk = 1; beforeAll(async() => { activeCtx = { @@ -19,7 +19,7 @@ describe('Ticket addSaleByCode()', () => { }); it('should add a new sale', async() => { - const tx = await models.Sale.beginTransaction({}); + const tx = await models.Ticket.beginTransaction({}); try { const options = {transaction: tx}; From 1767ce426aa4eb80e018640a908305b373264d18 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 16 Feb 2024 11:54:59 +0100 Subject: [PATCH 129/250] fix: refs #6276 collection_addItem --- loopback/locale/es.json | 704 +++++++++--------- .../back/methods/ticket/addSaleByCode.js | 14 +- 2 files changed, 356 insertions(+), 362 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f82152f92..e31cfc58b 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,360 +1,348 @@ { - "Phone format is invalid": "El formato del teléfono no es correcto", - "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", - "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", - "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", - "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", - "Can't be blank": "No puede estar en blanco", - "Invalid TIN": "NIF/CIF inválido", - "TIN must be unique": "El NIF/CIF debe ser único", - "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web", - "Is invalid": "Es inválido", - "Quantity cannot be zero": "La cantidad no puede ser cero", - "Enter an integer different to zero": "Introduce un entero distinto de cero", - "Package cannot be blank": "El embalaje no puede estar en blanco", - "The company name must be unique": "La razón social debe ser única", - "Invalid email": "Correo electrónico inválido", - "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", - "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN", - "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC", - "State cannot be blank": "El estado no puede estar en blanco", - "Worker cannot be blank": "El trabajador no puede estar en blanco", - "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", - "can't be blank": "El campo no puede estar vacío", - "Observation type must be unique": "El tipo de observación no puede repetirse", - "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 similar to the last one": "El grade debe ser similar al último", - "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", - "Name cannot be blank": "El nombre no puede estar en blanco", - "Phone cannot be blank": "El teléfono no puede estar en blanco", - "Period cannot be blank": "El periodo no puede estar en blanco", - "Choose a company": "Selecciona una empresa", - "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto", - "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres", - "Cannot be blank": "El campo no puede estar en blanco", - "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero", - "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco", - "Description cannot be blank": "Se debe rellenar el campo de texto", - "The price of the item changed": "El precio del artículo cambió", - "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%", - "The value should be a number": "El valor debe ser un numero", - "This order is not editable": "Esta orden no se puede modificar", - "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", - "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", - "is not a valid date": "No es una fecha valida", - "Barcode must be unique": "El código de barras debe ser único", - "The warehouse can't be repeated": "El almacén no puede repetirse", - "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", - "The observation type can't be repeated": "El tipo de observación no puede repetirse", - "A claim with that sale already exists": "Ya existe una reclamación para esta línea", - "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", - "Warehouse cannot be blank": "El almacén no puede quedar en blanco", - "Agency cannot be blank": "La agencia no puede quedar en blanco", - "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", - "This address doesn't exist": "Este consignatario no existe", - "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", - "You don't have enough privileges": "No tienes suficientes permisos", - "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF", - "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos", - "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ", - "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", - "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo", - "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", - "ORDER_EMPTY": "Cesta vacía", - "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", - "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", - "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", - "Street cannot be empty": "Dirección no puede estar en blanco", - "City cannot be empty": "Ciudad no puede estar en blanco", - "Code cannot be blank": "Código no puede estar en blanco", - "You cannot remove this department": "No puedes eliminar este departamento", - "The extension must be unique": "La extensión debe ser unica", - "The secret can't be blank": "La contraseña no puede estar en blanco", - "We weren't able to send this SMS": "No hemos podido enviar el SMS", - "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", - "This ticket can't be invoiced": "Este ticket no puede ser facturado", - "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", - "This ticket can not be modified": "Este ticket no puede ser modificado", - "The introduced hour already exists": "Esta hora ya ha sido introducida", - "INFINITE_LOOP": "Existe una dependencia entre dos Jefes", - "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas", - "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros", - "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado", - "The current ticket can't be modified": "El ticket actual no puede ser modificado", - "The current claim can't be modified": "La reclamación actual no puede ser modificada", - "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", - "Please select at least one sale": "Por favor selecciona al menos una linea", - "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", - "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", - "This item doesn't exists": "El artículo no existe", - "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", - "Extension format is invalid": "El formato de la extensión es inválido", - "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket", - "This item is not available": "Este artículo no está disponible", - "This postcode already exists": "Este código postal ya existe", - "Concept cannot be blank": "El concepto no puede quedar en blanco", - "File doesn't exists": "El archivo no existe", - "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", - "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", - "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", - "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", - "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", - "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", - "Invalid quantity": "Cantidad invalida", - "This postal code is not valid": "Este código postal no es válido", - "is invalid": "es inválido", - "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", - "The department name can't be repeated": "El nombre del departamento no puede repetirse", - "This phone already exists": "Este teléfono ya existe", - "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", - "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", - "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada", - "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero", - "You should specify a date": "Debes especificar una fecha", - "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin", - "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin", - "You should mark at least one week day": "Debes marcar al menos un día de la semana", - "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", - "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", - "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", - "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", - "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", - "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})", - "State": "Estado", - "regular": "normal", - "reserved": "reservado", - "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})", - "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}", - "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", - "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", - "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", - "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", - "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*", - "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", - "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", - "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000", - "This ticket is deleted": "Este ticket está eliminado", - "Unable to clone this travel": "No ha sido posible clonar este travel", - "This thermograph id already exists": "La id del termógrafo ya existe", - "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", - "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA", - "Invalid password": "Invalid password", - "Password does not meet requirements": "La contraseña no cumple los requisitos", - "Role already assigned": "Rol ya asignado", - "Invalid role name": "Nombre de rol no válido", - "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase", - "Email already exists": "El correo ya existe", - "User already exists": "El/La usuario/a ya existe", - "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral", - "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", - "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", - "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", - "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", - "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})", - "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación", - "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "agencyModeFk": "Agencia", - "clientFk": "Cliente", - "zoneFk": "Zona", - "warehouseFk": "Almacén", - "shipped": "F. envío", - "landed": "F. entrega", - "addressFk": "Consignatario", - "companyFk": "Empresa", - "The social name cannot be empty": "La razón social no puede quedar en blanco", - "The nif cannot be empty": "El NIF no puede quedar en blanco", - "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", - "ASSIGN_ZONE_FIRST": "Asigna una zona primero", - "Amount cannot be zero": "El importe no puede ser cero", - "Company has to be official": "Empresa inválida", - "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", - "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", - "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", - "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", - "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", - "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", - "This BIC already exist.": "Este BIC ya existe.", - "That item doesn't exists": "Ese artículo no existe", - "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", - "Invalid account": "Cuenta inválida", - "Compensation account is empty": "La cuenta para compensar está vacia", - "This genus already exist": "Este genus ya existe", - "This specie already exist": "Esta especie ya existe", - "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})", - "None": "Ninguno", - "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", - "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'", - "This document already exists on this ticket": "Este documento ya existe en el ticket", - "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", - "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", - "nickname": "nickname", - "INACTIVE_PROVIDER": "Proveedor inactivo", - "This client is not invoiceable": "Este cliente no es facturable", - "serial non editable": "Esta serie no permite asignar la referencia", - "Max shipped required": "La fecha límite es requerida", - "Can't invoice to future": "No se puede facturar a futuro", - "Can't invoice to past": "No se puede facturar a pasado", - "This ticket is already invoiced": "Este ticket ya está facturado", - "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", - "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", - "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", - "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", - "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", - "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", - "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", - "Amounts do not match": "Las cantidades no coinciden", - "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", - "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", - "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días", - "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día", - "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día", - "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", - "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres", - "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", - "You don't have privileges to create refund": "No tienes permisos para crear un abono", - "The item is required": "El artículo es requerido", - "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", - "date in the future": "Fecha en el futuro", - "reference duplicated": "Referencia duplicada", - "This ticket is already a refund": "Este ticket ya es un abono", - "isWithoutNegatives": "Sin negativos", - "routeFk": "routeFk", - "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", - "No hay un contrato en vigor": "No hay un contrato en vigor", - "No se permite fichar a futuro": "No se permite fichar a futuro", - "No está permitido trabajar": "No está permitido trabajar", - "Fichadas impares": "Fichadas impares", - "Descanso diario 12h.": "Descanso diario 12h.", - "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", - "Dirección incorrecta": "Dirección incorrecta", - "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", - "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", - "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", - "This route does not exists": "Esta ruta no existe", - "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", - "You don't have grant privilege": "No tienes privilegios para dar privilegios", - "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", - "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", - "Already has this status": "Ya tiene este estado", - "There aren't records for this week": "No existen registros para esta semana", - "Empty data source": "Origen de datos vacio", - "App locked": "Aplicación bloqueada por el usuario {{userId}}", - "Email verify": "Correo de verificación", - "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", - "Receipt's bank was not found": "No se encontró el banco del recibo", - "This receipt was not compensated": "Este recibo no ha sido compensado", - "Client's email was not found": "No se encontró el email del cliente", - "Negative basis": "Base negativa", - "This worker code already exists": "Este codigo de trabajador ya existe", - "This personal mail already exists": "Este correo personal ya existe", - "This worker already exists": "Este trabajador ya existe", - "App name does not exist": "El nombre de aplicación no es válido", - "Try again": "Vuelve a intentarlo", - "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", - "Failed to upload delivery note": "Error al subir albarán {{id}}", - "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", - "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", - "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", - "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", - "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", - "There is no assigned email for this client": "No hay correo asignado para este cliente", - "Exists an invoice with a future date": "Existe una factura con fecha posterior", - "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", - "Warehouse inventory not set": "El almacén inventario no está establecido", - "This locker has already been assigned": "Esta taquilla ya ha sido asignada", - "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d", - "Not exist this branch": "La rama no existe", - "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", - "Collection does not exist": "La colección no existe", - "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", - "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Invalid auth code": "Código de verificación incorrecto", - "Invalid or expired verification code": "Código de verificación incorrecto o expirado", - "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", - "company": "Compañía", - "country": "País", - "clientId": "Id cliente", - "clientSocialName": "Cliente", - "amount": "Importe", - "taxableBase": "Base", - "ticketFk": "Id ticket", - "isActive": "Activo", - "hasToInvoice": "Facturar", - "isTaxDataChecked": "Datos comprobados", - "comercialId": "Id comercial", - "comercialName": "Comercial", - "Pass expired": "La contraseña ha caducado, cambiela desde Salix", - "Invalid NIF for VIES": "Invalid NIF for VIES", - "Ticket does not exist": "Este ticket no existe", - "Ticket is already signed": "Este ticket ya ha sido firmado", - "Authentication failed": "Autenticación fallida", - "You can't use the same password": "No puedes usar la misma contraseña", - "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono", - "Fecha fuera de rango": "Fecha fuera de rango", - "Error while generating PDF": "Error al generar PDF", - "Error when sending mail to client": "Error al enviar el correo al cliente", - "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", - "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", - "Valid priorities": "Prioridades válidas: %d", - "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}", - "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", - "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s", - "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", - "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", - "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", - "You don't have enough privileges.": "No tienes suficientes permisos.", - "This ticket is locked": "Este ticket está bloqueado.", - "This ticket is not editable.": "Este ticket no es editable.", - "The ticket doesn't exist.": "No existe el ticket.", - "Social name should be uppercase": "La razón social debe ir en mayúscula", - "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", - "Ticket without Route": "Ticket sin ruta", - "Select a different client": "Seleccione un cliente distinto", - "Fill all the fields": "Rellene todos los campos", - "The response is not a PDF": "La respuesta no es un PDF", - "Booking completed": "Reserva completada", - "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", - "Incoterms data for consignee is missing": "Faltan los datos de los Incoterms para el consignatario", - "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada", - "User disabled": "Usuario desactivado", - "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima", - "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", - "Cannot past travels with entries": "No se pueden pasar envíos con entradas", - "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", - "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada", - "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", - "Incorrect pin": "Pin incorrecto", - "You already have the mailAlias": "Ya tienes este alias de correo", - "The alias cant be modified": "Este alias de correo no puede ser modificado", - "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", - "Name should be uppercase": "El nombre debe ir en mayúscula", - "Bank entity must be specified": "La entidad bancaria es obligatoria", - "An email is necessary": "Es necesario un email", - "You cannot update these fields": "No puedes actualizar estos campos", - "CountryFK cannot be empty": "El país no puede estar vacío", - "Cmr file does not exist": "El archivo del cmr no existe", - "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", + "Phone format is invalid": "El formato del teléfono no es correcto", + "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", + "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", + "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", + "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", + "Can't be blank": "No puede estar en blanco", + "Invalid TIN": "NIF/CIF inválido", + "TIN must be unique": "El NIF/CIF debe ser único", + "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web", + "Is invalid": "Es inválido", + "Quantity cannot be zero": "La cantidad no puede ser cero", + "Enter an integer different to zero": "Introduce un entero distinto de cero", + "Package cannot be blank": "El embalaje no puede estar en blanco", + "The company name must be unique": "La razón social debe ser única", + "Invalid email": "Correo electrónico inválido", + "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", + "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN", + "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC", + "State cannot be blank": "El estado no puede estar en blanco", + "Worker cannot be blank": "El trabajador no puede estar en blanco", + "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", + "can't be blank": "El campo no puede estar vacío", + "Observation type must be unique": "El tipo de observación no puede repetirse", + "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 similar to the last one": "El grade debe ser similar al último", + "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", + "Name cannot be blank": "El nombre no puede estar en blanco", + "Phone cannot be blank": "El teléfono no puede estar en blanco", + "Period cannot be blank": "El periodo no puede estar en blanco", + "Choose a company": "Selecciona una empresa", + "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto", + "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres", + "Cannot be blank": "El campo no puede estar en blanco", + "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero", + "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco", + "Description cannot be blank": "Se debe rellenar el campo de texto", + "The price of the item changed": "El precio del artículo cambió", + "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%", + "The value should be a number": "El valor debe ser un numero", + "This order is not editable": "Esta orden no se puede modificar", + "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", + "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", + "is not a valid date": "No es una fecha valida", + "Barcode must be unique": "El código de barras debe ser único", + "The warehouse can't be repeated": "El almacén no puede repetirse", + "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", + "The observation type can't be repeated": "El tipo de observación no puede repetirse", + "A claim with that sale already exists": "Ya existe una reclamación para esta línea", + "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", + "Warehouse cannot be blank": "El almacén no puede quedar en blanco", + "Agency cannot be blank": "La agencia no puede quedar en blanco", + "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", + "This address doesn't exist": "Este consignatario no existe", + "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", + "You don't have enough privileges": "No tienes suficientes permisos", + "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF", + "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos", + "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ", + "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", + "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo", + "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", + "ORDER_EMPTY": "Cesta vacía", + "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", + "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", + "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", + "Street cannot be empty": "Dirección no puede estar en blanco", + "City cannot be empty": "Ciudad no puede estar en blanco", + "Code cannot be blank": "Código no puede estar en blanco", + "You cannot remove this department": "No puedes eliminar este departamento", + "The extension must be unique": "La extensión debe ser unica", + "The secret can't be blank": "La contraseña no puede estar en blanco", + "We weren't able to send this SMS": "No hemos podido enviar el SMS", + "This client can't be invoiced": "Este cliente no puede ser facturado", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "This ticket can't be invoiced": "Este ticket no puede ser facturado", + "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", + "This ticket can not be modified": "Este ticket no puede ser modificado", + "The introduced hour already exists": "Esta hora ya ha sido introducida", + "INFINITE_LOOP": "Existe una dependencia entre dos Jefes", + "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas", + "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros", + "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado", + "The current ticket can't be modified": "El ticket actual no puede ser modificado", + "The current claim can't be modified": "La reclamación actual no puede ser modificada", + "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", + "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", + "Please select at least one sale": "Por favor selecciona al menos una linea", + "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", + "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "This item doesn't exists": "El artículo no existe", + "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "Extension format is invalid": "El formato de la extensión es inválido", + "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket", + "This item is not available": "Este artículo no está disponible", + "This postcode already exists": "Este código postal ya existe", + "Concept cannot be blank": "El concepto no puede quedar en blanco", + "File doesn't exists": "El archivo no existe", + "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", + "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", + "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", + "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", + "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", + "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", + "Invalid quantity": "Cantidad invalida", + "This postal code is not valid": "Este código postal no es válido", + "is invalid": "es inválido", + "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", + "The department name can't be repeated": "El nombre del departamento no puede repetirse", + "This phone already exists": "Este teléfono ya existe", + "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", + "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", + "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada", + "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero", + "You should specify a date": "Debes especificar una fecha", + "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin", + "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin", + "You should mark at least one week day": "Debes marcar al menos un día de la semana", + "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", + "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", + "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", + "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", + "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", + "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})", + "State": "Estado", + "regular": "normal", + "reserved": "reservado", + "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})", + "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}", + "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", + "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", + "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", + "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", + "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*", + "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", + "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", + "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", + "This ticket is deleted": "Este ticket está eliminado", + "Unable to clone this travel": "No ha sido posible clonar este travel", + "This thermograph id already exists": "La id del termógrafo ya existe", + "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", + "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA", + "Invalid password": "Invalid password", + "Password does not meet requirements": "La contraseña no cumple los requisitos", + "Role already assigned": "Rol ya asignado", + "Invalid role name": "Nombre de rol no válido", + "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase", + "Email already exists": "El correo ya existe", + "User already exists": "El/La usuario/a ya existe", + "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral", + "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", + "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", + "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", + "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", + "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})", + "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación", + "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "agencyModeFk": "Agencia", + "clientFk": "Cliente", + "zoneFk": "Zona", + "warehouseFk": "Almacén", + "shipped": "F. envío", + "landed": "F. entrega", + "addressFk": "Consignatario", + "companyFk": "Empresa", + "The social name cannot be empty": "La razón social no puede quedar en blanco", + "The nif cannot be empty": "El NIF no puede quedar en blanco", + "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", + "ASSIGN_ZONE_FIRST": "Asigna una zona primero", + "Amount cannot be zero": "El importe no puede ser cero", + "Company has to be official": "Empresa inválida", + "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", + "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", + "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", + "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", + "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", + "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", + "This BIC already exist.": "Este BIC ya existe.", + "That item doesn't exists": "Ese artículo no existe", + "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", + "Invalid account": "Cuenta inválida", + "Compensation account is empty": "La cuenta para compensar está vacia", + "This genus already exist": "Este genus ya existe", + "This specie already exist": "Esta especie ya existe", + "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})", + "None": "Ninguno", + "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", + "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'", + "This document already exists on this ticket": "Este documento ya existe en el ticket", + "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", + "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", + "nickname": "nickname", + "INACTIVE_PROVIDER": "Proveedor inactivo", + "This client is not invoiceable": "Este cliente no es facturable", + "serial non editable": "Esta serie no permite asignar la referencia", + "Max shipped required": "La fecha límite es requerida", + "Can't invoice to future": "No se puede facturar a futuro", + "Can't invoice to past": "No se puede facturar a pasado", + "This ticket is already invoiced": "Este ticket ya está facturado", + "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", + "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", + "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", + "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", + "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", + "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", + "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", + "Amounts do not match": "Las cantidades no coinciden", + "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", + "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", + "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días", + "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día", + "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día", + "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", + "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres", + "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", + "You don't have privileges to create refund": "No tienes permisos para crear un abono", + "The item is required": "El artículo es requerido", + "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", + "date in the future": "Fecha en el futuro", + "reference duplicated": "Referencia duplicada", + "This ticket is already a refund": "Este ticket ya es un abono", + "isWithoutNegatives": "Sin negativos", + "routeFk": "routeFk", + "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", + "No hay un contrato en vigor": "No hay un contrato en vigor", + "No se permite fichar a futuro": "No se permite fichar a futuro", + "No está permitido trabajar": "No está permitido trabajar", + "Fichadas impares": "Fichadas impares", + "Descanso diario 12h.": "Descanso diario 12h.", + "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", + "Dirección incorrecta": "Dirección incorrecta", + "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", + "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", + "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", + "This route does not exists": "Esta ruta no existe", + "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", + "You don't have grant privilege": "No tienes privilegios para dar privilegios", + "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "Already has this status": "Ya tiene este estado", + "There aren't records for this week": "No existen registros para esta semana", + "Empty data source": "Origen de datos vacio", + "App locked": "Aplicación bloqueada por el usuario {{userId}}", + "Email verify": "Correo de verificación", + "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", + "Receipt's bank was not found": "No se encontró el banco del recibo", + "This receipt was not compensated": "Este recibo no ha sido compensado", + "Client's email was not found": "No se encontró el email del cliente", + "Negative basis": "Base negativa", + "This worker code already exists": "Este codigo de trabajador ya existe", + "This personal mail already exists": "Este correo personal ya existe", + "This worker already exists": "Este trabajador ya existe", + "App name does not exist": "El nombre de aplicación no es válido", + "Try again": "Vuelve a intentarlo", + "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", + "Failed to upload delivery note": "Error al subir albarán {{id}}", + "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", + "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", + "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", + "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", + "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", + "There is no assigned email for this client": "No hay correo asignado para este cliente", + "Exists an invoice with a future date": "Existe una factura con fecha posterior", + "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", + "Warehouse inventory not set": "El almacén inventario no está establecido", + "This locker has already been assigned": "Esta taquilla ya ha sido asignada", + "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d", + "Not exist this branch": "La rama no existe", + "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", + "Collection does not exist": "La colección no existe", + "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", + "Insert a date range": "Inserte un rango de fechas", + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Invalid auth code": "Código de verificación incorrecto", + "Invalid or expired verification code": "Código de verificación incorrecto o expirado", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", + "company": "Compañía", + "country": "País", + "clientId": "Id cliente", + "clientSocialName": "Cliente", + "amount": "Importe", + "taxableBase": "Base", + "ticketFk": "Id ticket", + "isActive": "Activo", + "hasToInvoice": "Facturar", + "isTaxDataChecked": "Datos comprobados", + "comercialId": "Id comercial", + "comercialName": "Comercial", + "Pass expired": "La contraseña ha caducado, cambiela desde Salix", + "Invalid NIF for VIES": "Invalid NIF for VIES", + "Ticket does not exist": "Este ticket no existe", + "Ticket is already signed": "Este ticket ya ha sido firmado", + "Authentication failed": "Autenticación fallida", + "You can't use the same password": "No puedes usar la misma contraseña", + "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono", + "Fecha fuera de rango": "Fecha fuera de rango", + "Error while generating PDF": "Error al generar PDF", + "Error when sending mail to client": "Error al enviar el correo al cliente", + "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", + "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", + "Valid priorities": "Prioridades válidas: %d", + "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}", + "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}", + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s", + "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", + "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", + "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", + "You don't have enough privileges.": "No tienes suficientes permisos.", + "This ticket is locked": "Este ticket está bloqueado.", + "This ticket is not editable.": "Este ticket no es editable.", + "The ticket doesn't exist.": "No existe el ticket.", + "Social name should be uppercase": "La razón social debe ir en mayúscula", + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", + "Ticket without Route": "Ticket sin ruta", + "Select a different client": "Seleccione un cliente distinto", + "Fill all the fields": "Rellene todos los campos", + "The response is not a PDF": "La respuesta no es un PDF", + "Booking completed": "Reserva completada", + "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", + "Incoterms data for consignee is missing": "Faltan los datos de los Incoterms para el consignatario", + "The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada", + "User disabled": "Usuario desactivado", + "The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima", + "quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima", + "Cannot past travels with entries": "No se pueden pasar envíos con entradas", + "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", + "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada", + "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", + "Incorrect pin": "Pin incorrecto", + "You already have the mailAlias": "Ya tienes este alias de correo", + "The alias cant be modified": "Este alias de correo no puede ser modificado", "No tickets to invoice": "No hay tickets para facturar", - "This machine is already in use.": "Esta máquina ya está en uso.", - "the plate does not exist": "La máquina {{plate}} no existe", - "We do not have availability for the selected item": "No tenemos disponible el item seleccionado", - "You are already using a machine": "Ya estás usando una máquina.", - "this state does not exist": "Este estado no existe", - "The line could not be marked": "No se ha podido marcar la línea", - "The sale cannot be tracked": "La línea no puede ser rastreada", - "Shelving not valid": "Carro no válido", - "printerNotExists": "No existe la impresora", - "There are not picking tickets": "No hay tickets para sacar", - "ticketCommercial": "El ticket {{ticket}} del comercial {{salesMan}} está en preparación.(mensaje creado automáticamente)", - -} + "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", + "Name should be uppercase": "El nombre debe ir en mayúscula", + "Bank entity must be specified": "La entidad bancaria es obligatoria", + "An email is necessary": "Es necesario un email", + "You cannot update these fields": "No puedes actualizar estos campos", + "CountryFK cannot be empty": "El país no puede estar vacío", + "Cmr file does not exist": "El archivo del cmr no existe", + "We do not have availability for the selected item": "No tenemos disponible el artículo seleccionado" +} \ No newline at end of file diff --git a/modules/ticket/back/methods/ticket/addSaleByCode.js b/modules/ticket/back/methods/ticket/addSaleByCode.js index 5c63b465e..cb3bcccd3 100644 --- a/modules/ticket/back/methods/ticket/addSaleByCode.js +++ b/modules/ticket/back/methods/ticket/addSaleByCode.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('addSaleByCode', { description: 'Add a collection', @@ -15,6 +16,10 @@ module.exports = Self => { arg: 'ticketFk', type: 'number', required: true + }, { + arg: 'warehouseFk', + type: 'number', + required: true }, ], @@ -24,8 +29,7 @@ module.exports = Self => { }, }); - Self.addSaleByCode = async(ctx, code, quantity, ticketFk, options) => { - const models = Self.app.models; + Self.addSaleByCode = async(ctx, code, quantity, ticketFk, warehouseFk, options) => { const myOptions = {}; let tx; @@ -38,8 +42,10 @@ module.exports = Self => { } try { - const [{itemFk}] = await Self.rawSql('SELECT barcodeToItem(?) itemFk', [code], myOptions); - await models.Ticket.addSale(ctx, ticketFk, itemFk, quantity, myOptions); + const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk], myOptions); + if (!item?.available) throw new UserError('We do not have availability for the selected item'); + + await Self.rawSql('CALL vn.collection_addItem(?, ?, ?)', [item.id, quantity, ticketFk], myOptions); if (tx) await tx.commit(); } catch (e) { From c10cb7c051de6e055002b74e0dc6d709ac4cf9e5 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 16 Feb 2024 14:15:13 +0100 Subject: [PATCH 130/250] feat(spec): refs #6403 mrwIntegration --- back/methods/mrw-config/createShipment.js | 90 +++++++++++-------- back/methods/mrw-config/expeditionData.sql | 26 ------ .../mrw-config/specs/createShipment.spec.js | 67 +++++++++----- .../10889-redMedeola/00-firstScript.sql | 13 --- 4 files changed, 99 insertions(+), 97 deletions(-) delete mode 100644 back/methods/mrw-config/expeditionData.sql diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index 11b9527f1..be3dbd96e 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -5,7 +5,7 @@ const ejs = require('ejs'); const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('createShipment', { + Self.remoteMethod('createShipment', { description: 'Create an expedition and return a base64Binary label', accessType: 'WRITE', accepts: [{ @@ -23,71 +23,89 @@ module.exports = Self => { } }); - Self.createShipment = async(ctx, expeditionFk, options) => { + Self.createShipment = async(expeditionFk, options) => { const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); + if (!myOptions.transaction) + myOptions.transaction = await Self.beginTransaction({}); + const models = Self.app.models; const mrw = await models.MrwConfig.findOne(null, myOptions); - console.log('mrw: ', mrw); if (!mrw) throw new UserError(`Some mrwConfig parameters are not set`); - const [expeditionData] = await Self.rawSql( - fs.readFileSync(__dirname + '/expeditionData.sql', 'utf-8'), - null, - myOptions - ); - console.log('sigue'); + const query = + `SELECT CASE co.code + WHEN 'ES' THEN a.postalCode + WHEN 'PT' THEN LEFT(a.postalCode, 4) + WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') + END postalCode, + a.city, + a.street, + co.code countryCode, + c.fi, + c.name clientName, + c.phone, + DATE_FORMAT(t.shipped, '%d/%m/%Y') created, + t.shipped, + e.id expeditionId, + LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, + IF(mw.weekdays, 'S', 'N') weekDays + FROM expedition e + JOIN ticket t ON e.ticketFk = t.id + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN mrwService ms ON ms.agencyModeCodeFk = am.code + LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a') + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + JOIN province p ON a.provinceFk = p.id + JOIN country co ON co.id = p.countryFk + WHERE e.id = ? + LIMIT 1`; + + const [expeditionData] = await Self.rawSql(query, [expeditionFk], myOptions); + if (!expeditionData) throw new UserError(`This expedition is not a MRW shipment`); - if (expeditionData?.created < Date.vnNew()) - throw new UserError(`This ticket has a shipped date earlier than today`); po; + const today = Date.vnNew(); + today.setHours(0, 0, 0, 0); + if (expeditionData?.shipped.setHours(0, 0, 0, 0) < today) + throw new UserError(`This ticket has a shipped date earlier than today`); - const shipmentResponse = await sendXmlDoc('createShipment', {mrw, expeditionData}); - - const parser = new DOMParser(); - const shipmentXmlDoc = parser.parseFromString(shipmentResponse, 'text/xml'); - const shipmentId = getTextByTag(shipmentXmlDoc, 'NumeroEnvio'); + const shipmentResponse = await sendXmlDoc('createShipment', {mrw, expeditionData}, 'application/soap+xml'); + const shipmentId = getTextByTag(shipmentResponse, 'NumeroEnvio'); if (!shipmentId) - throw new UserError(getTextByTag(shipmentXmlDoc, 'Mensaje')); + throw new UserError(getTextByTag(shipmentResponse, 'Mensaje')); - const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}); + const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml'); + const file = getTextByTag(getLabelResponse, 'EtiquetaFile'); - const getLabelXmlDoc = parser.parseFromString(getLabelResponse, 'text/xml'); - const file = getTextByTag(getLabelXmlDoc, 'EtiquetaFile'); - console.log('file: ', file); - if (!file) { - const message = getTextByTag(getLabelXmlDoc, 'Mensaje') ?? - `The MRW web service is not returning the expected response`; - throw new UserError(message); - } - await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, options); + await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions); + await myOptions.transaction.commit(); return file; }; function getTextByTag(xmlDoc, tag) { - const parser = new DOMParser(); - const doc = parser.parseFromString(xmlDoc?.data, 'text/xml'); - return doc?.getElementsByTagName(tag)[0]?.textContent; + return xmlDoc?.getElementsByTagName(tag)[0]?.textContent; } - async function sendXmlDoc(xmlDock, params) { + async function sendXmlDoc(xmlDock, params, contentType) { + const parser = new DOMParser(); + const xmlTemplate = fs.readFileSync(__dirname + `/${xmlDock}.ejs`, 'utf-8'); const renderedTemplate = ejs.render(xmlTemplate, params); - const {data} = await axios.post(params.mrw.url, renderedTemplate, { + const data = await axios.post(params.mrw.url, renderedTemplate, { headers: { - 'Content-Type': 'application/soap+xml; charset=utf-8' + 'Content-Type': `${contentType}; charset=utf-8` } }); - - console.log('data: ', data); - return data; + return parser.parseFromString(data.data, 'text/xml'); } }; diff --git a/back/methods/mrw-config/expeditionData.sql b/back/methods/mrw-config/expeditionData.sql deleted file mode 100644 index 0329e29d8..000000000 --- a/back/methods/mrw-config/expeditionData.sql +++ /dev/null @@ -1,26 +0,0 @@ -SELECT CASE co.code - WHEN 'ES' THEN a.postalCode - WHEN 'PT' THEN LEFT(a.postalCode, 4) - WHEN 'AD' THEN REPLACE(a.postalCode, 'AD', '00') - END postalCode, - a.city, - a.street, - co.code countryCode, - c.fi, - c.name clientName, - c.phone, - DATE_FORMAT(t.shipped, '%d/%m/%Y') created, - e.id expeditionId, - LPAD(IF(mw.params IS NULL, ms.serviceType, mw.serviceType), 4 ,'0') serviceType, - IF(mw.weekdays, 'S', 'N') weekDays - FROM expedition e - JOIN ticket t ON e.ticketFk = t.id - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN mrwService ms ON ms.agencyModeCodeFk = am.code - LEFT JOIN mrwServiceWeekday mw ON mw.weekdays = DATE_FORMAT(t.shipped, '%a') - JOIN client c ON t.clientFk = c.id - JOIN address a ON t.addressFk = a.id - JOIN province p ON a.provinceFk = p.id - JOIN country co ON co.id = p.countryFk - WHERE e.id = 14 - LIMIT 1 \ No newline at end of file diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js index a843fc167..5babadb78 100644 --- a/back/methods/mrw-config/specs/createShipment.spec.js +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -13,7 +13,7 @@ const ticket1 = { }; const expedition1 = { - 'id': 14, + 'id': 17, 'agencyModeFk': 999, 'ticketFk': 44, 'freightItemFk': 71, @@ -27,6 +27,11 @@ const expedition1 = { 'isBox': 71, 'editorFk': 100 }; + +const returnsValues = [ + {data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')}, + {data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')} +]; let options; fdescribe('MRWConfig createShipment()', () => { @@ -64,28 +69,46 @@ fdescribe('MRWConfig createShipment()', () => { }); it('should create a shipment and return a base64Binary label', async() => { - try { - const returnsValues = [ - {data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')}, - {data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')} - ]; - spyOn(axios, 'post').and.callFake(() => - Promise.resolve(returnsValues.pop()) - ); - const ctx = {args: {isChargedToMana: false}}; - const base64Binary = await models.MrwConfig.createShipment(ctx, expedition1.id, options); + spyOn(axios, 'post').and.callFake(() => + Promise.resolve(returnsValues.pop()) + ); - expect(base64Binary).toEqual(mockBase64Binary); + await models.Ticket.updateAll({id: ticket1.id}, {shipped: Date.vnNew()}, options); + const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options); - await options.transaction.rollback(); - } catch (e) { - await options.transaction.rollback(); - throw e; - } + expect(base64Binary).toEqual(mockBase64Binary); + }); + + it('should fail if mrwConfig has no data', async() => { + let error; + await models.MrwConfig.createShipment(expedition1.id).catch(e => { + error = e; + }).finally(async() => { + expect(error.message).toEqual(`Some mrwConfig parameters are not set`); + }); + + expect(error).toBeDefined(); + }); + + it('should fail if expeditionFk is not a MrwExpedition', async() => { + let error; + await models.MrwConfig.createShipment(undefined, options).catch(e => { + error = e; + }).finally(async() => { + expect(error.message).toEqual(`This expedition is not a MRW shipment`); + }); + }); + + it(' should fail if the creation date of this ticket is before the current date it', async() => { + let error; + const yesterday = Date.vnNew(); + + yesterday.setDate(yesterday.getDate() - 1); + await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday}, options); + await models.MrwConfig.createShipment(expedition1.id, options).catch(e => { + error = e; + }).finally(async() => { + expect(error.message).toEqual(`This ticket has a shipped date earlier than today`); + }); }); }); - -async function dbPopulate() { - -} - diff --git a/db/versions/10889-redMedeola/00-firstScript.sql b/db/versions/10889-redMedeola/00-firstScript.sql index 78fdf2917..ecae0234f 100644 --- a/db/versions/10889-redMedeola/00-firstScript.sql +++ b/db/versions/10889-redMedeola/00-firstScript.sql @@ -14,24 +14,11 @@ COLLATE=utf8mb3_unicode_ci; ALTER TABLE `vn`.`packingSite` ADD `hasNewLabelMrwMethod` BOOL NULL; - -INSERT INTO `vn`.`agency` (`name`,`warehouseFk`,`warehouseAliasFk`,`isOwn`,`isAnyVolumeAllowed`) - VALUES ('MRW',1,1,0,0); - -INSERT INTO `vn`.`agencyMode` (`id`, `name`, `description`, `deliveryMethodFk`, `m3`, `web`, `agencyFk`, `inflation`, `isVolumetric`, `reportMail`, `showAgencyName`, `isActive`, `isExternalAgency`, `flag`, `code`, `isRiskFree`, `hasWeightVolumetric`) - VALUES(26, 'MRW', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'MRW', 0, 0), - (27, 'mrwEcom', NULL, NULL, 0.0, 0, 11, 0.00, 0, NULL, 1, 1, 0, NULL, 'mrwEcom', 0, 0); - -INSERT INTO `vn`.`mrwConfig` (`url`, `user`, `password`, `franchiseCode`, `subscriberCode`) - VALUES ('https://sagec-test.mrw.es/MRWEnvio.asmx', '04301SGVERDNATURA', 'Verdnatura@4301V', '04301', '009731'); - INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('MrwConfig', 'cancelShipment', 'WRITE', 'ALLOW', 'ROLE', 'employee'); INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES ('MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee'); -INSERT INTO `vn`.`mrwService` (`agencyModeCodeFk`, `clientType`, `serviceType`, `kg`) VALUES('MRW', 9731, 205, 10); -INSERT INTO `vn`.`mrwServiceWeekday` (`agencyModeCodeFk`, `weekdays`, `serviceType`, `params`) VALUES('mrwEcom', 'sat', 800, 'EntregaSabado=S'); From 934278b0181c14f109a95afbb8aec71b4147c0c9 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 19 Feb 2024 08:45:43 +0100 Subject: [PATCH 131/250] refs #6053 maxCPUs 4 --- jest.front.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jest.front.config.js b/jest.front.config.js index 955f06eca..4cbfa2353 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -2,8 +2,10 @@ // https://jestjs.io/docs/en/configuration.html /* eslint max-len: ["error", { "code": 150 }]*/ const cpus = require('os').cpus().length; +console.log('cpus: ', cpus); +const maxCpus = Math.floor(cpus / 4); +console.log('maxCpus: ', maxCpus); -const maxCpus = Math.floor(cpus / 5) - 1; module.exports = { name: 'front end', displayName: { From b3ce6e8d455183d01295199e9b9de1543c710eab Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 19 Feb 2024 11:33:56 +0100 Subject: [PATCH 132/250] fix(spec): refs #6403 add mrwSpec --- back/methods/mrw-config/cancelShipment.js | 2 +- back/methods/mrw-config/createShipment.js | 2 -- .../mrw-config/specs/createShipment.spec.js | 30 +++++++++++-------- loopback/locale/es.json | 7 +++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 86e3277a9..d1b7a6b72 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -39,7 +39,7 @@ module.exports = Self => { const xmlString = response.data; const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); - const resultElement = xmlDoc.getElementsByTagName('Mensaje')[0]; + const [resultElement] = xmlDoc.getElementsByTagName('Mensaje'); return resultElement.textContent; }; diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index be3dbd96e..2b22d44fb 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -87,8 +87,6 @@ module.exports = Self => { const file = getTextByTag(getLabelResponse, 'EtiquetaFile'); await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions); - await myOptions.transaction.commit(); - return file; }; diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js index 5babadb78..e7bba524a 100644 --- a/back/methods/mrw-config/specs/createShipment.spec.js +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -28,15 +28,15 @@ const expedition1 = { 'editorFk': 100 }; -const returnsValues = [ - {data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')}, - {data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')} -]; +let tx; let options; -fdescribe('MRWConfig createShipment()', () => { - beforeAll(async() => { - options = {transaction: await models.MrwConfig.beginTransaction({})}; +describe('MRWConfig createShipment()', () => { + beforeEach(async() => { + options = tx = undefined; + tx = await models.MrwConfig.beginTransaction({}); + options = {transaction: tx}; + await models.Agency.create( {'id': 999, 'name': 'mrw'}, options @@ -68,12 +68,18 @@ fdescribe('MRWConfig createShipment()', () => { await models.Expedition.create(expedition1, options); }); - it('should create a shipment and return a base64Binary label', async() => { - spyOn(axios, 'post').and.callFake(() => - Promise.resolve(returnsValues.pop()) - ); + afterEach(async() => { + await tx.rollback(); + }); + + it('should create a shipment and return a base64Binary label', async() => { + const mockPostResponses = [ + {data: fs.readFileSync(__dirname + '/mockGetLabel.xml', 'utf-8')}, + {data: fs.readFileSync(__dirname + '/mockCreateShipment.xml', 'utf-8')} + ]; + + spyOn(axios, 'post').and.callFake(() => Promise.resolve(mockPostResponses.pop())); - await models.Ticket.updateAll({id: ticket1.id}, {shipped: Date.vnNew()}, options); const base64Binary = await models.MrwConfig.createShipment(expedition1.id, options); expect(base64Binary).toEqual(mockBase64Binary); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 935c8fe78..e1584c24d 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -72,7 +72,7 @@ "The secret can't be blank": "La contraseña no puede estar en blanco", "We weren't able to send this SMS": "No hemos podido enviar el SMS", "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", "This ticket can't be invoiced": "Este ticket no puede ser facturado", "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", "This ticket can not be modified": "Este ticket no puede ser modificado", @@ -336,5 +336,6 @@ "Incorrect pin": "Pin incorrecto", "You already have the mailAlias": "Ya tienes este alias de correo", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", - "No tickets to invoice": "No hay tickets para facturar" -} + "No tickets to invoice": "No hay tickets para facturar", + "1) El servicio solicitado no existe o no es un servicio válido.": "1) El servicio solicitado no existe o no es un servicio válido." +} \ No newline at end of file From 46043eef9aad249344711fe21c6a590fcb972c84 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 19 Feb 2024 12:54:24 +0100 Subject: [PATCH 133/250] refactor(description): refs #6403 modify description --- back/methods/mrw-config/cancelShipment.js | 2 +- back/methods/mrw-config/createShipment.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index d1b7a6b72..218b6a96b 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -5,7 +5,7 @@ const {DOMParser} = require('xmldom'); module.exports = Self => { Self.remoteMethod('cancelShipment', { - description: 'Cancel a shipment by providing the expedition ID, interacting with MRW WS', + description: 'Cancel a shipment by providing the expedition ID, interacting with MRW WebService', accessType: 'WRITE', accepts: [{ arg: 'expeditionFk', diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index 2b22d44fb..f0f7d66a2 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -6,7 +6,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('createShipment', { - description: 'Create an expedition and return a base64Binary label', + description: 'Create an expedition and return a base64Binary label from de MRW WebService', accessType: 'WRITE', accepts: [{ arg: 'expeditionFk', From d5a341330750b369173bcf72f23c8bcd70f8f43f Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 19 Feb 2024 14:46:42 +0100 Subject: [PATCH 134/250] fix: refs #6776 method names & chanmges --- .../{assignCollection.js => assign.js} | 6 +- ...sFromTicketOrCollection.js => getSales.js} | 13 ++--- ...ssignCollection.spec.js => assign.spec.js} | 4 +- ...tOrCollection.spec.js => getSales.spec.js} | 6 +- back/methods/machine-worker/updateInTime.js | 6 +- back/models/collection.js | 4 +- .../10832-purpleAralia/00-newWareHouse.sql | 7 +-- .../{return.js => getAlternative.js} | 6 +- ...{return.spec.js => getAlternative.spec.js} | 6 +- .../back/methods/item/{card.js => get.js} | 28 +++++---- .../item/specs/{card.spec.js => get.spec.js} | 6 +- modules/item/back/models/item-shelving.js | 2 +- modules/item/back/models/item.js | 2 +- .../back/methods/ticket/addSaleByCode.js | 11 ++-- modules/worker/back/methods/operator/add.js | 21 ------- .../back/methods/operator/spec/add.spec.js | 58 ------------------- modules/worker/back/models/operator.js | 2 - 17 files changed, 49 insertions(+), 139 deletions(-) rename back/methods/collection/{assignCollection.js => assign.js} (86%) rename back/methods/collection/{getSalesFromTicketOrCollection.js => getSales.js} (94%) rename back/methods/collection/spec/{assignCollection.spec.js => assign.spec.js} (88%) rename back/methods/collection/spec/{getSalesFromTicketOrCollection.spec.js => getSales.spec.js} (90%) rename modules/item/back/methods/item-shelving/{return.js => getAlternative.js} (92%) rename modules/item/back/methods/item-shelving/specs/{return.spec.js => getAlternative.spec.js} (70%) rename modules/item/back/methods/item/{card.js => get.js} (55%) rename modules/item/back/methods/item/specs/{card.spec.js => get.spec.js} (67%) delete mode 100644 modules/worker/back/methods/operator/add.js delete mode 100644 modules/worker/back/methods/operator/spec/add.spec.js diff --git a/back/methods/collection/assignCollection.js b/back/methods/collection/assign.js similarity index 86% rename from back/methods/collection/assignCollection.js rename to back/methods/collection/assign.js index 575649de8..8a2300e3e 100644 --- a/back/methods/collection/assignCollection.js +++ b/back/methods/collection/assign.js @@ -1,10 +1,10 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('assignCollection', { + Self.remoteMethodCtx('assign', { description: 'Assign a collection', accessType: 'WRITE', http: { - path: `/assignCollection`, + path: `/assign`, verb: 'POST' }, returns: { @@ -13,7 +13,7 @@ module.exports = Self => { }, }); - Self.assignCollection = async(ctx, options) => { + Self.assign = async(ctx, options) => { const userId = ctx.req.accessToken.userId; const myOptions = {userId}; diff --git a/back/methods/collection/getSalesFromTicketOrCollection.js b/back/methods/collection/getSales.js similarity index 94% rename from back/methods/collection/getSalesFromTicketOrCollection.js rename to back/methods/collection/getSales.js index 3c27a0be6..e9a87bfa3 100644 --- a/back/methods/collection/getSalesFromTicketOrCollection.js +++ b/back/methods/collection/getSales.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('getSalesFromTicketOrCollection', { + Self.remoteMethodCtx('getSales', { description: 'Get sales from ticket or collection', accessType: 'READ', accepts: [ @@ -23,12 +23,12 @@ module.exports = Self => { root: true }, http: { - path: `/getSalesFromTicketOrCollection`, + path: `/getSales`, verb: 'GET' }, }); - Self.getSalesFromTicketOrCollection = async(ctx, collectionOrTicketFk, print, source, options) => { + Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => { const userId = ctx.req.accessToken.userId; const myOptions = {userId}; const $t = ctx.req.__; @@ -62,11 +62,11 @@ module.exports = Self => { let observations = ticket.observaciones.split(' '); for (let observation of observations) { - const salesMan = ticket.salesPersonFk; + const salesPerson = ticket.salesPersonFk; if (!observation.startsWith('#') && !observation.startsWith('@')) return; await models.Chat.send(ctx, observation, - $t('ticketCommercial', {ticket: ticket.ticketFk, salesMan}) + $t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson}) ); } } @@ -92,9 +92,8 @@ module.exports = Self => { if (sale.ticketFk == ticketFk) { sale.placements = []; for (const salePlacement of placements) { - let placement; if (salePlacement.saleFk == sale.saleFk && salePlacement.order) { - placement = { + const placement = { saleFk: salePlacement.saleFk, itemFk: salePlacement.itemFk, placement: salePlacement.placement, diff --git a/back/methods/collection/spec/assignCollection.spec.js b/back/methods/collection/spec/assign.spec.js similarity index 88% rename from back/methods/collection/spec/assignCollection.spec.js rename to back/methods/collection/spec/assign.spec.js index e8f3882a3..745343819 100644 --- a/back/methods/collection/spec/assignCollection.spec.js +++ b/back/methods/collection/spec/assign.spec.js @@ -1,7 +1,7 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); -describe('ticket assignCollection()', () => { +describe('ticket assign()', () => { let ctx; let options; let tx; @@ -30,7 +30,7 @@ describe('ticket assignCollection()', () => { it('should throw an error when there is not picking tickets', async() => { try { - await models.Collection.assignCollection(ctx, options); + await models.Collection.assign(ctx, options); } catch (e) { expect(e.message).toEqual('There are not picking tickets'); } diff --git a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js b/back/methods/collection/spec/getSales.spec.js similarity index 90% rename from back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js rename to back/methods/collection/spec/getSales.spec.js index 50ba69401..e6205cc79 100644 --- a/back/methods/collection/spec/getSalesFromTicketOrCollection.spec.js +++ b/back/methods/collection/spec/getSales.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -describe('collection getSalesFromTicketOrCollection()', () => { +describe('collection getSales()', () => { const collectionOrTicketFk = 999999; const print = true; const source = 'CHECKER'; @@ -18,7 +18,7 @@ describe('collection getSalesFromTicketOrCollection()', () => { const tx = await models.Collection.beginTransaction({}); const options = {transaction: tx}; try { - const collection = await models.Collection.getSalesFromTicketOrCollection(ctx, + const collection = await models.Collection.getSales(ctx, collectionOrTicketFk, print, source, options); const [firstTicket] = collection.tickets; @@ -47,7 +47,7 @@ describe('collection getSalesFromTicketOrCollection()', () => { try { const printQueueBefore = await models.Collection.rawSql( query, [], options); - await models.Collection.getSalesFromTicketOrCollection(ctx, + await models.Collection.getSales(ctx, collectionOrTicketFk, true, source, options); const printQueueAfter = await models.Collection.rawSql( query, [], options); diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index 706f1a80e..cfeda4425 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -50,13 +50,13 @@ module.exports = Self => { if (machineWorker) { const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); - const isHimSelf = userId == machineWorker.workerFk; + const isHimself = userId == machineWorker.workerFk; const isSameMachine = machine.id == machineWorker.machineFk; - if (hoursDifference < maxHours && !isHimSelf) + if (hoursDifference < maxHours && !isHimself) throw new UserError($t('This machine is already in use.')); - if (hoursDifference < maxHours && isHimSelf && !isSameMachine) + if (hoursDifference < maxHours && isHimself && !isSameMachine) throw new UserError($t('You are already using a machine')); await machineWorker.updateAttributes({ diff --git a/back/models/collection.js b/back/models/collection.js index 7cc88c950..f2c2f1566 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -3,6 +3,6 @@ module.exports = Self => { require('../methods/collection/setSaleQuantity')(Self); require('../methods/collection/previousLabel')(Self); require('../methods/collection/getTickets')(Self); - require('../methods/collection/assignCollection')(Self); - require('../methods/collection/getSalesFromTicketOrCollection')(Self); + require('../methods/collection/assign')(Self); + require('../methods/collection/getSales')(Self); }; diff --git a/db/versions/10832-purpleAralia/00-newWareHouse.sql b/db/versions/10832-purpleAralia/00-newWareHouse.sql index 4802a6c4a..d2a86bf3e 100644 --- a/db/versions/10832-purpleAralia/00-newWareHouse.sql +++ b/db/versions/10832-purpleAralia/00-newWareHouse.sql @@ -1,6 +1,6 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES - ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), + ('Collection', 'assign', 'WRITE', 'ALLOW', 'ROLE', 'production'), ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'production'), ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'), ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'), @@ -8,7 +8,4 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'), ('SaleTracking','mark','WRITE','ALLOW','ROLE','production'), ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), - ('Collection', 'assignCollection', 'WRITE', 'ALLOW', 'ROLE', 'production'), - ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'), - ('Ticket', 'addSaleByCode', 'WRITE', 'ALLOW', 'ROLE', 'production'); - \ No newline at end of file + ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/modules/item/back/methods/item-shelving/return.js b/modules/item/back/methods/item-shelving/getAlternative.js similarity index 92% rename from modules/item/back/methods/item-shelving/return.js rename to modules/item/back/methods/item-shelving/getAlternative.js index 81047461e..8c0f63a2f 100644 --- a/modules/item/back/methods/item-shelving/return.js +++ b/modules/item/back/methods/item-shelving/getAlternative.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('return', { + Self.remoteMethod('getAlternative', { description: 'Returns a list of items and possible alternative locations', accessType: 'READ', accepts: [{ @@ -12,12 +12,12 @@ module.exports = Self => { root: true }, http: { - path: `/return`, + path: `/getAlternative`, verb: 'GET' } }); - Self.return = async(shelvingFk, options) => { + Self.getAlternative = async(shelvingFk, options) => { const models = Self.app.models; const myOptions = {}; diff --git a/modules/item/back/methods/item-shelving/specs/return.spec.js b/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js similarity index 70% rename from modules/item/back/methods/item-shelving/specs/return.spec.js rename to modules/item/back/methods/item-shelving/specs/getAlternative.spec.js index a5edc0ade..8c8d8a33d 100644 --- a/modules/item/back/methods/item-shelving/specs/return.spec.js +++ b/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -describe('itemShelving return()', () => { +describe('itemShelving getAlternative()', () => { beforeAll(async() => { ctx = { req: { @@ -11,14 +11,14 @@ describe('itemShelving return()', () => { it('should return a list of items without alternatives', async() => { const shelvingFk = 'HEJ'; - const itemShelvings = await models.ItemShelving.return(shelvingFk); + const itemShelvings = await models.ItemShelving.getAlternative(shelvingFk); expect(itemShelvings[0].carros.length).toEqual(0); }); it('should return an empty list', async() => { const shelvingFk = 'ZZP'; - const itemShelvings = await models.ItemShelving.return(shelvingFk); + const itemShelvings = await models.ItemShelving.getAlternative(shelvingFk); expect(itemShelvings.length).toEqual(0); }); diff --git a/modules/item/back/methods/item/card.js b/modules/item/back/methods/item/get.js similarity index 55% rename from modules/item/back/methods/item/card.js rename to modules/item/back/methods/item/get.js index 8ee4ccc6b..38b37a90c 100644 --- a/modules/item/back/methods/item/card.js +++ b/modules/item/back/methods/item/get.js @@ -1,14 +1,14 @@ module.exports = Self => { - Self.remoteMethod('card', { + Self.remoteMethod('get', { description: 'Get the data from an item', accessType: 'READ', http: { - path: `/card`, + path: `/get`, verb: 'GET' }, accepts: [ { - arg: 'itemFk', + arg: 'barcode', type: 'number', required: true, }, @@ -24,7 +24,7 @@ module.exports = Self => { }, }); - Self.card = async(itemFk, warehouseFk, options) => { + Self.get = async(barcode, warehouseFk, options) => { const myOptions = {}; if (typeof options == 'object') @@ -32,19 +32,17 @@ module.exports = Self => { const models = Self.app.models; - const [[itemInfo]] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [itemFk, warehouseFk], myOptions); + const [[itemInfo]] = await Self.rawSql('CALL vn.item_getInfo(?, ?)', [barcode, warehouseFk], myOptions); - const barcodeItems = await Self.rawSql('SELECT vn.barcodeToItem(?) as realIdItem', [itemFk], myOptions); - const [realIdItem] = barcodeItems.map(barcodeItem => barcodeItem.realIdItem); + if (itemInfo) { + itemInfo.barcodes = await models.ItemBarcode.find({ + fields: ['code'], + where: { + itemFk: itemInfo.id + } + }); + } - const barcodes = await models.ItemBarcode.find({ - fields: ['code'], - where: { - itemFk: realIdItem - } - }); - - if (itemInfo) itemInfo.barcodes = barcodes; return itemInfo; }; }; diff --git a/modules/item/back/methods/item/specs/card.spec.js b/modules/item/back/methods/item/specs/get.spec.js similarity index 67% rename from modules/item/back/methods/item/specs/card.spec.js rename to modules/item/back/methods/item/specs/get.spec.js index 65004cfa5..55262004a 100644 --- a/modules/item/back/methods/item/specs/card.spec.js +++ b/modules/item/back/methods/item/specs/get.spec.js @@ -1,10 +1,10 @@ const {models} = require('vn-loopback/server/server'); -describe('item card()', () => { - const itemFk = 1; +describe('item get()', () => { + const barcode = 1; const warehouseFk = 1; it('should get an item with several barcodes', async() => { - const card = await models.Item.card(itemFk, warehouseFk); + const card = await models.Item.get(barcode, warehouseFk); expect(card).toBeDefined(); expect(card.barcodes.length).toBeTruthy(); diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index 6e63a29b2..e180a2d7c 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -1,6 +1,6 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); require('../methods/item-shelving/getInventory')(Self); - require('../methods/item-shelving/return')(Self); + require('../methods/item-shelving/getAlternative')(Self); require('../methods/item-shelving/updateFromSale')(Self); }; diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 17c7a59f1..e715ab431 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -17,7 +17,7 @@ module.exports = Self => { require('../methods/item/buyerWasteEmail')(Self); require('../methods/item/labelPdf')(Self); require('../methods/item/setVisibleDiscard')(Self); - require('../methods/item/card')(Self); + require('../methods/item/get')(Self); Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'}); diff --git a/modules/ticket/back/methods/ticket/addSaleByCode.js b/modules/ticket/back/methods/ticket/addSaleByCode.js index cb3bcccd3..c22cbc20e 100644 --- a/modules/ticket/back/methods/ticket/addSaleByCode.js +++ b/modules/ticket/back/methods/ticket/addSaleByCode.js @@ -1,11 +1,10 @@ -const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('addSaleByCode', { description: 'Add a collection', accessType: 'WRITE', accepts: [ { - arg: 'code', + arg: 'barcode', type: 'string', required: true }, { @@ -29,7 +28,7 @@ module.exports = Self => { }, }); - Self.addSaleByCode = async(ctx, code, quantity, ticketFk, warehouseFk, options) => { + Self.addSaleByCode = async(ctx, barcode, quantity, ticketFk, warehouseFk, options) => { const myOptions = {}; let tx; @@ -42,10 +41,8 @@ module.exports = Self => { } try { - const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [code, warehouseFk], myOptions); - if (!item?.available) throw new UserError('We do not have availability for the selected item'); - - await Self.rawSql('CALL vn.collection_addItem(?, ?, ?)', [item.id, quantity, ticketFk], myOptions); + const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [barcode, warehouseFk], myOptions); + await Self.addSale(ctx, ticketFk, item.id, quantity, myOptions); if (tx) await tx.commit(); } catch (e) { diff --git a/modules/worker/back/methods/operator/add.js b/modules/worker/back/methods/operator/add.js deleted file mode 100644 index efd610562..000000000 --- a/modules/worker/back/methods/operator/add.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('add', { - description: 'Add a new operator', - accessType: 'WRITE', - http: { - path: `/add`, - verb: 'POST' - } - }); - - Self.add = async(ctx, options) => { - const userId = ctx.req.accessToken.userId; - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - const isOperator = await Self.findById(userId, myOptions); - if (!isOperator) await Self.create({workerFk: userId}, myOptions); - }; -}; diff --git a/modules/worker/back/methods/operator/spec/add.spec.js b/modules/worker/back/methods/operator/spec/add.spec.js deleted file mode 100644 index 94daae8de..000000000 --- a/modules/worker/back/methods/operator/spec/add.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -const {models} = require('vn-loopback/server/server'); - -describe('operator add()', () => { - const noOperator = 104; - const operator = 9; - - beforeAll(async() => { - ctx = { - req: { - accessToken: {}, - headers: {origin: 'http://localhost'}, - __: value => value - } - }; - }); - - it('should not add an existent operator', async() => { - const tx = await models.Operator.beginTransaction({}); - const options = {transaction: tx}; - ctx.req.accessToken.userId = operator; - - try { - const operatorBefore = await models.Operator.find(null, options); - const isOperator = await models.Operator.findOne(null, options); - - expect(isOperator).toBeDefined(); - - await models.Operator.add(ctx, options); - const operatorAfter = await models.Operator.find(null, options); - - expect(operatorBefore.length).toEqual(operatorAfter.length); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - } - }); - - it('should add a new operator successfully', async() => { - const tx = await models.Operator.beginTransaction({}); - const options = {transaction: tx}; - ctx.req.accessToken.userId = noOperator; - - try { - const operatorBefore = await models.Operator.find(null, options); - await models.Operator.add(ctx, options); - const operatorAfter = await models.Operator.find(null, options); - - const isOperator = await models.Operator.findOne(null, options); - - expect(operatorBefore.length).toEqual(operatorAfter.length - 1); - expect(isOperator).toBeDefined(); - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/worker/back/models/operator.js b/modules/worker/back/models/operator.js index 442ac343f..cf6c198b6 100644 --- a/modules/worker/back/models/operator.js +++ b/modules/worker/back/models/operator.js @@ -1,6 +1,4 @@ module.exports = Self => { - require('../methods/operator/add')(Self); - Self.observe('after save', async function(ctx) { const instance = ctx.data || ctx.instance; const models = Self.app.models; From 072280cc9caf2b888475d8544fdbceda0568dac7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 20 Feb 2024 08:48:47 +0100 Subject: [PATCH 135/250] fix: refs #6776 method names --- .../methods/sale-tracking/{mark.js => setPicked.js} | 8 ++++---- .../specs/{mark.spec.js => setPicked.spec.js} | 10 +++++----- modules/ticket/back/models/sale-tracking.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) rename modules/ticket/back/methods/sale-tracking/{mark.js => setPicked.js} (90%) rename modules/ticket/back/methods/sale-tracking/specs/{mark.spec.js => setPicked.spec.js} (93%) diff --git a/modules/ticket/back/methods/sale-tracking/mark.js b/modules/ticket/back/methods/sale-tracking/setPicked.js similarity index 90% rename from modules/ticket/back/methods/sale-tracking/mark.js rename to modules/ticket/back/methods/sale-tracking/setPicked.js index 71fdfa048..990768197 100644 --- a/modules/ticket/back/methods/sale-tracking/mark.js +++ b/modules/ticket/back/methods/sale-tracking/setPicked.js @@ -1,8 +1,8 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { - Self.remoteMethodCtx('mark', { - description: 'Insert an itemShelvingSale and Modify a saleTracking record', + Self.remoteMethodCtx('setPicked', { + description: 'Add the sales line of the item and set the tracking.', accessType: 'WRITE', accepts: [ { @@ -46,12 +46,12 @@ module.exports = Self => { } ], http: { - path: `/mark`, + path: `/setPicked`, verb: 'POST' } }); - Self.mark = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => { + Self.setPicked = async(ctx, saleFk, originalQuantity, code, isChecked, buyFk, isScanned, quantity, itemShelvingFk, options) => { const userId = ctx.req.accessToken.userId; const models = Self.app.models; const myOptions = {}; diff --git a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js b/modules/ticket/back/methods/sale-tracking/specs/setPicked.spec.js similarity index 93% rename from modules/ticket/back/methods/sale-tracking/specs/mark.spec.js rename to modules/ticket/back/methods/sale-tracking/specs/setPicked.spec.js index 723f5fb78..0cf2ccbeb 100644 --- a/modules/ticket/back/methods/sale-tracking/specs/mark.spec.js +++ b/modules/ticket/back/methods/sale-tracking/specs/setPicked.spec.js @@ -1,5 +1,5 @@ const {models} = require('vn-loopback/server/server'); -describe('saleTracking mark()', () => { +describe('saleTracking setPicked()', () => { const saleFk = 1; const originalQuantity = 10; const code = 'PREPARED'; @@ -24,7 +24,7 @@ describe('saleTracking mark()', () => { const options = {transaction: tx}; const code = 'FAKESTATE'; try { - await models.SaleTracking.mark( + await models.SaleTracking.setPicked( ctx, saleFk, originalQuantity, @@ -50,7 +50,7 @@ describe('saleTracking mark()', () => { const tx = await models.SaleTracking.beginTransaction({}); const options = {transaction: tx}; try { - await models.SaleTracking.mark( + await models.SaleTracking.setPicked( ctx, saleFk, originalQuantity, @@ -63,7 +63,7 @@ describe('saleTracking mark()', () => { options ); - await models.SaleTracking.mark( + await models.SaleTracking.setPicked( ctx, saleFk, originalQuantity, @@ -89,7 +89,7 @@ describe('saleTracking mark()', () => { const options = {transaction: tx}; try { const itemShelvingSaleBefore = await models.ItemShelvingSale.find({}, options); - await models.SaleTracking.mark( + await models.SaleTracking.setPicked( ctx, saleFk, originalQuantity, diff --git a/modules/ticket/back/models/sale-tracking.js b/modules/ticket/back/models/sale-tracking.js index f284ec185..b5f8aeed5 100644 --- a/modules/ticket/back/models/sale-tracking.js +++ b/modules/ticket/back/models/sale-tracking.js @@ -4,5 +4,5 @@ module.exports = Self => { require('../methods/sale-tracking/new')(Self); require('../methods/sale-tracking/delete')(Self); require('../methods/sale-tracking/updateTracking')(Self); - require('../methods/sale-tracking/mark')(Self); + require('../methods/sale-tracking/setPicked')(Self); }; From 55b490160bed737cf58dc809dcfd3ff7e3a92107 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 20 Feb 2024 09:27:37 +0100 Subject: [PATCH 136/250] fix: refs #6776 back --- modules/ticket/back/methods/ticket/addSaleByCode.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/addSaleByCode.js b/modules/ticket/back/methods/ticket/addSaleByCode.js index c22cbc20e..a73628c86 100644 --- a/modules/ticket/back/methods/ticket/addSaleByCode.js +++ b/modules/ticket/back/methods/ticket/addSaleByCode.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('addSaleByCode', { description: 'Add a collection', @@ -42,7 +43,9 @@ module.exports = Self => { try { const [[item]] = await Self.rawSql('CALL vn.item_getInfo(?,?)', [barcode, warehouseFk], myOptions); - await Self.addSale(ctx, ticketFk, item.id, quantity, myOptions); + if (!item?.available) throw new UserError('We do not have availability for the selected item'); + + await Self.rawSql('CALL vn.collection_addItem(?, ?, ?)', [item.id, quantity, ticketFk], myOptions); if (tx) await tx.commit(); } catch (e) { From 9ce162da7144b8b064b4d1f0ab91f4b02e349082 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 20 Feb 2024 10:59:13 +0100 Subject: [PATCH 137/250] fix: refs #6776 back --- db/versions/10832-purpleAralia/00-newWareHouse.sql | 4 ++-- modules/ticket/back/methods/sale-tracking/delete.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/versions/10832-purpleAralia/00-newWareHouse.sql b/db/versions/10832-purpleAralia/00-newWareHouse.sql index d2a86bf3e..448c69322 100644 --- a/db/versions/10832-purpleAralia/00-newWareHouse.sql +++ b/db/versions/10832-purpleAralia/00-newWareHouse.sql @@ -4,8 +4,8 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('ExpeditionPallet', 'getPallet', 'READ', 'ALLOW', 'ROLE', 'production'), ('MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'), ('MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'), - ('SaleTracking','deleteTracking','WRITE','ALLOW','ROLE','production'), + ('SaleTracking','delete','WRITE','ALLOW','ROLE','production'), ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'), - ('SaleTracking','mark','WRITE','ALLOW','ROLE','production'), + ('SaleTracking','setPicked','WRITE','ALLOW','ROLE','production'), ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index 859f26354..fda21a014 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -2,7 +2,7 @@ module.exports = Self => { Self.remoteMethod('delete', { description: 'Delete sale trackings and item shelving sales', - accessType: 'READ', + accessType: 'WRITE', accepts: [ { arg: 'saleFk', From 728224cad9c18b7258739d20e874ee9178e523e6 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 20 Feb 2024 13:04:45 +0100 Subject: [PATCH 138/250] refs #5858 fix accepts --- .../back/methods/client/updateFiscalData.js | 10 +++++----- .../methods/supplier/specs/newSupplier.spec.js | 3 ++- .../back/methods/supplier/updateFiscalData.js | 4 ++-- .../supplier/back/models/specs/supplier.spec.js | 9 ++++++--- modules/supplier/back/models/supplier.js | 16 ++++++---------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 5fd886c32..8fe92ecd0 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -22,7 +22,7 @@ module.exports = Self => { }, { arg: 'fi', - type: 'string' + type: 'any' }, { arg: 'street', @@ -30,19 +30,19 @@ module.exports = Self => { }, { arg: 'postcode', - type: 'string' + type: 'any' }, { arg: 'city', - type: 'string' + type: 'any' }, { arg: 'countryFk', - type: 'number' + type: 'any' }, { arg: 'provinceFk', - type: 'number' + type: 'any' }, { arg: 'sageTaxTypeFk', diff --git a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js index 0e7fa0e34..2b36de5e2 100644 --- a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js +++ b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js @@ -26,7 +26,8 @@ describe('Supplier newSupplier()', () => { const options = {transaction: tx}; ctx.args = { name: 'NEWSUPPLIER', - nif: '12345678Z' + nif: '12345678Z', + city: 'Gotham' }; const result = await models.Supplier.newSupplier(ctx, options); diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index c0b860983..713b97cd4 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -46,10 +46,10 @@ module.exports = Self => { type: 'any' }, { arg: 'supplierActivityFk', - type: 'string' + type: 'any' }, { arg: 'healthRegister', - type: 'string' + type: 'any' }, { arg: 'isVies', type: 'boolean' diff --git a/modules/supplier/back/models/specs/supplier.spec.js b/modules/supplier/back/models/specs/supplier.spec.js index 3f40ce58b..05d78240d 100644 --- a/modules/supplier/back/models/specs/supplier.spec.js +++ b/modules/supplier/back/models/specs/supplier.spec.js @@ -129,10 +129,13 @@ describe('loopback model Supplier', () => { const options = {transaction: tx}; try { - const newSupplier = await models.Supplier.create({name: 'ALFRED PENNYWORTH'}, options); - const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options); + const newSupplier = { + name: 'ALFRED PENNYWORTH', nif: '87805752D', city: 'Gotham' + }; + const supplierCreated = await models.Supplier.create(newSupplier, options); + const fetchedSupplier = await models.Supplier.findById(supplierCreated.id, null, options); - expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id); + expect(Number(fetchedSupplier.account)).toEqual(4100000000 + supplierCreated.id); await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js index 0ac389074..2d3ffef3e 100644 --- a/modules/supplier/back/models/supplier.js +++ b/modules/supplier/back/models/supplier.js @@ -17,17 +17,13 @@ module.exports = Self => { message: 'The social name cannot be empty' }); - if (this.city) { - Self.validatesPresenceOf('city', { - message: 'City cannot be empty' - }); - } + Self.validatesPresenceOf('city', { + message: 'City cannot be empty' + }); - if (this.nif) { - Self.validatesPresenceOf('nif', { - message: 'The nif cannot be empty' - }); - } + Self.validatesPresenceOf('nif', { + message: 'The nif cannot be empty' + }); Self.validatesUniquenessOf('nif', { message: 'TIN must be unique' From 3813dbb9fddaa84bdf70af85cefcb52f98c23e22 Mon Sep 17 00:00:00 2001 From: ivanm Date: Tue, 20 Feb 2024 13:10:03 +0100 Subject: [PATCH 139/250] refs #6784 Delete clientTypeFk --- db/dump/fixtures.before.sql | 2 +- db/routines/bs/procedures/waste_addSales.sql | 2 +- db/routines/vn/procedures/comparative_add.sql | 2 +- db/routines/vn/procedures/itemShelving_filterBuyer.sql | 4 ++-- db/routines/vn/procedures/item_getBalance.sql | 2 +- db/routines/vn/views/saleValue.sql | 2 +- db/routines/vn2008/views/Clientes.sql | 1 - db/versions/10891-chocolateRuscus/00-firstScript.sql | 2 ++ modules/client/back/models/client.json | 2 +- modules/ticket/back/models/sale.js | 2 +- 10 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 db/versions/10891-chocolateRuscus/00-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 094b956af..5ad6f30ea 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -371,7 +371,7 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) (4, 'GCN Channel'), (5, 'The Newspaper'); -INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`) +INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk__`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`) VALUES (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), diff --git a/db/routines/bs/procedures/waste_addSales.sql b/db/routines/bs/procedures/waste_addSales.sql index ac6690129..0ab328b49 100644 --- a/db/routines/bs/procedures/waste_addSales.sql +++ b/db/routines/bs/procedures/waste_addSales.sql @@ -19,7 +19,7 @@ BEGIN itemFk, itemTypeFk, floor(sum(value)) as total, - floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas + floor(sum(IF(typeFk = 'loses', value, 0))) as mermas FROM vn.saleValue where year = vYear and week = vWeek diff --git a/db/routines/vn/procedures/comparative_add.sql b/db/routines/vn/procedures/comparative_add.sql index 756096e54..b64c20201 100644 --- a/db/routines/vn/procedures/comparative_add.sql +++ b/db/routines/vn/procedures/comparative_add.sql @@ -47,7 +47,7 @@ BEGIN JOIN itemCategory ic ON ic.id = tp.categoryFk JOIN ticket t ON t.id = s.ticketFk JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN clientType ct ON ct.code = c.typeFk JOIN warehouse w ON w.id = t.warehouseFk JOIN address ad ON ad.id = t.addressFk LEFT JOIN province p ON p.id = ad.provinceFk diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql index a232139d3..d8f20d95f 100644 --- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql +++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql @@ -44,7 +44,7 @@ proc:BEGIN LEFT JOIN saleTracking st ON st.saleFk = s.id JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN clientType ct ON ct.code = c.typeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL AND ct.code IN ('normal', 'trust') @@ -70,7 +70,7 @@ proc:BEGIN LEFT JOIN saleTracking st ON st.saleFk = s.id JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN clientType ct ON ct.code = c.typeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL AND ct.code IN ('normal', 'trust') diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index 5fe57f2a4..87d46db6d 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -128,7 +128,7 @@ BEGIN LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN state st ON st.`code` = ts.`code` JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN clientType ct ON ct.code = c.typeFk JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(), 'DELIVERED', IF (t.shipped > util.dayEnd(util.VN_CURDATE()), diff --git a/db/routines/vn/views/saleValue.sql b/db/routines/vn/views/saleValue.sql index 4394769d1..2dee4695e 100644 --- a/db/routines/vn/views/saleValue.sql +++ b/db/routines/vn/views/saleValue.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `vn`.`saleValue` AS SELECT `wh`.`name` AS `warehouse`, `c`.`name` AS `client`, - `c`.`typeFk` AS `clientTypeFk`, + `c`.`typeFk` AS `typeFk`, `u`.`name` AS `buyer`, `it`.`id` AS `itemTypeFk`, `it`.`name` AS `family`, diff --git a/db/routines/vn2008/views/Clientes.sql b/db/routines/vn2008/views/Clientes.sql index 12583915a..a696cb6e0 100644 --- a/db/routines/vn2008/views/Clientes.sql +++ b/db/routines/vn2008/views/Clientes.sql @@ -34,7 +34,6 @@ AS SELECT `c`.`id` AS `id_cliente`, `c`.`hasLcr` AS `hasLcr`, `c`.`defaultAddressFk` AS `default_address`, `c`.`riskCalculated` AS `risk_calculated`, - `c`.`clientTypeFk` AS `clientes_tipo_id`, `c`.`hasToInvoiceByAddress` AS `invoiceByAddress`, `c`.`isTaxDataChecked` AS `contabilizado`, `c`.`isFreezed` AS `congelado`, diff --git a/db/versions/10891-chocolateRuscus/00-firstScript.sql b/db/versions/10891-chocolateRuscus/00-firstScript.sql new file mode 100644 index 000000000..8666e0b24 --- /dev/null +++ b/db/versions/10891-chocolateRuscus/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente; +ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784'; diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index bfde05162..3d381e186 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -197,7 +197,7 @@ "type": { "type": "belongsTo", "model": "ClientType", - "foreignKey": "clientTypeFk" + "foreignKey": "clientTypeFk__" }, "businessType": { "type": "belongsTo", diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 30fb74b75..31a2fbf35 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -41,7 +41,7 @@ module.exports = Self => { include: { relation: 'client', scope: { - fields: ['id', 'clientTypeFk'], + fields: ['id', 'clientTypeFk__'], include: { relation: 'type', scope: { From 8514a23f9c8069461d8034ebc5bbcc88678532c4 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 20 Feb 2024 13:18:37 +0100 Subject: [PATCH 140/250] refs #5858 fix conflicts --- loopback/locale/en.json | 8 -------- loopback/locale/es.json | 18 ------------------ 2 files changed, 26 deletions(-) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 9d7d2b75f..2187371cd 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -203,19 +203,11 @@ "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}}", -<<<<<<< HEAD -======= - "Try again": "Try again", ->>>>>>> 5918c14d41259e9989b63c8a36f0e23612cf5d69 "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", -<<<<<<< HEAD "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" -======= - "CountryFK cannot be empty": "Country cannot be empty" ->>>>>>> 5918c14d41259e9989b63c8a36f0e23612cf5d69 } diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f4aca18d4..d51dcb88d 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,8 +1,4 @@ { -<<<<<<< HEAD -======= - "postalcode": "Código postal", ->>>>>>> 5918c14d41259e9989b63c8a36f0e23612cf5d69 "Phone format is invalid": "El formato del teléfono no es correcto", "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", @@ -143,11 +139,7 @@ "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*", "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", -<<<<<<< HEAD "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000", -======= - "Distance must be lesser than 1000": "La distancia debe ser inferior a 1000", ->>>>>>> 5918c14d41259e9989b63c8a36f0e23612cf5d69 "This ticket is deleted": "Este ticket está eliminado", "Unable to clone this travel": "No ha sido posible clonar este travel", "This thermograph id already exists": "La id del termógrafo ya existe", @@ -341,28 +333,18 @@ "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada", "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", -<<<<<<< HEAD - "Incorrect pin": "Pin incorrecto", - "You already have the mailAlias": "Ya tienes este alias de correo", - "The alias cant be modified": "Este alias de correo no puede ser modificado", -======= "Field are invalid": "El campo '{{tag}}' no es válido", "Incorrect pin": "Pin incorrecto.", "You already have the mailAlias": "Ya tienes este alias de correo", "The alias cant be modified": "Este alias de correo no puede ser modificado", "No tickets to invoice": "No hay tickets para facturar", ->>>>>>> 5918c14d41259e9989b63c8a36f0e23612cf5d69 "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", "Name should be uppercase": "El nombre debe ir en mayúscula", "Bank entity must be specified": "La entidad bancaria es obligatoria", "An email is necessary": "Es necesario un email", "You cannot update these fields": "No puedes actualizar estos campos", "CountryFK cannot be empty": "El país no puede estar vacío", -<<<<<<< HEAD "Cmr file does not exist": "El archivo del cmr no existe", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", "No tickets to invoice": "No hay tickets para facturar" -======= - "Cmr file does not exist": "El archivo del cmr no existe" ->>>>>>> 5918c14d41259e9989b63c8a36f0e23612cf5d69 } From f3f0360059601b8c35cf31a01dd1ba0f31441910 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 20 Feb 2024 13:19:31 +0100 Subject: [PATCH 141/250] refs #5858 fix conflicts --- loopback/locale/es.json | 1 - 1 file changed, 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index d51dcb88d..247e0baae 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -346,5 +346,4 @@ "CountryFK cannot be empty": "El país no puede estar vacío", "Cmr file does not exist": "El archivo del cmr no existe", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", - "No tickets to invoice": "No hay tickets para facturar" } From 62ccbb30741f26b8d01e504ef76e7e24ea61943e Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 20 Feb 2024 13:45:10 +0100 Subject: [PATCH 142/250] refs #5858 fix error --- loopback/server/middleware/error-handler.js | 28 ++++----------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/loopback/server/middleware/error-handler.js b/loopback/server/middleware/error-handler.js index dcce7d54a..cc7b81618 100644 --- a/loopback/server/middleware/error-handler.js +++ b/loopback/server/middleware/error-handler.js @@ -1,14 +1,7 @@ -const SalixError = require('vn-loopback/util/salixError'); -const UserError = require('vn-loopback/util/user-error'); +const SalixError = require('../../util/salixError'); +const UserError = require('../../util/user-error'); const logToConsole = require('strong-error-handler/lib/logger'); -const valueIsNot = require('./value-is-not'); -const valueInvalid = require('./value-invalid'); -const mapMethods = require('vn-loopback/util/map-methods'); -const validations = [ - valueIsNot, - valueInvalid, - mapMethods -]; + module.exports = function() { return function(err, req, res, next) { // Thrown user errors @@ -18,19 +11,7 @@ module.exports = function() { } // Validation errors - if ([400, 422].includes(err.statusCode)) { - try { - validations.forEach(validation => { - if (validation.validation(err.message)) { - const error = validation.handleError(req, err); - if (error) - err.message = validation.message(error, req); - } - }); - - return next(err); - } catch (e) { - } + if (err.statusCode == 422) { try { let code; let {messages} = err.details; @@ -45,6 +26,7 @@ module.exports = function() { return next(new UserError(req.__(err.sqlMessage))); // Logs error to console + let env = process.env.NODE_ENV; let useCustomLogging = env && env != 'development' && (!err.statusCode || err.statusCode >= 500); From e7f8b7282bb4ed7794bfb949fbaaa81b752b046c Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 20 Feb 2024 13:48:31 +0100 Subject: [PATCH 143/250] refs #5858 remove clean pr --- .../middleware/specs/value-is-not.spec.js | 59 ---------- loopback/server/middleware/value-invalid.js | 58 ---------- loopback/server/middleware/value-is-not.js | 106 ------------------ loopback/util/map-locales.js | 23 ---- loopback/util/map-methods.js | 12 -- 5 files changed, 258 deletions(-) delete mode 100644 loopback/server/middleware/specs/value-is-not.spec.js delete mode 100644 loopback/server/middleware/value-invalid.js delete mode 100644 loopback/server/middleware/value-is-not.js delete mode 100644 loopback/util/map-locales.js delete mode 100644 loopback/util/map-methods.js diff --git a/loopback/server/middleware/specs/value-is-not.spec.js b/loopback/server/middleware/specs/value-is-not.spec.js deleted file mode 100644 index 4d65ddf56..000000000 --- a/loopback/server/middleware/specs/value-is-not.spec.js +++ /dev/null @@ -1,59 +0,0 @@ -const valueIsNot = require('../value-is-not'); - -fdescribe('Value is not', () => { - const i18n = require('i18n'); - - const userId = 9; - const ctx = { - req: { - - accessToken: {userId: userId}, - headers: {origin: 'http://localhost:5000'}, - } - }; - - fit('UpdateFiscalData endpoint', () => { - let messageError = 'Value is not number'; - const tag = 'provinceFk'; - try { - expect(valueIsNot.validation(messageError)).toBeTrue(); - const data = { - method: 'PATCH', - originalUrl: '/api/supplier/updateFiscalData', - body: { - [tag]: null - }, - __: i18n - }; - const result = valueIsNot.handleError(data); - - expect(result.tag).toEqual(tag); - expect(valueIsNot.message(result, i18n)).toEqual('El campo \'provincia\' no es válido'); - } catch (error) { - expect(error).toBeDefined(); - } - }); - - describe('OsTicket', () => { - let messageError = 'Value is not object'; - const tag = 'additionalData'; - it('sendToSupport endpoint', () => { - try { - expect(valueIsNot.validation(messageError)).toBeTrue(); - const data = { - method: 'POST', - originalUrl: '/api/OsTickets/send-to-support?access_token=DEFAULT_TOKEN', - body: { - [tag]: '{ \'foo\': 42 }' - } - }; - const result = valueIsNot.handleError(data); - - expect(result.tag).toEqual(tag); - expect(valueIsNot.message(tag, i18n)).toEqual(`El campo '${tag}' no es válido`); - } catch (error) { - expect(error).toBeDefined(); - } - }); - }); -}); diff --git a/loopback/server/middleware/value-invalid.js b/loopback/server/middleware/value-invalid.js deleted file mode 100644 index 962aa9e1f..000000000 --- a/loopback/server/middleware/value-invalid.js +++ /dev/null @@ -1,58 +0,0 @@ -const SLASH = '/'; -const $t = require('i18n'); -const {models} = require('vn-loopback/server/server'); -const mapLocale = require('../../util/map-locales'); - - -module.exports = { - validation: message => String(message).includes('is not valid'), - message: ({tagValue}, {__: $t}) => - $t('Field are invalid', {tag: tagValue}), - handleError: ({method: verb, originalUrl, body}, err) => { - let tag = null; - let module = null; - let moduleOriginal = null; - let path = null; - try { - if (originalUrl.includes('?')) - originalUrl = originalUrl.split('?')[0]; - - originalUrl = originalUrl.split('api/')[1]; - [module, ...path] = originalUrl.split(SLASH); - - moduleOriginal = module; - let model = models[module]; - // Capitalize - if (!model) { - module = module.charAt(0).toUpperCase() + module.slice(1); - model = models[module]; - } - // Singular - if (!model) { - module = module.substring(0, module.length - 1); - model = models[module]; - } - if (!model) throw new Error('No matching model found'); - tag = Object.keys(err.details.codes)[0]; - if (tag) { - let tagValue = mapLocale[$t.getLocale()][tag]; - if (!tagValue) tagValue = tag; - return {tag, tagValue}; - } - } catch (error) { - throw new Error(error); - } - } - -}; - - - -function isJsonString(str) { - try { - let json = JSON.parse(str); - return (typeof json === 'object'); - } catch (e) { - return false; - } -} diff --git a/loopback/server/middleware/value-is-not.js b/loopback/server/middleware/value-is-not.js deleted file mode 100644 index 021af3fb9..000000000 --- a/loopback/server/middleware/value-is-not.js +++ /dev/null @@ -1,106 +0,0 @@ -const SLASH = '/'; -const {models} = require('vn-loopback/server/server'); -const $t = require('i18n'); -const mapLocale = require('../../util/map-locales'); - -module.exports = { - validation: message => String(message).startsWith('Value is not'), - message: ({tagValue}, {__: $t}) => - $t('Field are invalid', {tag: tagValue}), - handleError: ({method: verb, originalUrl, body}) => { - let tag = null; - let module = null; - let path = null; - let hasId = false; - try { - if (originalUrl.includes('?')) - originalUrl = originalUrl.split('?')[0]; - - originalUrl = originalUrl.split('api/')[1]; - [module, ...path] = originalUrl.split(SLASH); - hasId = path.length > 1; - - let model = models[module]; - // Capitalize - if (!model) { - module = module.charAt(0).toUpperCase() + module.slice(1); - model = models[module]; - } - // Singular - if (!model) { - module = module.substring(0, module.length - 1); - model = models[module]; - } - if (!model) throw new Error('No matching model found'); - const currentMethod = model.sharedClass.methods().find(method => { - const methodMatch = [method.http].flat().filter(el => el.verb === verb.toLowerCase()).find(el => { - let isValid = false; - if (hasId) - isValid = el.path.replace(':id', path[0]) === SLASH + path.join(SLASH); - else - isValid = el.path.endsWith(path[0]); - return isValid; - }); - if (methodMatch) - return method; - } - ); - if (!currentMethod) throw new Error('No matching currentMethod found'); - const {accepts} = currentMethod; - for (const [key, value] of Object.entries(body)) { - if (!value) { - tag = key; - break; - } - const accept = accepts.find(acc => acc.arg === key); - if (accept.type !== 'any') { - let isValid = false; - if (value) { - switch (accept.type) { - case 'object': - isValid = isJsonString(value); - break; - case 'number': - isValid = /^[0-9]*$/.test(value); - break; - - case 'boolean': - isValid = value instanceof Boolean; - break; - - case 'date': - isValid = (new Date(date) !== 'Invalid Date') && !isNaN(new Date(date)); - break; - - case 'string': - isValid = typeof value == 'string'; - break; - } - } - if (!isValid) { - tag = key; - break; - } - } - } - if (tag) { - let tagValue = mapLocale[$t.getLocale()][tag]; - if (!tagValue) tagValue = tag; - return {tag, tagValue}; - } - } catch (error) { - throw new Error(error); - } - } - -}; - - -function isJsonString(str) { - try { - let json = JSON.parse(str); - return (typeof json === 'object'); - } catch (e) { - return false; - } -} diff --git a/loopback/util/map-locales.js b/loopback/util/map-locales.js deleted file mode 100644 index 692de3f23..000000000 --- a/loopback/util/map-locales.js +++ /dev/null @@ -1,23 +0,0 @@ -const SLASH = '/'; -const MODULES = 'modules'; -const BACK = 'back'; -const path = require('path'); -const glob = require('glob'); -const modulesPath = `${MODULES}/**/${BACK}/locale/**/**.yml`; -const pathResolve = path.resolve(modulesPath); - -const modelsLocale = glob.sync(pathResolve, {}).reduce((acc, f) => { - const file = require(f); - const model = f.substring(f.indexOf(MODULES), f.indexOf(BACK) - 1).split(SLASH)[1]; - const locale = path.parse(f).base.split('.')[0]; - - if (!acc[locale]) acc[locale] = {}; - acc[locale] = Object.assign(acc[locale], file.columns); - return acc; -}, {} -); -function keyMap(model, local, connector = '_') { - return `${model}${connector}${local}`; -} -module.exports =modelsLocale; - diff --git a/loopback/util/map-methods.js b/loopback/util/map-methods.js deleted file mode 100644 index 2858cd61d..000000000 --- a/loopback/util/map-methods.js +++ /dev/null @@ -1,12 +0,0 @@ -const SLASH = '/'; -const MODULES = 'modules'; -const BACK = 'back'; - -const app = require('vn-loopback/server/server'); - -const modelsMethods = app; -function keyMap(model, local, connector = '_') { - return `${model}${connector}${local}`; -} -module.exports = modelsMethods; - From f59204592571fa708b136392b7a2b95f8ed408cd Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 21 Feb 2024 11:49:27 +0100 Subject: [PATCH 144/250] refs #6784 Delete clientType.id and modify relationships in json and js --- db/dump/fixtures.before.sql | 36 +++++++++---------- .../10891-chocolateRuscus/00-firstScript.sql | 4 +++ modules/client/back/models/client-type.json | 7 ++-- modules/client/back/models/client.json | 2 +- .../order/back/methods/order/isEditable.js | 10 ++---- modules/order/back/methods/order/new.js | 9 ++--- .../back/methods/ticket/isEditableOrThrow.js | 13 +++---- modules/ticket/back/methods/ticket/new.js | 9 ++--- modules/ticket/back/models/sale.js | 10 ++---- 9 files changed, 37 insertions(+), 63 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 5ad6f30ea..b3f2088ab 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -352,12 +352,12 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`) ('46600', 4, 7), ('EC170150', 5, 8); -INSERT INTO `vn`.`clientType`(`id`, `code`, `type`) +INSERT INTO `vn`.`clientType`(`code`, `type`) VALUES - (1, 'normal', 'Normal'), - (2, 'internalUse', 'Autoconsumo'), - (3, 'handMaking', 'Confección'), - (4, 'loses', 'Mermas'); + ('normal', 'Normal'), + ('internalUse', 'Autoconsumo'), + ('handMaking', 'Confección'), + ('loses', 'Mermas'); INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`) VALUES @@ -371,20 +371,20 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) (4, 'GCN Channel'), (5, 'The Newspaper'); -INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk__`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`) +INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`) VALUES - (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), - (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), - (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), - (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), - (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'), - (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), - (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), - (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'), - (1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'), - (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'), - (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'), - (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'); + (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'), + (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), + (1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), + (1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'), + (1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'), + (1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'), + (1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'), + (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 diff --git a/db/versions/10891-chocolateRuscus/00-firstScript.sql b/db/versions/10891-chocolateRuscus/00-firstScript.sql index 8666e0b24..711850323 100644 --- a/db/versions/10891-chocolateRuscus/00-firstScript.sql +++ b/db/versions/10891-chocolateRuscus/00-firstScript.sql @@ -1,2 +1,6 @@ ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente; ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784'; +ALTER TABLE vn.clientType CHANGE COLUMN id id__ INT NOT NULL COMMENT '@deprecated 2024-02-20 refs #6784'; +ALTER TABLE vn.clientType DROP PRIMARY KEY; +ALTER TABLE vn.clientType ADD PRIMARY KEY (code); + diff --git a/modules/client/back/models/client-type.json b/modules/client/back/models/client-type.json index eeae845eb..ecf0c065f 100644 --- a/modules/client/back/models/client-type.json +++ b/modules/client/back/models/client-type.json @@ -7,12 +7,9 @@ } }, "properties": { - "id": { - "type": "number", - "id": true - }, "code": { - "type": "string" + "type": "string", + "id": true }, "type": { "type": "string" diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 3d381e186..550ac380e 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -197,7 +197,7 @@ "type": { "type": "belongsTo", "model": "ClientType", - "foreignKey": "clientTypeFk__" + "foreignKey": "typeFk" }, "businessType": { "type": "belongsTo", diff --git a/modules/order/back/methods/order/isEditable.js b/modules/order/back/methods/order/isEditable.js index 4ef76c11f..3fd2f993c 100644 --- a/modules/order/back/methods/order/isEditable.js +++ b/modules/order/back/methods/order/isEditable.js @@ -29,17 +29,11 @@ module.exports = Self => { where: {id: orderId}, fields: ['isConfirmed', 'clientFk'], include: [ - {relation: 'client', - scope: { - include: { - relation: 'type' - } - } - } + {relation: 'client'} ] }, myOptions); - if (exists && exists.client().type().code !== 'normal') + if (exists && exists.client().typeFk !== 'normal') return true; if (!exists || exists.isConfirmed === 1) diff --git a/modules/order/back/methods/order/new.js b/modules/order/back/methods/order/new.js index d65b18e12..2aad27c9a 100644 --- a/modules/order/back/methods/order/new.js +++ b/modules/order/back/methods/order/new.js @@ -49,17 +49,12 @@ module.exports = Self => { where: {id: addressId}, fields: ['clientFk'], include: [ - {relation: 'client', - scope: { - include: { - relation: 'type' - } - } + {relation: 'client' } ] }, myOptions); - if (address.client().type().code === 'normal') { + if (address.client().typeFk === 'normal') { if (!address.client().isActive) throw new UserError(`You can't create an order for an inactive client`); } diff --git a/modules/ticket/back/methods/ticket/isEditableOrThrow.js b/modules/ticket/back/methods/ticket/isEditableOrThrow.js index 41438be3a..16cff84f1 100644 --- a/modules/ticket/back/methods/ticket/isEditableOrThrow.js +++ b/modules/ticket/back/methods/ticket/isEditableOrThrow.js @@ -17,21 +17,16 @@ module.exports = Self => { const alertLevel = state ? state.alertLevel : null; const ticket = await models.Ticket.findById(id, { fields: ['clientFk'], - include: [{ - relation: 'client', - scope: { - include: { - relation: 'type' - } - } - }] + include: { + relation: 'client' + } }, myOptions); const isLocked = await models.Ticket.isLocked(id, myOptions); const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions); const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0); - const isNormalClient = ticket && ticket.client().type().code == 'normal'; + const isNormalClient = ticket && ticket.client().typeFk == 'normal'; const isEditable = !(alertLevelGreaterThanZero && isNormalClient); if (!ticket) diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index 288d38d77..8c27101ef 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -77,12 +77,7 @@ module.exports = Self => { where: {id: args.addressId}, fields: ['id', 'clientFk'], include: { - relation: 'client', - scope: { - include: { - relation: 'type' - } - } + relation: 'client' } }, myOptions); @@ -93,7 +88,7 @@ module.exports = Self => { if (args.agencyModeId) agencyMode = await models.AgencyMode.findById(args.agencyModeId, null, myOptions); - if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) { + if (address.client().typeFk === 'normal' && (!agencyMode || agencyMode.code != 'refund')) { const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions); if (!canCreateTicket) throw new UserError(`You can't create a ticket for an inactive client`); diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 31a2fbf35..17d228301 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -41,18 +41,12 @@ module.exports = Self => { include: { relation: 'client', scope: { - fields: ['id', 'clientTypeFk__'], - include: { - relation: 'type', - scope: { - fields: ['code', 'description'] - } - } + fields: ['id', 'typeFk'] } } }, ctx.options); - if (ticket?.client()?.type()?.code === 'loses') return; + if (ticket?.client()?.typeFk === 'loses') return; const isRefund = await models.TicketRefund.findOne({ fields: ['id'], From f0daf2dd9a92529f66f8ec54c326ee017788c5a7 Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 21 Feb 2024 12:22:27 +0100 Subject: [PATCH 145/250] refs #6784 Modify fixtures.before.sql --- db/dump/fixtures.before.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index b3f2088ab..f7bbcb512 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -373,6 +373,7 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`) VALUES + (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), From 65cb2d45fd41ed67ff11f6a8c6a4e444b1448656 Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 21 Feb 2024 12:30:25 +0100 Subject: [PATCH 146/250] refs #6784 Eliminate row in fixtures.before.sql --- db/dump/fixtures.before.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index f7bbcb512..0b9bb81a8 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -376,7 +376,6 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), - (1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'), (1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'), From a0cb32ea10e7a9083982262abe6270fa4f4406b3 Mon Sep 17 00:00:00 2001 From: ivanm Date: Thu, 22 Feb 2024 14:01:19 +0100 Subject: [PATCH 147/250] refs #6784 Delete unnecessary JOINs --- db/routines/vn/procedures/comparative_add.sql | 3 +-- db/routines/vn/procedures/itemShelving_filterBuyer.sql | 6 ++---- db/routines/vn/procedures/item_getBalance.sql | 3 +-- modules/ticket/back/models/sale.js | 8 +++++++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/db/routines/vn/procedures/comparative_add.sql b/db/routines/vn/procedures/comparative_add.sql index b64c20201..44f9686aa 100644 --- a/db/routines/vn/procedures/comparative_add.sql +++ b/db/routines/vn/procedures/comparative_add.sql @@ -47,12 +47,11 @@ BEGIN JOIN itemCategory ic ON ic.id = tp.categoryFk JOIN ticket t ON t.id = s.ticketFk JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.code = c.typeFk JOIN warehouse w ON w.id = t.warehouseFk JOIN address ad ON ad.id = t.addressFk LEFT JOIN province p ON p.id = ad.provinceFk WHERE tm.period BETWEEN vMaxPeriod AND vPeriod - AND ct.code <> 'loses' + AND c.typeFk <> 'loses' AND NOT w.code = 'inv' GROUP BY p.countryFk, s.itemFk, tm.period, t.warehouseFk; END IF; diff --git a/db/routines/vn/procedures/itemShelving_filterBuyer.sql b/db/routines/vn/procedures/itemShelving_filterBuyer.sql index d8f20d95f..7112aa48e 100644 --- a/db/routines/vn/procedures/itemShelving_filterBuyer.sql +++ b/db/routines/vn/procedures/itemShelving_filterBuyer.sql @@ -44,10 +44,9 @@ proc:BEGIN LEFT JOIN saleTracking st ON st.saleFk = s.id JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.code = c.typeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL - AND ct.code IN ('normal', 'trust') + AND c.typeFk IN ('normal', 'trust') GROUP BY s.itemFk ) sub2 ON sub2.itemFk = sub.itemFk UNION ALL @@ -70,10 +69,9 @@ proc:BEGIN LEFT JOIN saleTracking st ON st.saleFk = s.id JOIN ticket t ON t.id = s.ticketFk JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.code = c.typeFk WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND st.saleFk IS NULL - AND ct.code IN ('normal', 'trust') + AND c.typeFk IN ('normal', 'trust') GROUP BY s.itemFk ) sub5 ON sub5.itemFk = v.item_id WHERE v.calc_id = vCalcVisibleFk diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index 87d46db6d..95596d3bc 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -120,7 +120,7 @@ BEGIN TRUE, s.id, st.`order`, - ct.`code`, + c.typeFk, cb.claimFk, NULL FROM sale s @@ -128,7 +128,6 @@ BEGIN LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN state st ON st.`code` = ts.`code` JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.code = c.typeFk JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(), 'DELIVERED', IF (t.shipped > util.dayEnd(util.VN_CURDATE()), diff --git a/modules/ticket/back/models/sale.js b/modules/ticket/back/models/sale.js index 17d228301..22ad40184 100644 --- a/modules/ticket/back/models/sale.js +++ b/modules/ticket/back/models/sale.js @@ -41,7 +41,13 @@ module.exports = Self => { include: { relation: 'client', scope: { - fields: ['id', 'typeFk'] + fields: ['id', 'typeFk'], + include: { + relation: 'type', + scope: { + fields: ['code', 'description'] + } + } } } }, From 4a2032b9cdef49ffcb4d9e356ecdfa3626d04b76 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 23 Feb 2024 07:39:56 +0100 Subject: [PATCH 148/250] refs #5509 fix(EntryDms): sql --- db/versions/10841-orangeGalax/00-entryDms.sql | 9 +-------- modules/entry/back/models/entry-dms.json | 5 +++++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/db/versions/10841-orangeGalax/00-entryDms.sql b/db/versions/10841-orangeGalax/00-entryDms.sql index d8c495d6d..33ec1e3af 100644 --- a/db/versions/10841-orangeGalax/00-entryDms.sql +++ b/db/versions/10841-orangeGalax/00-entryDms.sql @@ -12,11 +12,4 @@ CREATE OR REPLACE TABLE `vn`.`entryDms` ( INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES - ('WorkerDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), - ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'), - ('Entry', 'uploadFile', 'WRITE', 'ALLOW', 'ROLE', 'employee'); - -UPDATE `salix`.`ACL` - SET accessType = '*' - WHERE model = 'ClientDms' - AND property = '*'; + ('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'); diff --git a/modules/entry/back/models/entry-dms.json b/modules/entry/back/models/entry-dms.json index 5bb3194c2..eb8300e83 100644 --- a/modules/entry/back/models/entry-dms.json +++ b/modules/entry/back/models/entry-dms.json @@ -9,6 +9,11 @@ "table": "entryDms" } }, + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg" + ], "properties": { "dmsFk": { "type": "number", From 131ae6b522ddd4288d7a3af49aa0b96eb750def0 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 23 Feb 2024 07:44:25 +0100 Subject: [PATCH 149/250] refs #6193 feat:modify inventory --- db/routines/vn/procedures/itemShelving_inventory.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/itemShelving_inventory.sql b/db/routines/vn/procedures/itemShelving_inventory.sql index ce2934426..73e438fbb 100644 --- a/db/routines/vn/procedures/itemShelving_inventory.sql +++ b/db/routines/vn/procedures/itemShelving_inventory.sql @@ -30,10 +30,11 @@ BEGIN ish.visible, p.sectorFk, it.workerFk buyer, - CONCAT('http:',ic.url, '/catalog/1600x900/',i.image) urlImage, + ic.url, + i.image, ish.isChecked, CASE - WHEN s.notPrepared > sm.parked THEN 0 + WHEN IFNULL (s.notPrepared, 0) > sm.parked THEN 0 WHEN sm.visible > sm.parked THEN 1 ELSE 2 END priority @@ -43,7 +44,7 @@ BEGIN JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk JOIN shelving sh ON sh.code = ish.shelvingFk JOIN parking p ON p.id = sh.parkingFk - JOIN ( + LEFT JOIN ( SELECT s.itemFk, sum(s.quantity) notPrepared FROM sale s JOIN ticket t ON t.id = s.ticketFk From 6e161dfee8b01662f0b3d69ed93bec56e280bc3c Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 23 Feb 2024 12:45:58 +0100 Subject: [PATCH 150/250] fix: refs #6878 column name --- db/routines/vn/procedures/workerTimeControl_clockIn.sql | 2 +- db/versions/10906-limeIvy/00-firstScript.sql | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/versions/10906-limeIvy/00-firstScript.sql diff --git a/db/routines/vn/procedures/workerTimeControl_clockIn.sql b/db/routines/vn/procedures/workerTimeControl_clockIn.sql index 77a628d10..e58528487 100644 --- a/db/routines/vn/procedures/workerTimeControl_clockIn.sql +++ b/db/routines/vn/procedures/workerTimeControl_clockIn.sql @@ -75,7 +75,7 @@ BEGIN SET vDated = DATE(vTimed); - SELECT IF(pc.code = 'driveCE', + SELECT IF(pc.code = 'driverCE', wc.dayBreakDriver, wc.dayBreak), wc.shortWeekBreak, diff --git a/db/versions/10906-limeIvy/00-firstScript.sql b/db/versions/10906-limeIvy/00-firstScript.sql new file mode 100644 index 000000000..6ce187d20 --- /dev/null +++ b/db/versions/10906-limeIvy/00-firstScript.sql @@ -0,0 +1,6 @@ +ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code; +ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) UNIQUE DEFAULT NULL; + +UPDATE vn.professionalCategory + SET code = 'driverCE' + WHERE name = 'Conductor C + E'; \ No newline at end of file From 7fdfd4fcb418d49a6e1b6b9ea570cc139c2756ef Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 23 Feb 2024 13:02:56 +0100 Subject: [PATCH 151/250] fix: refs #6276 desestructuring --- back/methods/collection/assign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/collection/assign.js b/back/methods/collection/assign.js index 8a2300e3e..b0c1d9995 100644 --- a/back/methods/collection/assign.js +++ b/back/methods/collection/assign.js @@ -20,7 +20,7 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const [info, okPacket, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk', + const [,, {collectionFk}] = await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk', [userId], myOptions); if (!collectionFk) throw new UserError('There are not picking tickets'); From 807670710915638b43125883cb3673c06ec7f703 Mon Sep 17 00:00:00 2001 From: davidd Date: Fri, 23 Feb 2024 13:29:36 +0100 Subject: [PATCH 152/250] refs #6372 --- .../10896-salmonOrchid/03-gastos_resumen.sql | 28 ++++++++++++------- .../10896-salmonOrchid/14-movement_label.sql | 4 +++ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql index dbb71bca2..19dc4cbbd 100644 --- a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql +++ b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql @@ -1,24 +1,32 @@ -ALTER TABLE IF EXISTS vn2008.gastos_resumen DROP FOREIGN KEY IF EXISTS gastos_resumen_expense_FK; -ALTER TABLE IF EXISTS `vn2008`.`gastos_resumen` RENAME `vn`.`expenseManual`; +DELETE FROM vn2008.gastos_resumen + WHERE Id_Gasto IN ( + SELECT DISTINCT g.Id_Gasto + FROM vn2008.gastos_resumen g + LEFT JOIN expense e ON e.id = g.Id_Gasto COLLATE utf8mb3_general_ci + WHERE e.id IS NULL + ); -ALTER TABLE IF EXISTS `vn`.`expenseManual` +ALTER TABLE `vn2008`.`gastos_resumen` DROP FOREIGN KEY gastos_resumen_expense_FK; +ALTER TABLE IF EXISTS `vn2008`.`gastos_resumen` RENAME `vn`.`expenseManual`; +ALTER TABLE `vn`.`expenseManual` CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) NOT NULL, CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) DEFAULT NULL, CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(11) NOT NULL; -ALTER TABLE IF EXISTS vn.expenseManual COLLATE=utf8mb3_general_ci; +ALTER TABLE vn.expenseManual MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; -ALTER TABLE IF EXISTS vn.expenseManual MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; - -ALTER TABLE IF EXISTS vn.expenseManual ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; - -ALTER TABLE IF EXISTS vn.expenseManual MODIFY COLUMN IF EXISTS companyFk int(10) unsigned NOT NULL; +ALTER TABLE vn.expenseManual DROP PRIMARY KEY; ALTER TABLE vn.expenseManual MODIFY COLUMN companyFk int(10) unsigned NULL; +ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; + UPDATE vn.expenseManual SET companyFK= NULL WHERE companyFk= 0; -ALTER TABLE IF EXISTS vn.expenseManual ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE vn.expenseManual ADD COLUMN id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST; + +ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk); \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/14-movement_label.sql b/db/versions/10896-salmonOrchid/14-movement_label.sql index a3ccf320d..40e4d302b 100644 --- a/db/versions/10896-salmonOrchid/14-movement_label.sql +++ b/db/versions/10896-salmonOrchid/14-movement_label.sql @@ -1,8 +1,12 @@ DROP TRIGGER IF EXISTS `vn2008`.`movement_label_afterUpdate`; +ALTER TABLE vn2008.movement_label DROP FOREIGN KEY movement_label_ibfk_1; + DROP VIEW IF EXISTS `vn`.`saleLabel`; ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`saleLabel`; ALTER TABLE IF EXISTS `vn`.`saleLabel` CHANGE COLUMN IF EXISTS `Id_movimiento` `saleFk` int(11) NOT NULL; + +ALTER TABLE vn.saleLabel ADD CONSTRAINT saleLabel_sale_FK FOREIGN KEY (saleFk) REFERENCES vn.sale(id) ON DELETE CASCADE ON UPDATE CASCADE; From d62c7ef0f53de0a93bb8b039405dcb8b9d352bfd Mon Sep 17 00:00:00 2001 From: davidd Date: Fri, 23 Feb 2024 13:45:48 +0100 Subject: [PATCH 153/250] refs #6372 --- .../10896-salmonOrchid/03-gastos_resumen.sql | 16 ++++++++-------- .../10896-salmonOrchid/14-movement_label.sql | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql index 19dc4cbbd..4da8148e0 100644 --- a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql +++ b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql @@ -13,20 +13,20 @@ CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) NOT NULL, CHANGE COLUMN IF EXISTS `importe` `amount` decimal(10,2) DEFAULT NULL, CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(11) NOT NULL; -ALTER TABLE vn.expenseManual MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; +ALTER TABLE `vn`.`expenseManual` MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL; -ALTER TABLE vn.expenseManual DROP PRIMARY KEY; +ALTER TABLE `vn`.`expenseManual` DROP PRIMARY KEY; -ALTER TABLE vn.expenseManual MODIFY COLUMN companyFk int(10) unsigned NULL; +ALTER TABLE `vn`.`expenseManual` MODIFY COLUMN companyFk int(10) unsigned NULL; -ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_expense_FK FOREIGN KEY IF NOT EXISTS (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; -UPDATE vn.expenseManual +UPDATE `vn`.`expenseManual` SET companyFK= NULL WHERE companyFk= 0; -ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_company_FK FOREIGN KEY IF NOT EXISTS (companyFk) REFERENCES vn.company(id) ON DELETE CASCADE ON UPDATE CASCADE; -ALTER TABLE vn.expenseManual ADD COLUMN id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST; +ALTER TABLE `vn`.`expenseManual` ADD COLUMN id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY FIRST; -ALTER TABLE vn.expenseManual ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk); \ No newline at end of file +ALTER TABLE `vn`.`expenseManual` ADD CONSTRAINT expenseManual_unique UNIQUE KEY IF NOT EXISTS (expenseFk,`year`,`month`,companyFk); \ No newline at end of file diff --git a/db/versions/10896-salmonOrchid/14-movement_label.sql b/db/versions/10896-salmonOrchid/14-movement_label.sql index 40e4d302b..194df6e1e 100644 --- a/db/versions/10896-salmonOrchid/14-movement_label.sql +++ b/db/versions/10896-salmonOrchid/14-movement_label.sql @@ -9,4 +9,4 @@ ALTER TABLE IF EXISTS `vn2008`.`movement_label` RENAME `vn`.`saleLabel`; ALTER TABLE IF EXISTS `vn`.`saleLabel` CHANGE COLUMN IF EXISTS `Id_movimiento` `saleFk` int(11) NOT NULL; -ALTER TABLE vn.saleLabel ADD CONSTRAINT saleLabel_sale_FK FOREIGN KEY (saleFk) REFERENCES vn.sale(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`saleLabel` ADD CONSTRAINT saleLabel_sale_FK FOREIGN KEY (saleFk) REFERENCES vn.sale(id) ON DELETE CASCADE ON UPDATE CASCADE; From efdc8eb1883368ffb0e553e8779b8ec0daf9fa82 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 23 Feb 2024 13:52:44 +0100 Subject: [PATCH 154/250] refs #5878 fix phone --- modules/supplier/back/methods/supplier/updateFiscalData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/supplier/back/methods/supplier/updateFiscalData.js b/modules/supplier/back/methods/supplier/updateFiscalData.js index 713b97cd4..f2cdd63be 100644 --- a/modules/supplier/back/methods/supplier/updateFiscalData.js +++ b/modules/supplier/back/methods/supplier/updateFiscalData.js @@ -19,7 +19,7 @@ module.exports = Self => { type: 'any' }, { arg: 'phone', - type: 'string' + type: 'any' }, { arg: 'sageTaxTypeFk', type: 'any' From 6dc41815754a853a14afc6fdf74f002bbfc883be Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 23 Feb 2024 13:54:32 +0100 Subject: [PATCH 155/250] refs #5878 fix pr --- modules/client/back/methods/client/updateFiscalData.js | 2 +- package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index f6ea80cfc..9a6255215 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -22,7 +22,7 @@ module.exports = Self => { }, { arg: 'fi', - type: 'any' + type: 'string' }, { arg: 'street', diff --git a/package.json b/package.json index 29d3369e6..302738524 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "form-data": "^4.0.0", "fs-extra": "^5.0.0", "ftps": "^1.2.0", - "glob": "^10.3.10", "gm": "^1.25.0", "got": "^10.7.0", "helmet": "^3.21.2", From 277bcafd899f0a1ee0409627eb4579570bf9a7d6 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 23 Feb 2024 14:11:11 +0100 Subject: [PATCH 156/250] fix(commit): refs #6403 hotFix add commit --- back/methods/mrw-config/createShipment.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index f0f7d66a2..06b5f0117 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -86,7 +86,13 @@ module.exports = Self => { const getLabelResponse = await sendXmlDoc('getLabel', {mrw, shipmentId}, 'text/xml'); const file = getTextByTag(getLabelResponse, 'EtiquetaFile'); - await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions); + try { + await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions); + await myOptions.transaction.commit(); + } catch (error) { + await myOptions.transaction.rollback(); + throw new UserError(`Cant update the expedition`); + } return file; }; From e971070f2f8e98d500871fb4604cac770077ab72 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 23 Feb 2024 14:21:40 +0100 Subject: [PATCH 157/250] fix: refs #6372 Version --- db/versions/10896-salmonOrchid/03-gastos_resumen.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql index 4da8148e0..1f5101df5 100644 --- a/db/versions/10896-salmonOrchid/03-gastos_resumen.sql +++ b/db/versions/10896-salmonOrchid/03-gastos_resumen.sql @@ -2,7 +2,7 @@ DELETE FROM vn2008.gastos_resumen WHERE Id_Gasto IN ( SELECT DISTINCT g.Id_Gasto FROM vn2008.gastos_resumen g - LEFT JOIN expense e ON e.id = g.Id_Gasto COLLATE utf8mb3_general_ci + LEFT JOIN vn.expense e ON e.id = g.Id_Gasto COLLATE utf8mb3_general_ci WHERE e.id IS NULL ); From d4459291b60c953eda7f071cb3f2a5cad88cfe98 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 23 Feb 2024 14:31:35 +0100 Subject: [PATCH 158/250] refs #5878 fix --- pnpm-lock.yaml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 41673b0fe..025be234e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,9 +29,6 @@ dependencies: ftps: specifier: ^1.2.0 version: 1.2.0 - glob: - specifier: ^10.3.10 - version: 10.3.10 gm: specifier: ^1.25.0 version: 1.25.0 @@ -134,8 +131,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.8 - version: 1.6.8 + specifier: ^1.6.7 + version: 1.6.7 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -1628,6 +1625,7 @@ packages: strip-ansi-cjs: /strip-ansi@6.0.1 wrap-ansi: 8.1.0 wrap-ansi-cjs: /wrap-ansi@7.0.0 + dev: true /@istanbuljs/load-nyc-config@1.1.0: resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} @@ -1915,6 +1913,7 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} requiresBuild: true + dev: true optional: true /@puppeteer/browsers@1.9.1: @@ -2634,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.8: - resolution: {integrity: sha512-jpadr6yAR9TQXPv+has5yOYAolR/YEzsxbLgMR7BoDrpLyVFLHJEy4Dfe+Hy11r3AmxCB/8lWM+La1YGvXMWOA==} + /@verdnatura/myt@1.6.7: + resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5 @@ -3028,6 +3027,7 @@ packages: /ansi-regex@6.0.1: resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} engines: {node: '>=12'} + dev: true /ansi-styles@2.2.1: resolution: {integrity: sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==} @@ -3049,6 +3049,7 @@ packages: /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} engines: {node: '>=12'} + dev: true /ansi-wrap@0.1.0: resolution: {integrity: sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw==} @@ -5206,6 +5207,7 @@ packages: /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + dev: true /ecc-jsbn@0.1.2: resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==} @@ -5264,6 +5266,7 @@ packages: /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + dev: true /emojis-list@3.0.0: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} @@ -6099,6 +6102,7 @@ packages: dependencies: cross-spawn: 7.0.3 signal-exit: 4.1.0 + dev: true /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} @@ -6492,6 +6496,7 @@ packages: minimatch: 9.0.3 minipass: 7.0.4 path-scurry: 1.10.1 + dev: true /glob@3.2.11: resolution: {integrity: sha512-hVb0zwEZwC1FXSKRPFTeOtN7AArJcJlI6ULGLtrstaswKNlrTJqAA+1lYlSUop4vjA423xlBzqfVS3iWGlqJ+g==} @@ -6506,7 +6511,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.1.2 + minimatch: 3.0.8 once: 1.4.0 path-is-absolute: 1.0.1 dev: true @@ -8000,6 +8005,7 @@ packages: '@isaacs/cliui': 8.0.2 optionalDependencies: '@pkgjs/parseargs': 0.11.0 + dev: true /jade@0.26.3: resolution: {integrity: sha512-mkk3vzUHFjzKjpCXeu+IjXeZD+QOTjUUdubgmHtHTDwvAO2ZTkMTTVrapts5CWz3JvJryh/4KWZpjeZrCepZ3A==} @@ -9248,6 +9254,7 @@ packages: /lru-cache@10.2.0: resolution: {integrity: sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==} engines: {node: 14 || >=16.14} + dev: true /lru-cache@2.7.3: resolution: {integrity: sha512-WpibWJ60c3AgAz8a2iYErDrcT2C7OmKnsWhIcHOjkUHFjkXncJhtLxNSqUmxRxRunpb5I8Vprd7aNSd2NtksJQ==} @@ -9653,6 +9660,7 @@ packages: engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 + dev: true /minimist-options@4.1.0: resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} @@ -9742,6 +9750,7 @@ packages: /minipass@7.0.4: resolution: {integrity: sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==} engines: {node: '>=16 || 14 >=14.17'} + dev: true /minizlib@1.3.3: resolution: {integrity: sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==} @@ -10836,6 +10845,7 @@ packages: dependencies: lru-cache: 10.2.0 minipass: 7.0.4 + dev: true /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -12166,6 +12176,7 @@ packages: /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} + dev: true /simple-concat@1.0.1: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} @@ -12622,6 +12633,7 @@ packages: eastasianwidth: 0.2.0 emoji-regex: 9.2.2 strip-ansi: 7.1.0 + dev: true /string_decoder@0.10.31: resolution: {integrity: sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==} @@ -12668,6 +12680,7 @@ packages: engines: {node: '>=12'} dependencies: ansi-regex: 6.0.1 + dev: true /strip-bom@2.0.0: resolution: {integrity: sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==} @@ -14170,6 +14183,7 @@ packages: ansi-styles: 6.2.1 string-width: 5.1.2 strip-ansi: 7.1.0 + dev: true /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} From 00a8b3dc4b1cd08d915ed548ddd8931e76b49507 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 23 Feb 2024 14:33:51 +0100 Subject: [PATCH 159/250] refs #5878 fix --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 025be234e..36bff2fe1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -131,8 +131,8 @@ devDependencies: specifier: ^7.7.7 version: 7.23.7(@babel/core@7.23.9) '@verdnatura/myt': - specifier: ^1.6.7 - version: 1.6.7 + specifier: ^1.6.8 + version: 1.6.8 angular-mocks: specifier: ^1.7.9 version: 1.8.3 @@ -2633,8 +2633,8 @@ packages: dev: false optional: true - /@verdnatura/myt@1.6.7: - resolution: {integrity: sha512-t/Q1T3QzHpZFdxwIyQL/CV5g+HJvWE6Q65VeA9k0svZdX/vezgnQ21nkI+wuvIurIl6BXqq2Arx7EWYkAhGNNA==} + /@verdnatura/myt@1.6.8: + resolution: {integrity: sha512-jpadr6yAR9TQXPv+has5yOYAolR/YEzsxbLgMR7BoDrpLyVFLHJEy4Dfe+Hy11r3AmxCB/8lWM+La1YGvXMWOA==} hasBin: true dependencies: '@sqltools/formatter': 1.2.5 From 94b49efb1fa602067654ff8370c4314a550d8861 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 23 Feb 2024 14:38:44 +0100 Subject: [PATCH 160/250] feat(fix): refs #6403 add transaction to createShipment --- back/methods/mrw-config/createShipment.js | 13 ++++++++----- .../methods/mrw-config/specs/createShipment.spec.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index 06b5f0117..b18040a3d 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -25,12 +25,15 @@ module.exports = Self => { Self.createShipment = async(expeditionFk, options) => { const myOptions = {}; + let tx; if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) - myOptions.transaction = await Self.beginTransaction({}); + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } const models = Self.app.models; const mrw = await models.MrwConfig.findOne(null, myOptions); @@ -88,10 +91,10 @@ module.exports = Self => { try { await models.Expedition.updateAll({id: expeditionFk}, {externalId: shipmentId}, myOptions); - await myOptions.transaction.commit(); + if (tx) await tx.commit(); } catch (error) { - await myOptions.transaction.rollback(); - throw new UserError(`Cant update the expedition`); + if (tx) await tx.rollback(); + throw new UserError(`Cant update `); } return file; }; diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js index e7bba524a..5aa69bac0 100644 --- a/back/methods/mrw-config/specs/createShipment.spec.js +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -31,7 +31,7 @@ const expedition1 = { let tx; let options; -describe('MRWConfig createShipment()', () => { +fdescribe('MRWConfig createShipment()', () => { beforeEach(async() => { options = tx = undefined; tx = await models.MrwConfig.beginTransaction({}); From 44668b24457da6d59c5a5dcbca1c0f9bc669cc59 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 23 Feb 2024 14:41:35 +0100 Subject: [PATCH 161/250] remove(focus). refs #6403 remove f --- back/methods/mrw-config/specs/createShipment.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/mrw-config/specs/createShipment.spec.js b/back/methods/mrw-config/specs/createShipment.spec.js index 5aa69bac0..e7bba524a 100644 --- a/back/methods/mrw-config/specs/createShipment.spec.js +++ b/back/methods/mrw-config/specs/createShipment.spec.js @@ -31,7 +31,7 @@ const expedition1 = { let tx; let options; -fdescribe('MRWConfig createShipment()', () => { +describe('MRWConfig createShipment()', () => { beforeEach(async() => { options = tx = undefined; tx = await models.MrwConfig.beginTransaction({}); From c8e0195510bcaa12f99aacbfe9b78b119e604404 Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 23 Feb 2024 14:44:59 +0100 Subject: [PATCH 162/250] fix throw error --- back/methods/mrw-config/createShipment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/mrw-config/createShipment.js b/back/methods/mrw-config/createShipment.js index b18040a3d..12263de03 100644 --- a/back/methods/mrw-config/createShipment.js +++ b/back/methods/mrw-config/createShipment.js @@ -94,7 +94,7 @@ module.exports = Self => { if (tx) await tx.commit(); } catch (error) { if (tx) await tx.rollback(); - throw new UserError(`Cant update `); + throw error; } return file; }; From 771545fa63350bca544f6701f659b40a9cc97d57 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 23 Feb 2024 15:01:57 +0100 Subject: [PATCH 163/250] refs #5640 fix(fixutures): client social name --- 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 becd65060..ac5281fb3 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -387,7 +387,7 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) - SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 + SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; From 1a1e7742d3ea5be78389d11d8f39a14b3ce79b34 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 23 Feb 2024 15:32:21 +0100 Subject: [PATCH 164/250] feat: refs #6513 create table --- .../10908-blueAsparagus/00-createSupplierDms.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/versions/10908-blueAsparagus/00-createSupplierDms.sql diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql new file mode 100644 index 000000000..fb592db0d --- /dev/null +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS vn.supplierDms( + id int(11) NOT NULL AUTO_INCREMENT, + supplierFk int(11) NOT NULL, + dmsFk int(11) NOT NULL, + editorFk int(10) unsigned DEFAULT NULL, + PRIMARY KEY (id), + CONSTRAINT clientDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id), + CONSTRAINT dmsFk FOREIGN KEY (dmsFk) REFERENCES dms(id) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT supplierFk FOREIGN KEY (supplierFk) REFERENCES supplier(id) ON UPDATE CASCADE +); From e0cee8f5591ba75ab3ba287eb42d7499c2d3c10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 15:41:30 +0100 Subject: [PATCH 165/250] feat: validar caracteres invocieIn.supplierref #6931 --- db/.pullinfo.json | 2 +- .../string_checkPrintableAndSpanishChars.sql | 15 +++++++++++++++ .../vn/triggers/invoiceIn_beforeInsert.sql | 4 ++++ .../vn/triggers/invoiceIn_beforeUpdate.sql | 5 ++++- .../10907-redAspidistra/00-firstScript.sql | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 db/routines/util/functions/string_checkPrintableAndSpanishChars.sql create mode 100644 db/versions/10907-redAspidistra/00-firstScript.sql diff --git a/db/.pullinfo.json b/db/.pullinfo.json index f4afbc5fb..a6f5ae236 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb" + "expeditionPallet_Print": "a8ea2872086aa4e3401350470b28f68d9efdbaff9fdff8c3d6b478756f7fad2a" } } } diff --git a/db/routines/util/functions/string_checkPrintableAndSpanishChars.sql b/db/routines/util/functions/string_checkPrintableAndSpanishChars.sql new file mode 100644 index 000000000..167795e90 --- /dev/null +++ b/db/routines/util/functions/string_checkPrintableAndSpanishChars.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`string_checkPrintableAndSpanishChars`( + vString VARCHAR(255) +) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** + * Validates whether the input string contains only printable characters + * and Spanish special characters (such as ¡, ÿ, etc.). + * + * @vString string to check + */ + RETURN vString REGEXP '^[ -~¡-ÿ]*$'; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql index c09e71ba1..504355df5 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql @@ -9,6 +9,10 @@ BEGIN DECLARE vActive TINYINT; DECLARE vWithholdingSageFk INT; + IF NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN + CALL util.throw('The invoiceIn cannot contain special characters'); + END IF; + SET NEW.editorFk = account.myUser_getId(); SELECT withholdingSageFk INTO vWithholdingSageFk diff --git a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql index ae69ad379..57134b033 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql @@ -3,9 +3,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat BEFORE UPDATE ON `invoiceIn` FOR EACH ROW BEGIN - DECLARE vWithholdingSageFk INT; + IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN + CALL util.throw('The invoiceIn cannot contain special characters'); + END IF; + SET NEW.editorFk = account.myUser_getId(); IF (SELECT COUNT(*) FROM vn.invoiceIn diff --git a/db/versions/10907-redAspidistra/00-firstScript.sql b/db/versions/10907-redAspidistra/00-firstScript.sql new file mode 100644 index 000000000..371c2c358 --- /dev/null +++ b/db/versions/10907-redAspidistra/00-firstScript.sql @@ -0,0 +1 @@ +-- Place your SQL code here From b9a2cad1f161a969c964289236f37e9652635ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 15:46:30 +0100 Subject: [PATCH 166/250] feat: validar caracteres invocieIn.supplierref #6931 --- db/.pullinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/.pullinfo.json b/db/.pullinfo.json index a6f5ae236..f4afbc5fb 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "a8ea2872086aa4e3401350470b28f68d9efdbaff9fdff8c3d6b478756f7fad2a" + "expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb" } } } From 29a96ede56209980c9a422b39c7cfb1df799eea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 15:58:00 +0100 Subject: [PATCH 167/250] feat: validar caracteres invocieIn.supplierref #6931 --- ...heckPrintableAndSpanishChars.sql => checkPrintableChars.sql} | 2 +- db/routines/vn/triggers/invoiceIn_beforeInsert.sql | 2 +- db/routines/vn/triggers/invoiceIn_beforeUpdate.sql | 2 +- db/versions/10907-redAspidistra/00-firstScript.sql | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) rename db/routines/util/functions/{string_checkPrintableAndSpanishChars.sql => checkPrintableChars.sql} (73%) delete mode 100644 db/versions/10907-redAspidistra/00-firstScript.sql diff --git a/db/routines/util/functions/string_checkPrintableAndSpanishChars.sql b/db/routines/util/functions/checkPrintableChars.sql similarity index 73% rename from db/routines/util/functions/string_checkPrintableAndSpanishChars.sql rename to db/routines/util/functions/checkPrintableChars.sql index 167795e90..a4addce24 100644 --- a/db/routines/util/functions/string_checkPrintableAndSpanishChars.sql +++ b/db/routines/util/functions/checkPrintableChars.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`string_checkPrintableAndSpanishChars`( +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`checkPrintableChars`( vString VARCHAR(255) ) RETURNS tinyint(1) DETERMINISTIC diff --git a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql index 504355df5..d036cc53d 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql @@ -10,7 +10,7 @@ BEGIN DECLARE vWithholdingSageFk INT; IF NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN - CALL util.throw('The invoiceIn cannot contain special characters'); + CALL util.throw('The invoiceIn reference contains invalid characters'); END IF; SET NEW.editorFk = account.myUser_getId(); diff --git a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql index 57134b033..f40fb6c81 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql @@ -6,7 +6,7 @@ BEGIN DECLARE vWithholdingSageFk INT; IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN - CALL util.throw('The invoiceIn cannot contain special characters'); + CALL util.throw('The invoiceIn reference contains invalid characters'); END IF; SET NEW.editorFk = account.myUser_getId(); diff --git a/db/versions/10907-redAspidistra/00-firstScript.sql b/db/versions/10907-redAspidistra/00-firstScript.sql deleted file mode 100644 index 371c2c358..000000000 --- a/db/versions/10907-redAspidistra/00-firstScript.sql +++ /dev/null @@ -1 +0,0 @@ --- Place your SQL code here From c18b42a7173c0fbe7fe3c5112d94b21576b25a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 16:01:55 +0100 Subject: [PATCH 168/250] feat: validar caracteres invocieIn.supplierref #6931 --- db/routines/vn/triggers/invoiceIn_beforeInsert.sql | 2 +- db/routines/vn/triggers/invoiceIn_beforeUpdate.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql index d036cc53d..2b80f2534 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeInsert.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeInsert.sql @@ -9,7 +9,7 @@ BEGIN DECLARE vActive TINYINT; DECLARE vWithholdingSageFk INT; - IF NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN + IF NOT util.checkPrintableChars(NEW.supplierRef) THEN CALL util.throw('The invoiceIn reference contains invalid characters'); END IF; diff --git a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql index f40fb6c81..4503c7dbd 100644 --- a/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql +++ b/db/routines/vn/triggers/invoiceIn_beforeUpdate.sql @@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat BEGIN DECLARE vWithholdingSageFk INT; - IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.string_checkPrintableAndSpanishChars(NEW.supplierRef) THEN + IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN CALL util.throw('The invoiceIn reference contains invalid characters'); END IF; From 3c038a060cd0cf98d641aab1e1487584259047a4 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 23 Feb 2024 16:27:49 +0100 Subject: [PATCH 169/250] feat: refs #6513 WIP triggers & logger --- db/routines/vn/triggers/supplierDms_afterDelete.sql | 12 ++++++++++++ db/routines/vn/triggers/supplierDms_beforeInsert.sql | 8 ++++++++ db/routines/vn/triggers/supplierDms_beforeUpdate.sql | 8 ++++++++ .../10908-blueAsparagus/00-createSupplierDms.sql | 9 ++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 db/routines/vn/triggers/supplierDms_afterDelete.sql create mode 100644 db/routines/vn/triggers/supplierDms_beforeInsert.sql create mode 100644 db/routines/vn/triggers/supplierDms_beforeUpdate.sql diff --git a/db/routines/vn/triggers/supplierDms_afterDelete.sql b/db/routines/vn/triggers/supplierDms_afterDelete.sql new file mode 100644 index 000000000..482decbb6 --- /dev/null +++ b/db/routines/vn/triggers/supplierDms_afterDelete.sql @@ -0,0 +1,12 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete` + AFTER DELETE ON `supplierDms` + FOR EACH ROW +BEGIN + INSERT INTO clientLog + SET `action` = 'delete', + `changedModel` = 'supplierDms', + `changedModelId` = OLD.dmsFk, + `userFk` = account.myUser_getId(); +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/supplierDms_beforeInsert.sql b/db/routines/vn/triggers/supplierDms_beforeInsert.sql new file mode 100644 index 000000000..adef31c2b --- /dev/null +++ b/db/routines/vn/triggers/supplierDms_beforeInsert.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=root@localhost TRIGGER vn.supplierDms_beforeInsert + BEFORE INSERT ON supplierDms + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql new file mode 100644 index 000000000..228c5e5ea --- /dev/null +++ b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql @@ -0,0 +1,8 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=root@localhost TRIGGER vn.supplierDms_beforeUpdate + BEFORE UPDATE ON supplierDms + FOR EACH ROW +BEGIN + SET NEW.editorFk = account.myUser_getId(); +END$$ +DELIMITER ; diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql index fb592db0d..23c45cc7b 100644 --- a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -4,7 +4,14 @@ CREATE TABLE IF NOT EXISTS vn.supplierDms( dmsFk int(11) NOT NULL, editorFk int(10) unsigned DEFAULT NULL, PRIMARY KEY (id), - CONSTRAINT clientDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id), + CONSTRAINT supplierDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id), CONSTRAINT dmsFk FOREIGN KEY (dmsFk) REFERENCES dms(id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT supplierFk FOREIGN KEY (supplierFk) REFERENCES supplier(id) ON UPDATE CASCADE ); + +ALTER TABLE `supplierLog` + MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier'; + +ALTER TABLE `vn`.`supplierDms` + ADD IF NOT EXISTS editorFk INT UNSIGNED NULL, + ADD CONSTRAINT supplierDms_fk_editor FOREIGN KEY IF NOT EXISTS (editorFk) REFERENCES account.`user`(id); \ No newline at end of file From bed4faceb703cfeb82d70871a2e3f351f81e64ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 18:04:43 +0100 Subject: [PATCH 170/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/entry_beforeUpdate.sql | 14 ++++++++++++++ db/routines/vn/triggers/travel_beforeUpdate.sql | 15 +++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index 91d490b21..27b1a53f3 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -47,5 +47,19 @@ BEGIN OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); END IF; + + IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk)THEN + DECLARE vHanAnyInvoiceBooked BOOL; + + SELECT COUNT(*) INTO vHanAnyInvoiceBooked + FROM entry e + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE e.id = NEW.id + AND ii.isBooked; + + IF vHanAnyInvoiceBooked THEN + CALL util.throw('The travel has entries with booked invoices') + END IF; + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index 2079cd21e..b12cf154b 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -17,5 +17,20 @@ BEGIN IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END IF; + + IF NOT (NEW.awbFk <=> OLD.awbFk)THEN + DECLARE vHanAnyInvoiceBooked BOOL; + + SELECT COUNT(*) INTO vHanAnyInvoiceBooked + FROM travel t + JOIN entry e ON e.travelFk =t.id + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE t.id = NEW.id + AND ii.isBooked; + + IF vHanAnyInvoiceBooked THEN + CALL util.throw('The travel has entries with booked invoices') + END IF; + END IF; END$$ DELIMITER ; From 5fe4f794cc569b70c0877263959747b7a70ffa00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 18:10:23 +0100 Subject: [PATCH 171/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/entry_beforeUpdate.sql | 7 +++---- db/routines/vn/triggers/travel_beforeUpdate.sql | 11 ++++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index 27b1a53f3..260af4908 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -6,6 +6,7 @@ BEGIN DECLARE vIsVirtual BOOL; DECLARE vPrintedCount INT; DECLARE vHasDistinctWarehouses BOOL; + DECLARE vHasAnyInvoiceBooked BOOL; SET NEW.editorFk = account.myUser_getId(); @@ -49,15 +50,13 @@ BEGIN END IF; IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk)THEN - DECLARE vHanAnyInvoiceBooked BOOL; - - SELECT COUNT(*) INTO vHanAnyInvoiceBooked + SELECT COUNT(*) INTO vHasAnyInvoiceBooked FROM entry e JOIN invoiceIn ii ON ii.id = e.invoiceInFk WHERE e.id = NEW.id AND ii.isBooked; - IF vHanAnyInvoiceBooked THEN + IF vHasAnyInvoiceBooked THEN CALL util.throw('The travel has entries with booked invoices') END IF; END IF; diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index b12cf154b..e4297352d 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate` BEFORE UPDATE ON `travel` FOR EACH ROW BEGIN + DECLARE vHasAnyInvoiceBooked BOOL; + SET NEW.editorFk = account.myUser_getId(); IF NOT (NEW.landed <=> OLD.landed) @@ -19,16 +21,15 @@ BEGIN END IF; IF NOT (NEW.awbFk <=> OLD.awbFk)THEN - DECLARE vHanAnyInvoiceBooked BOOL; - - SELECT COUNT(*) INTO vHanAnyInvoiceBooked + + SELECT COUNT(*) INTO vHasAnyInvoiceBooked FROM travel t JOIN entry e ON e.travelFk =t.id JOIN invoiceIn ii ON ii.id = e.invoiceInFk WHERE t.id = NEW.id AND ii.isBooked; - - IF vHanAnyInvoiceBooked THEN + + IF vHasAnyInvoiceBooked THEN CALL util.throw('The travel has entries with booked invoices') END IF; END IF; From 55bc6418f51fdf225a2ddc78e2eb804749e53e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 18:13:01 +0100 Subject: [PATCH 172/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/entry_beforeUpdate.sql | 2 +- db/routines/vn/triggers/travel_beforeUpdate.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index 260af4908..1be493a07 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -57,7 +57,7 @@ BEGIN AND ii.isBooked; IF vHasAnyInvoiceBooked THEN - CALL util.throw('The travel has entries with booked invoices') + CALL util.throw('The travel has entries with booked invoices'); END IF; END IF; END$$ diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index e4297352d..e622a8e6d 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -20,7 +20,7 @@ BEGIN CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END IF; - IF NOT (NEW.awbFk <=> OLD.awbFk)THEN + IF NOT (NEW.awbFk <=> OLD.awbFk) THEN SELECT COUNT(*) INTO vHasAnyInvoiceBooked FROM travel t @@ -30,7 +30,7 @@ BEGIN AND ii.isBooked; IF vHasAnyInvoiceBooked THEN - CALL util.throw('The travel has entries with booked invoices') + CALL util.throw('The travel has entries with booked invoices'); END IF; END IF; END$$ From 4cc950011e625272d2289fe1e4274334e5b37bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 23 Feb 2024 18:15:07 +0100 Subject: [PATCH 173/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/travel_beforeUpdate.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index e622a8e6d..dbac6459b 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -21,10 +21,9 @@ BEGIN END IF; IF NOT (NEW.awbFk <=> OLD.awbFk) THEN - SELECT COUNT(*) INTO vHasAnyInvoiceBooked FROM travel t - JOIN entry e ON e.travelFk =t.id + JOIN entry e ON e.travelFk = t.id JOIN invoiceIn ii ON ii.id = e.invoiceInFk WHERE t.id = NEW.id AND ii.isBooked; From 13aca51f2ddd194d60d3d446f0b5939aaf51de19 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 23 Feb 2024 18:57:32 +0100 Subject: [PATCH 174/250] build: refs #6915 dump & rocket shows Jenkins URL --- Jenkinsfile | 2 +- db/dump/.dump/data.sql | 139 +- db/dump/.dump/privileges.sql | 233 +- db/dump/.dump/structure.sql | 6512 ++++++++++++++-------------------- db/dump/.dump/triggers.sql | 284 +- 5 files changed, 3052 insertions(+), 4118 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 20cfbd31d..821316c87 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -240,7 +240,7 @@ pipeline { channel: 'vn-database', message: "*DB version uploaded:* ${message}" +"\n$COMMITTER_EMAIL ($BRANCH_NAME)" - +"\n$GIT_URL/commit/$GIT_COMMIT", + +"\n$RUN_DISPLAY_URL", rawMessage: true ) } diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 8367471bc..6e4d9947c 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,7 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('vn-database','10861','6685a201143a320920bbe04db7f8d0d1bd32d415','2024-02-15 10:04:54','10886'); +INSERT INTO `version` VALUES ('vn-database','10889','03550573b07783c82b290df4ebaeb91c1030bc18','2024-02-23 09:55:56','10906'); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); @@ -586,6 +586,40 @@ INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_rollback.sql' INSERT INTO `versionLog` VALUES ('vn-database','10832','00-util_tx_start.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10832','01-update_procedure_TravelCloneWithEntries.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10832','02-grant_privileges_util_tx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:52',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','01-Bancos_poliza.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:52',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','03-Entradas_orden.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','04-Pagares.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','05-Proveedores_gestdoc.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','06-Remesas.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','07-Saldos_Prevision.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','08-Series.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','09-Split_lines.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','10-Split.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','11-Vehiculos_consumo.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','12-account_conciliacion.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','13-account_detail.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','14-account_detail_type.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','15-agencia_descuadre.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','16-airline.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','17-airport.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','18-albaran.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','19-albaran_gestdoc.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','20-albaran_state.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','21-awb_component.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','22-awb_component_template.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','23-awb_component_type.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','24-awb_gestdoc.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','25-awb_recibida.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','26-awb_role.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','27-awb_unit.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','28-balance_nest_tree.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','29-buy_edi_k012.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','30-buy_edi_k03.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','31-buy_edi_k04.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','32-definitivo.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','33-dropTables.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10835','34-permisos.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10838','00-createInventoryConfig.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-07 22:36:27',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10845','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10848','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:45:55',NULL,NULL); @@ -612,8 +646,30 @@ INSERT INTO `versionLog` VALUES ('vn-database','10853','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10853','00-secondScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10854','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-01-30 16:20:34',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10855','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10856','00-cloneAcl.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10857','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10858','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10861','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-02-15 09:46:06',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10863','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:59',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10865','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:59',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10867','00-createAclInvoiceIn.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:32:59',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10867','01-createInvoiceInCorrection.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10868','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10869','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10871','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10872','00-aclUpdateFiscalData.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10873','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10874','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10876','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10878','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10879','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10882','00-vehicle.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10883','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10884','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10888','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-16 07:39:57',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10889','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 09:55:56',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10903','00-professionalCategoryAddCode.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 08:38:28',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -821,7 +877,6 @@ INSERT INTO `roleInherit` VALUES (142,35,75,NULL); INSERT INTO `roleInherit` VALUES (143,15,49,NULL); INSERT INTO `roleInherit` VALUES (145,17,67,NULL); INSERT INTO `roleInherit` VALUES (146,38,13,NULL); -INSERT INTO `roleInherit` VALUES (147,101,35,NULL); INSERT INTO `roleInherit` VALUES (148,101,13,NULL); INSERT INTO `roleInherit` VALUES (150,15,56,NULL); INSERT INTO `roleInherit` VALUES (152,69,47,NULL); @@ -973,6 +1028,7 @@ INSERT INTO `roleInherit` VALUES (356,123,125,NULL); INSERT INTO `roleInherit` VALUES (357,36,35,NULL); INSERT INTO `roleInherit` VALUES (358,36,49,NULL); INSERT INTO `roleInherit` VALUES (359,129,35,NULL); +INSERT INTO `roleInherit` VALUES (360,101,129,NULL); INSERT INTO `userPassword` VALUES (1,7,1,0,2,1); @@ -1211,7 +1267,7 @@ INSERT INTO `ACL` VALUES (293,'RoleInherit','*','*','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (294,'RoleRole','*','*','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'); INSERT INTO `ACL` VALUES (296,'Collection','*','READ','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (297,'Sale','refund','WRITE','ALLOW','ROLE','invoicing'); +INSERT INTO `ACL` VALUES (297,'Sale','clone','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'); @@ -1238,8 +1294,8 @@ INSERT INTO `ACL` VALUES (323,'InvoiceOut','refund','WRITE','ALLOW','ROLE','clai INSERT INTO `ACL` VALUES (324,'Ticket','refund','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (325,'Ticket','refund','WRITE','ALLOW','ROLE','salesAssistant'); INSERT INTO `ACL` VALUES (326,'Ticket','refund','WRITE','ALLOW','ROLE','claimManager'); -INSERT INTO `ACL` VALUES (327,'Sale','refund','WRITE','ALLOW','ROLE','salesAssistant'); -INSERT INTO `ACL` VALUES (328,'Sale','refund','WRITE','ALLOW','ROLE','claimManager'); +INSERT INTO `ACL` VALUES (327,'Sale','clone','WRITE','ALLOW','ROLE','salesAssistant'); +INSERT INTO `ACL` VALUES (328,'Sale','clone','WRITE','ALLOW','ROLE','claimManager'); INSERT INTO `ACL` VALUES (329,'TicketRefund','*','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (330,'ClaimObservation','*','WRITE','ALLOW','ROLE','salesPerson'); INSERT INTO `ACL` VALUES (331,'ClaimObservation','*','READ','ALLOW','ROLE','salesPerson'); @@ -1593,7 +1649,7 @@ INSERT INTO `ACL` VALUES (725,'Account','findOne','READ','ALLOW','ROLE','employe INSERT INTO `ACL` VALUES (726,'Account','findById','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (727,'Account','find','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (728,'Account','exists','READ','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (729,'Sale','refund','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (729,'Sale','clone','WRITE','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (730,'Ticket','setDeleted','WRITE','ALLOW','ROLE','deliveryAssistant'); INSERT INTO `ACL` VALUES (732,'Sale','isInPreparing','*','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (733,'Train','*','READ','ALLOW','ROLE','production'); @@ -1652,6 +1708,15 @@ INSERT INTO `ACL` VALUES (785,'VnRole','*','WRITE','ALLOW','ROLE','it'); INSERT INTO `ACL` VALUES (786,'State','isAllEditable','READ','ALLOW','ROLE','delivery'); INSERT INTO `ACL` VALUES (787,'Ticket','makePdfList','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (788,'Ticket','invoiceTicketsAndPdf','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (789,'InvoiceIn','*','*','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (790,'InvoiceIn','getSerial','READ','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (791,'InvoiceIn','corrective','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (792,'InvoiceInCorrection','*','*','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (793,'Supplier','updateAllFiscalData','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (794,'Supplier','updateFiscalData','WRITE','ALLOW','ROLE','buyer'); +INSERT INTO `ACL` VALUES (795,'Ticket','myLastModified','*','ALLOW','ROLE','production'); +INSERT INTO `ACL` VALUES (796,'MrwConfig','cancelShipment','WRITE','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (797,'MrwConfig','createShipment','WRITE','ALLOW','ROLE','employee'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); @@ -1972,7 +2037,7 @@ INSERT INTO `continent` VALUES (3,'África','AF'); INSERT INTO `continent` VALUES (4,'Europa','EU'); INSERT INTO `continent` VALUES (5,'Oceanía','OC'); -INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,28,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (1,'VN','VERDNATURA',1,110,763,0,0,0,0,27,NULL,'/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (22,'shopping','COMPRAS',2,3,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (23,'CMA','CAMARA',13,14,NULL,72,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL,NULL); INSERT INTO `department` VALUES (31,'it','INFORMATICA',4,5,NULL,72,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL,NULL); @@ -1980,53 +2045,53 @@ INSERT INTO `department` VALUES (34,'accounting','CONTABILIDAD',6,7,NULL,0,0,0,1 INSERT INTO `department` VALUES (35,'finance','FINANZAS',8,9,NULL,0,0,0,1,0,1,'/1/',NULL,1,'begonya@verdnatura.es',1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (36,'labor','LABORAL',10,11,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (37,'PROD','PRODUCCION',12,35,NULL,72,1,1,1,11,1,'/1/',NULL,0,NULL,0,1,1,1,NULL,NULL); -INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (38,'picking','SACADO',15,16,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL); +INSERT INTO `department` VALUES (39,'packing','ENCAJADO',17,18,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL); INSERT INTO `department` VALUES (41,'administration','ADMINISTRACION',36,37,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (43,'VT','VENTAS',38,65,NULL,0,0,0,1,13,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (44,'management','GERENCIA',66,67,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (46,'delivery','REPARTO',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',72,73,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',74,75,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (43,'VT','VENTAS',38,67,NULL,0,0,0,1,14,1,'/1/',NULL,1,'',1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (44,'management','GERENCIA',68,69,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (45,'logistic','LOGISTICA',70,71,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (46,'delivery','REPARTO',72,73,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (48,'storage','ALMACENAJE',74,75,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (49,NULL,'PROPIEDAD',76,77,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (52,NULL,'CARGA AEREA',78,79,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (53,'marketing','MARKETING Y COMUNICACIÓN',80,81,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (54,NULL,'ORNAMENTALES',82,83,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (55,NULL,'TALLER NATURAL',19,20,14548,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1118,NULL); INSERT INTO `department` VALUES (56,NULL,'TALLER ARTIFICIAL',21,22,8470,72,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,1927,NULL); -INSERT INTO `department` VALUES (58,'CMP','CAMPOS',82,85,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',86,87,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,1,NULL,1,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (58,'CMP','CAMPOS',84,87,NULL,72,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (59,'maintenance','MANTENIMIENTO',88,89,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (60,'claims','RECLAMACIONES',39,40,NULL,72,0,0,2,0,43,'/1/43/',NULL,1,NULL,1,1,0,0,NULL,NULL); INSERT INTO `department` VALUES (61,NULL,'VNH',90,93,NULL,73,0,0,1,1,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (66,NULL,'VERDNAMADRID',94,95,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (68,NULL,'COMPLEMENTOS',23,24,NULL,72,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,0,0,NULL,NULL); INSERT INTO `department` VALUES (69,NULL,'VERDNABARNA',96,97,NULL,74,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',39,40,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (80,NULL,'EQUIPO J VALLES',41,42,4250,72,0,0,2,0,43,'/1/43/','jvp_equipo',1,'equipojvalles@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (86,NULL,'LIMPIEZA',98,99,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (89,NULL,'COORDINACION',100,101,NULL,0,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (90,NULL,'TRAILER',91,92,NULL,0,0,0,2,0,61,'/1/61/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (91,'artificial','ARTIFICIAL',25,26,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',41,42,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',43,44,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',1,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',45,46,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',1,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',47,48,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',49,50,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',51,52,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (92,NULL,'EQUIPO SILVERIO',43,44,1203,0,0,0,2,0,43,'/1/43/','sdc_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (94,NULL,'EQUIPO J BROCAL',45,46,3797,0,0,0,2,0,43,'/1/43/','jes_equipo',0,'equipojbrocal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (95,NULL,'EQUIPO C ZAMBRANO',47,48,4667,0,0,0,2,0,43,'/1/43/','czg_equipo',0,'equipoczambrano@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (96,NULL,'EQUIPO C LOPEZ',49,50,4661,0,0,0,2,0,43,'/1/43/','cla_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (115,NULL,'EQUIPO CLAUDI',51,52,3810,0,0,0,2,0,43,'/1/43/','csr_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (123,NULL,'EQUIPO ELENA BASCUÑANA',53,54,7102,0,0,0,2,0,43,'/1/43/','ebt_equipo',0,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',102,103,NULL,72,0,0,1,0,1,'/1/',NULL,0,NULL,1,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',53,54,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',1,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (125,NULL,'EQUIPO MIRIAM MAR',55,56,1118,0,0,0,2,0,43,'/1/43/','mir_equipo',0,'equipomirgir@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',27,28,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL); INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',83,84,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); -INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',55,56,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',57,58,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',59,60,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (130,NULL,'REVISION',31,32,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL); +INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',85,86,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL); +INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',57,58,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (133,'franceTeam','EQUIPO FRANCIA',59,60,1731,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'francia@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (134,'portugalTeam','EQUIPO PORTUGAL',61,62,6264,0,0,0,2,0,43,'/1/43/','pt_equipo',1,'portugal@verdnatura.es',0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (135,'routers','ENRUTADORES',104,105,NULL,0,0,0,1,0,1,'/1/',NULL,1,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (136,'heavyVehicles','VEHICULOS PESADOS',106,107,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); INSERT INTO `department` VALUES (137,'sorter','SORTER',108,109,NULL,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',61,62,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',63,64,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); -INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (139,NULL,'EQUIPO J SORIA ',63,64,3803,0,0,0,2,0,43,'/1/43/','jss_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (140,'hollandTeam','EQUIPO HOLANDA',65,66,NULL,0,0,0,2,0,43,'/1/43/','nl_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL); +INSERT INTO `department` VALUES (141,NULL,'PREVIA',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL); INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL); INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL); diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 4012a6406..ebc3c0dd2 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -101,18 +101,17 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','value','alexm@%','00 INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developerBoss','general_log','juan@10.5.1.1','0000-00-00 00:00:00','Select,Drop',''); INSERT IGNORE INTO `tables_priv` VALUES ('','dipole','employee','expedition_PrintOut','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','logistic','marketPlace','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','definitivo','alexm@%','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','definitivo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','manager','item_group','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','item_feature','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','item_feature','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemTag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','itemCategoryL10n','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','credit','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','guest','Tipos','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','producer','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','mdbVersion','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','province','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','versiones','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','mistakeType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','warehouse','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','account','itemTaxCountry','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); @@ -165,8 +164,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','location','root@p INSERT IGNORE INTO `tables_priv` VALUES ('','account','hr','mailAliasAccount','$itBoss@10.0.2.69','2022-08-03 23:44:43','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','tag','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','news','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k012','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k012','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k012','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k012','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','myMenu','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','myBasket','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','guest','message','root@pc-juan.dyn.verdnatura.es','2022-08-03 23:44:43','Select',''); @@ -177,7 +176,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','account','hr','account','$itBoss@1 INSERT IGNORE INTO `tables_priv` VALUES ('','salix','android','AccessToken','jenkins@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','itemTag','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','itemTag','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k03','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','psico','hr','examQuestion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','psico','hr','exam','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','manager','exchange','alexm@%','0000-00-00 00:00:00','Select',''); @@ -221,7 +220,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','edi','salesPerson','item_groupToOf INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','account','myTicketService','root@10.2.3.180','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','sage','administrative','movConta','carlosap@172.16.5.232','2022-08-03 23:44:43','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','hedera','employee','mailConfig','jgallego@81.202.38.190','2022-08-03 23:44:43','','Select'); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_conciliacion','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_conciliacion','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','accion_dits','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','guest','config','juan@%','0000-00-00 00:00:00','','Select'); INSERT IGNORE INTO `tables_priv` VALUES ('','util','account','config','$itBoss@10.0.2.69','2022-08-03 23:44:43','Select',''); @@ -243,49 +242,47 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','time','guillermo@db-p INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developer','slow_log','$itBoss@10.0.2.68','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developer','user','$itBoss@10.0.2.68','2022-08-03 23:44:43','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','mysql','developer','proc','$itBoss@10.0.2.68','2022-08-03 23:44:43','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_detail','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail_type','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','account_detail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail_type','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','entryEditor','Compres','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Agencias','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_component','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','account','developer','emailUser','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','agencia_descuadre','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','airline','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airline','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','agency_warehouse','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','salesPerson','inter','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','albaran_state','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Articles','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_template','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component_type','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_gestdoc','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_recibida','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_role','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_unit','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','balance_nest_tree','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_template','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_component_type','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','awb_gestdoc','alexm@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_role','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_unit','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financialBoss','balance_nest_tree','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','deliveryBoss','inter','juan@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Bancos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','barcodes','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','barcodes','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','buyer','inter','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','inter','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','alexm@%','0000-00-00 00:00:00','Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','agency','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buySource','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','buy_edi','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k03','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','buy_edi_k04','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesAssistant','Clientes','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','v_empresa','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','v_empresa','alexm@%','0000-00-00 00:00:00','Select',''); @@ -293,17 +290,15 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','chanel','al INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','v_empresa','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Clientes','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','V_edi_item_track','alexm@%','0000-00-00 00:00:00','Select,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','v_compres','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_botanic_export','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','manager','v_botanic_export','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','v_Articles_botanical','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Clientes','alexm@%','0000-00-00 00:00:00','Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','recibida_vencimiento','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','jerarquia','juan@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','warehouse','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerBusinessAgreement','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifa_componentes','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','officeBoss','Vehiculos','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','tarifa_componentes_series','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Entradas','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemType','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -314,31 +309,30 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','producer','alexm@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','officeBoss','ticket_observation','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Cajas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmrConfig','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb_recibida','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','awb','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Compres','alexm@%','0000-00-00 00:00:00','Select,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','buy_edi','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','ACL','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','palletizer','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Colores','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','state','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Consignatarios','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','travel','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','price_fixed','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','Vehiculos','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','printQueue','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','preservedBoss','travel','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','alexm@%','0000-00-00 00:00:00','Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','travel','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerAssistant','itemType','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Cubos','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos_Retorno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','state','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','travel','alexm@%','0000-00-00 00:00:00','Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Bancos_poliza','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','production','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','edi_bucket_type','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','edi_bucket','alexm@%','0000-00-00 00:00:00','Select',''); @@ -362,7 +356,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas','ale INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','ticket_observation','juan@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Entradas_dits','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','sale','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas_orden','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas_orden','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','ticket_observation','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_turno','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','entrySource','alexm@%','0000-00-00 00:00:00','Select',''); @@ -375,11 +369,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','tickets_gestdoc' INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tickets_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Tickets','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Entradas','root@localhost','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','expeditions','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Facturas','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Facturas','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Tintas','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','filtros','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Entradas_kop','alexm@%','0000-00-00 00:00:00','Select',''); @@ -413,17 +404,15 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','calendarHolidays' INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','mandato','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','mandato','alexm@%','0000-00-00 00:00:00','Select,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','iva_group','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','invoiceCorrection','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','intrastat_data','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','intrastat_data','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','greugeType','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInIntrastat','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','greuge','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Intrastat','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Intrastat','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','integra2_province','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Grupos','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Greuges','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','gesttip','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Gastos','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','dms','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','continent','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','Movimientos_componentes','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Movimientos_mark','alexm@%','0000-00-00 00:00:00','Delete',''); @@ -461,16 +450,14 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Proveedo INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','PreciosEspeciales','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','agencia_descuadre','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','price_fixed','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','gestdoc','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','iva_tipo','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','iva_codigo','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','pago','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Proveedores','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Proveedores_cargueras','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Proveedores_gestdoc','juan@%','0000-00-00 00:00:00','Select,Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','palletizer','Facturas','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','expedition','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Proveedores_gestdoc','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','claimManager','recibida','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','recibida','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','adminOfficer','recibida_iva','alexm@%','0000-00-00 00:00:00','Delete',''); @@ -481,10 +468,10 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesPerson','Recibos','a INSERT IGNORE INTO `tables_priv` VALUES ('','vn','officeBoss','bankEntity','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','agency','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','bankEntity','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','reference_min','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','versiones','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','reference_rate','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','saleComponent','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','Remesas','juan@%','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','Remesas','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Reservas','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','cmr','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','Rutas','alexm@%','0000-00-00 00:00:00','Select',''); @@ -504,9 +491,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','bufferState','juan INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','coolerAssist','state','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','absenceType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','artificialBoss','Entradas_Auto','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','XDiario','alexm@%','0000-00-00 00:00:00','Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','alexm@%','0000-00-00 00:00:00','Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionAssi','Vehiculos_consumo','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','employee','tblContadores','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','buyMark','juan@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','calendar','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); @@ -558,7 +543,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','sale','alexm INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','packingSite','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionPlus','province','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','productionPlus','province','alexm@%','0000-00-00 00:00:00','Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','property','juan@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','pbx','grafana','sip','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','','Select'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','clientCredit','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','saleTracking','alexm@%','0000-00-00 00:00:00','Delete',''); @@ -568,8 +552,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleTracking','ale INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','client','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','client','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleVolume','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Proveedores_gestdoc','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','awb_gestdoc','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Proveedores_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','awb_gestdoc','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','Cubos','alexm@%','0000-00-00 00:00:00','Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','routesMonitor','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select','Update'); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminBoss','sale','alexm@%','0000-00-00 00:00:00','Insert',''); @@ -582,8 +566,8 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','saleComponent' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','marketingBoss','saleGoal','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleGroup','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','saleGroupDetail','alexm@%','0000-00-00 00:00:00','Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','alexm@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','account_detail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','awb_component_type','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vncontrol','employee','accion','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','volumeConfig','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','currency','alexm@%','0000-00-00 00:00:00','Select',''); @@ -592,12 +576,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','currency','a INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','creditClassification','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','creditInsurance','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','currency','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','dms','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','workerTimeControl','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','defaulter','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','deliveryMethod','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','deliveryMethod','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','dms','alexm@%','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','administrative','v_compres','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','deviceProductionUser','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','department','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','deviceProductionConfig','alexm@%','0000-00-00 00:00:00','Select',''); @@ -607,7 +590,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionBoss','absenceType' INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionConfig','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','deviceProductionUser','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','disabilityGrade','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','dms','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','duaInvoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','dmsType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','duaEntry','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); @@ -657,7 +639,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','artificialBoss','entryObserva INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','dock','alexm@%','0000-00-00 00:00:00','Select,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','expeditionTruck','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','expeditionPallet','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','expense','guillermo@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','expense','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','claimManager','expeditionScan','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','entryObservation','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','ppeGroup','alexm@%','0000-00-00 00:00:00','Select',''); @@ -672,7 +654,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','postCode','alexm@%','000 INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','pgcMaster','alexm@%','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemBarcode','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','host','alexm@%','0000-00-00 00:00:00','Select,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','Facturas','guillermo@10.5.1.4','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticket','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceIn','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceIn','alexm@%','0000-00-00 00:00:00','Select',''); @@ -687,7 +668,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesPerson','invoiceCorrecti INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','invoiceIn','alexm@%','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInDueDay','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','invoiceInDueDay','alexm@%','0000-00-00 00:00:00','Insert,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','invoiceInIntrastat__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','invoiceInIntrastat__','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','invoiceInTax','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','invoiceInSage','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','invoiceInTax','alexm@%','0000-00-00 00:00:00','Select',''); @@ -728,8 +709,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelving','ale INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelvingLog','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ticketWeekly','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','itemShelvingLog','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airport','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','airport','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','itemShelvingSale','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hrBoss','Tickets','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimEnd','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -839,7 +819,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','recovery','al INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','photocell','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','edi','grafana','supplyResponse','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','customer','last_buy','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','financial','Greuges_type','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','client','carlosap@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','invoiceInTax','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesAssistant','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','postgresql','hr','profile_type','alexm@%','0000-00-00 00:00:00','Select',''); @@ -871,12 +851,11 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','bi','salesPerson','tarifa_componen INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','expeditionLog','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','salesPerson','clientNewBorn','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleItemShelving__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','salesBoss','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','expedition','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemShelvingStock','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','saleParking__','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','property','juan@10.5.1.1','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','property','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','employee','config','alexm@%','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleEvent','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicle','alexm@%','0000-00-00 00:00:00','Insert,Update',''); @@ -963,6 +942,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','travel','alexm@%', INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelClonedWeekly','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bi','employee','facturacion_media_anual','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','travelObservation','alexm@%','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','bankPolicy','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','travelThermograph','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','tillConfig','juan@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','till','juan@%','0000-00-00 00:00:00','Select',''); @@ -1013,7 +993,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerRelatives','guille INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','ticketPackagingStartingStock','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','supplierPackaging','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','workerDocument','alexm@%','0000-00-00 00:00:00','Select,Insert',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','hr','gestdoc','alexm@%','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','ink','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zone','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','XDiario','alexm@%','0000-00-00 00:00:00','Select',''); @@ -1028,7 +1007,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zonePromo__','alex INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingConfig','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accountingType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','agencyMode','alexm@%','0000-00-00 00:00:00','Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerBoss','XDiario','alexm@%','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','employee','visible','juan@10.5.1.2','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerAssist','productionConfig','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','cache','employee','available','alexm@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -1181,8 +1159,6 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','packager','glsExpedition','ju INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','clientType','juan@10.5.1.2','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','expeditionMistake','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','deviceProductionLog','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesAssistant','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Select,Insert,Update',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','salesBoss','workerTeam','juan@10.5.1.2','0000-00-00 00:00:00','Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','vehicleState','juan@10.5.1.1','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','machineDetail','juan@10.5.1.1','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','machineDms','juan@10.5.1.1','0000-00-00 00:00:00','Select',''); @@ -1258,13 +1234,12 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','url','juan@db- INSERT IGNORE INTO `tables_priv` VALUES ('','salix','developer','userConfigView','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimRedelivery','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','clientRisk','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyerBoss','itemType','carlosap@db-proxy1.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','bs','buyer','sale','guillermo@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','chain','juan@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','routesMonitor','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','warehouse_pickup','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','cl_main','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Vehiculos','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryAssistant','routeAction','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','ticket_observation','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryAssistant','Tickets_turno','alexm@db-proxy2.static.verdnatura.es','0000-00-00 00:00:00','Select',''); @@ -1336,8 +1311,48 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','item','guillermo@db-p INSERT IGNORE INTO `tables_priv` VALUES ('','vn','coolerBoss','itemShelving','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','negativeOrigin','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','deliveryBoss','Vehiculos_consumo','carlosap@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','entryOrder','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','project','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','ink','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','supplierDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','remittance','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','adminOfficer','vehicleConsumption','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','vehicleConsumption','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','accountReconciliation','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','accountDetail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountDetail','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accountDetailType','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','airline','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','airport','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','deliveryNote','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','deliveryNoteDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','deliveryNoteState','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awbComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbComponent','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbComponentTemplate','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbComponentType','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbComponentType','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Insert',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','awbDms','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','awbInvoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hrBoss','awbInvoiceIn','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbRole','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','logistic','awbUnit','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financialBoss','balanceNestTree','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK1','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK1','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK2','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK2','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK3','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK3','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','buyer','ektK4','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','edi','administrative','ektK4','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','productionAssi','dmsStorageBox','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; @@ -1613,26 +1628,14 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_fixMisfit','P INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','employee','buy_tarifas_entry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','calculoremesas','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hr','cc_to_iban','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','cc_to_iban','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','client_checkBalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','addressTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','client_getSalesPersonByTicket','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','handmadeBoss','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','travelDetail','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','claimManager','traslado','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','traslado','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','administrative','supplierStatement','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','supplierStatement','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','supplierStatement','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','red','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','salesPerson','red','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','administrative','intrastat_neto','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','productionAssi','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','artificialBoss','confection_control_source','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','nz','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','deliveryAssistant','preordenarruta','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','pay','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','bi','salesAssistant','defaultersFromDate','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1661,7 +1664,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDUR INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','cooler','buyultimate','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofyear','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','officeBoss','fustcontrol','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','claimManager','dayend','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','employee','log_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','srt','employee','moving_between','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); @@ -1814,10 +1816,8 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','logistic','travel_weeklyclone' INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByBuy','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerAssist','itemproposal','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getsuppliersdebt','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','agency','desglose_volume','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','bi','productionAssi','rutasanalyze','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','productionPlus','workerCreateExternal','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','adminBoss','XDiario_Quadrator','PROCEDURE','juan@10.5.1.2','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_NOW','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UNIX_TIMESTAMP','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_DATE','FUNCTION','juan@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1826,7 +1826,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_UTC_TIMESTAMP','F INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelving_getsaledate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','ticket_setState','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','invoicing','invoiceout_new','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','sale_replaceItem','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hr','ledger_next','PROCEDURE','guillermo@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','deliveryAssistant','workerjourney_replace','PROCEDURE','alexm@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','account','developerBoss','role_sync','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1945,6 +1945,16 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_start','PROCEDURE INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPrices','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByAwb','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_recalcPricesByEntry','PROCEDURE','guillermo@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','hr','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','util','financial','accountNumberToIban','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','hrBoss','supplier_statement','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','XDiario_check','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','travel_getDetailFromContinent','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','entry_getTransfer','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','intrastat_estimateNet','FUNCTION','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); /*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1958,37 +1968,38 @@ USE `mysql`; /*!40000 ALTER TABLE `global_priv` DISABLE KEYS */; INSERT IGNORE INTO `global_priv` VALUES ('','account','{\"access\": 0, \"is_role\": true,\"version_id\":100707}'); -INSERT IGNORE INTO `global_priv` VALUES ('','adminBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','adminOfficer','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','administrative','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','adminBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','adminOfficer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','administrative','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','agency','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 20000, \"max_user_connections\": 50, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','android','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','artificialBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','assetManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyer','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','buyerAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','buyerBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','claimManager','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','cooler','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerAssist','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','coolerBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','customer','{\"access\": 0, \"max_questions\": 0, \"max_updates\": 30000, \"max_connections\": 300000, \"max_user_connections\": 400, \"max_statement_time\": 0.000000, \"is_role\": true,\"version_id\":100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','delivery','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','deliveryAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','deliveryBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','developer','{\"access\": 5909905728, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','developerBoss','{\"access\":33554432,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','employee','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); -INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 100707, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','handmadeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','hedera-web','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); -INSERT IGNORE INTO `global_priv` VALUES ('','hrBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','hr','{\"access\": 0, \"is_role\": true, \"version_id\": 101106}'); +INSERT IGNORE INTO `global_priv` VALUES ('','hrBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','invoicing','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','itBoss','{\"access\": 541165846527, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','itManagement','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); @@ -2001,9 +2012,9 @@ INSERT IGNORE INTO `global_priv` VALUES ('','maintenanceBoss','{\"access\":0,\" INSERT IGNORE INTO `global_priv` VALUES ('','manager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketing','{\"access\": 0, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','marketingBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','officeBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','packager','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','palletizer','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','palletizerBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','preservedBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','production','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); @@ -2011,9 +2022,9 @@ INSERT IGNORE INTO `global_priv` VALUES ('','productionAssi','{\"access\": 0, \ INSERT IGNORE INTO `global_priv` VALUES ('','productionBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','productionPlus','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','root','{\"access\": 549755781119, \"version_id\": 100705, \"is_role\": true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','salesAssistant','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','salesBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); -INSERT IGNORE INTO `global_priv` VALUES ('','salesPerson','{\"access\": 0, \"is_role\": true,\"version_id\":100707}'); +INSERT IGNORE INTO `global_priv` VALUES ('','salesAssistant','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','salesBoss','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','salesPerson','{\"access\": 0, \"is_role\": true,\"version_id\":101106}'); INSERT IGNORE INTO `global_priv` VALUES ('','salesTeamBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','salix','{\"access\":33555456,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','sysadmin','{\"access\": 201326592, \"is_role\": true, \"version_id\": 100707}'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index 696cb8359..55072e639 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -2868,34 +2868,6 @@ SET character_set_client = @saved_cs_client; -- /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vData DOUBLE) RETURNS double - DETERMINISTIC -BEGIN -/** - * Devuelve 0, si el parámetro es NULL: - */ - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vData,0); - - RETURN vResult; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `analisis_ventas_evolution_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -3223,7 +3195,7 @@ BEGIN LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna LEFT JOIN vn2008.province p ON p.province_id = cs.province_id - LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id + LEFT JOIN vn.warehouse w ON w.id = t.warehouse_id WHERE bt.fecha >= vLastMonth AND r.mercancia; END ;; DELIMITER ; @@ -3253,8 +3225,8 @@ BEGIN -- Reclamaciones demasiado sensibles - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe, Greuges_type_id,Id_Ticket) + INSERT INTO vn.greuge(shipped, clientFk, description, + amount, greugeTypeFk, ticketFk) SELECT cm.Fecha , cm.Id_Cliente , concat('Claim ',cm.id,' : ', m.Concepte) @@ -3271,8 +3243,8 @@ BEGIN -- Reclamaciones que pasan a Maná - INSERT INTO vn2008.Greuges(Fecha, Id_Cliente, Comentario, - Importe , Greuges_type_id,Id_Ticket) + INSERT INTO vn.greuge(shipped, clientFk, description, + amount, greugeTypeFk, ticketFk) SELECT cm.Fecha , cm.Id_Cliente , concat('Claim_mana ',cm.id,' : ', m.Concepte) @@ -3315,12 +3287,12 @@ BEGIN AND s.alert_level >= 3; DELETE g.* - FROM vn2008.Greuges g - JOIN tmp.ticket_list t ON g.Id_Ticket = t.Id_Ticket - WHERE Greuges_type_id = 2; + FROM vn.greuge g + JOIN tmp.ticket_list t ON g.ticketFk = t.Id_Ticket + WHERE g.greugeTypeFk = 2; - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, - Greuges_type_id, Id_Ticket) + INSERT INTO vn.greuge(clientFk, description, amount,shipped, + greugeTypeFk, ticketFk) SELECT Id_Cliente ,concat('recobro ', m.Id_Ticket), - round(SUM(mc.Valor*Cantidad),2) AS dif @@ -3372,13 +3344,13 @@ BEGIN -- Calculamos el porcentaje del recobro para añadirlo al precio de venta UPDATE bi.claims_ratio cr JOIN ( - SELECT Id_Cliente, nz(SUM(Importe)) AS Greuge - FROM vn2008.Greuges - WHERE Fecha <= util.VN_CURDATE() - GROUP BY Id_Cliente + SELECT clientFk Id_Cliente, IFNULL(SUM(amount), 0) AS Greuge + FROM vn.greuge + WHERE shipped <= util.VN_CURDATE() + GROUP BY clientFk ) g ON g.Id_Cliente = cr.Id_Cliente - SET recobro = GREATEST(0,round(nz(Greuge) / - (nz(Consumo) * vMonthToRefund / 12 ) ,3)); + SET recobro = GREATEST(0,round(IFNULL(Greuge, 0) / + (IFNULL(Consumo, 0) * vMonthToRefund / 12 ) ,3)); -- Protección neonatos UPDATE bi.claims_ratio cr @@ -3626,8 +3598,8 @@ BEGIN WHERE hasChanged AND date = vDate; DECLARE invoices CURSOR FOR - SELECT Vencimiento, importe FROM vn2008.Facturas f - WHERE f.Fecha >= '2016-01-01' AND f.Id_Cliente = vClient ORDER BY f.Fecha DESC; + SELECT dued Vencimiento, amount importe FROM vn.invoiceOut + WHERE issued >= '2016-01-01' AND clientFk = vClient ORDER BY issued DESC; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -3793,8 +3765,8 @@ BEGIN FROM vn.ticket t JOIN vn2008.Clientes cli ON cli.Id_cliente = t.clientFk - LEFT JOIN vn2008.expeditions e ON e.ticket_id = t.id - JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.EsBulto + LEFT JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.freightItemFk JOIN vn.zone z ON t.zoneFk = z.id WHERE t.shipped between datSTART AND datEND @@ -3838,17 +3810,17 @@ BEGIN CREATE TEMPORARY TABLE tmp.dp_aux (PRIMARY KEY (ticketFk)) ENGINE = MEMORY - SELECT dp.ticketFk, sum(Importe) Importe + SELECT dp.ticketFk, sum(g.amount) Importe FROM tmp.dp - JOIN vn2008.Greuges g ON g.Id_Ticket = dp.ticketFk - WHERE Greuges_type_id = 1 -- dif_porte + JOIN vn.greuge g ON g.ticketFk = dp.ticketFk + WHERE g.greugeTypeFk = 1 -- dif_porte GROUP BY dp.ticketFk; UPDATE tmp.dp JOIN tmp.dp_aux USING(ticketFk) SET greuge = IFNULL(Importe,0); - INSERT INTO vn2008.Greuges (Id_Cliente,Comentario,Importe,Fecha, Greuges_type_id, Id_Ticket) + INSERT INTO vn.greuge (clientFk,description,amount,shipped,greugeTypeFk,ticketFk) SELECT dp.clientFk , concat('dif_porte ', dp.ticketFk) , round(IFNULL(dp.teorico,0) - IFNULL(dp.practico,0) - IFNULL(dp.greuge,0),2) as Importe @@ -3922,9 +3894,9 @@ BEGIN CREATE TEMPORARY TABLE maxInvoice (PRIMARY KEY (Id_Cliente)) ENGINE = MEMORY - SELECT DISTINCT Id_Cliente, max(Fecha) as maxFecha - FROM vn2008.Facturas - GROUP BY Id_Cliente + SELECT DISTINCT clientFk Id_Cliente, max(issued) as maxFecha + FROM vn.invoiceOut + GROUP BY clientFk HAVING maxFecha < timestampadd(month,-2,datFEC); WHILE datFEC < util.VN_CURDATE() DO @@ -3933,10 +3905,10 @@ BEGIN SELECT Id_Cliente, datFEC as Fecha, Greuge, Ventas, 0 FROM ( - SELECT Id_Cliente, sum(Importe) as Greuge - FROM vn2008.Greuges - where Fecha <= datFEC - group by Id_Cliente + SELECT clientFk Id_Cliente, sum(amount) as Greuge + FROM vn.greuge + where shipped <= datFEC + group by clientFk ) sub RIGHT JOIN @@ -5610,16 +5582,16 @@ BEGIN c.movil, c.POBLACION poblacion, p.`name` provincia, - vn2008.red(f.futur) futur, + ROUND(f.futur, 2) futur, c.Credito credito, pm.`name` forma_pago, - vn2008.red(c365 / 12) consumo_medio365, - vn2008.red(c365) consumo365, - vn2008.red(CmLy.peso) peso_mes_año_pasado, - vn2008.red(CmLy.peso * 1.19) objetivo, + ROUND(c365 / 12, 2) consumo_medio365, + ROUND(c365, 2) consumo365, + ROUND(CmLy.peso, 2) peso_mes_año_pasado, + ROUND(CmLy.peso * 1.19, 2) objetivo, tr.CodigoTrabajador, - vn2008.red(mes_actual.consumo) consumoMes, - vn2008.red(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0)) como_lo_llevo, + ROUND(mes_actual.consumo, 2) consumoMes, + ROUND(IFNULL(mes_actual.consumo, 0) - IFNULL(CmLy.peso * 1.19, 0), 2) como_lo_llevo, DATE(LastTicket) ultimo_ticket, dead.muerto, g.Greuge, @@ -5627,9 +5599,9 @@ BEGIN FROM vn2008.Clientes c LEFT JOIN - (SELECT g.Id_Cliente, CAST( SUM(Importe) as DECIMAL(12,2)) AS Greuge - FROM vn2008.Greuges g - JOIN vn.`client` c ON c.id = g.Id_Cliente + (SELECT g.clientFk Id_Cliente, CAST( SUM(g.amount) as DECIMAL(12,2)) AS Greuge + FROM vn.greuge g + JOIN vn.`client` c ON c.id = g.clientFk LEFT JOIN vn.worker w ON c.salesPersonFk = w.id WHERE (c.salesPersonFk = vWorker OR w.bossFk = vWorker) GROUP BY Id_Cliente @@ -5688,9 +5660,9 @@ BEGIN GROUP BY c.Id_Cliente) CmLy ON CmLy.Id_Cliente = c.Id_Cliente LEFT JOIN (SELECT c.Id_Cliente, - IF(MAX(Fecha) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto - FROM vn2008.Facturas f - JOIN vn2008.Clientes c ON c.Id_cliente = f.Id_Cliente + IF(MAX(io.issued) < DATE_FORMAT(TIMESTAMPADD(MONTH, - 1, vDate), '%Y- %m-01'), TRUE, FALSE) muerto + FROM vn.invoiceOut io + JOIN vn2008.Clientes c ON c.Id_cliente = io.clientFk LEFT JOIN vn2008.Trabajadores tr ON c.Id_Trabajador = tr.Id_Trabajador WHERE (c.Id_Trabajador = vWorker OR tr.boss = vWorker) GROUP BY Id_Cliente) dead ON dead.Id_Cliente = c.Id_Cliente @@ -6331,11 +6303,11 @@ BEGIN AND Fechacobro > vFromDated AND Fechacobro <= vToDated UNION ALL - SELECT g.Id_Cliente, g.Importe - FROM vn2008.Greuges g - WHERE Greuges_type_id = vManaGreugeTypeId - AND Fecha > vFromDated - AND Fecha <= vToDated + SELECT clientFk, amount + FROM vn.greuge + WHERE greugeTypeFk = vManaGreugeTypeId + AND shipped > vFromDated + AND shipped <= vToDated UNION ALL SELECT clientFk, mana FROM vn.clientManaCache @@ -7118,9 +7090,9 @@ BEGIN ENGINE = MEMORY SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + JOIN vn.invoiceOut io ON io.id = t.Factura + WHERE year(io.issued) = vYear + AND month(io.issued) = vMonth; INSERT INTO bs.ventas_contables(year , month @@ -7250,9 +7222,9 @@ BEGIN (PRIMARY KEY (Id_Ticket)) SELECT Id_Ticket FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; + JOIN vn.invoiceOut io ON io.id = t.Factura + WHERE year(io.issued) = vYear + AND month(io.issued) = vMonth; SELECT vYear Año, vMonth Mes, @@ -7321,20 +7293,20 @@ BEGIN WHERE date BETWEEN @datSTART AND @datEND ) tm LEFT JOIN - (SELECT DISTINCT tm.yearMonth, f.Id_Cliente , 1 as Compra - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART + (SELECT DISTINCT tm.yearMonth, io.clientFk Id_Cliente , 1 as Compra + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND) f ON f.yearMonth = tm.yearMonth AND f.Id_Cliente = c.Id_Cliente; UPDATE tmp.VivosMuertos vm JOIN - (SELECT MIN(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth + (SELECT MIN(tm.yearMonth) firstMonth, io.clientFk Id_Cliente + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND + GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Nuevo = 1; @@ -7343,11 +7315,11 @@ BEGIN UPDATE tmp.VivosMuertos vm JOIN ( - SELECT MAX(tm.yearMonth) firstMonth, f.Id_Cliente - FROM vn2008.Facturas f - JOIN vn2008.time tm ON tm.date = f.Fecha - WHERE Fecha BETWEEN @datSTART AND @datEND - GROUP BY f.Id_Cliente ) fm ON fm.firstMonth = vm.yearMonth + SELECT MAX(tm.yearMonth) firstMonth, io.clientFk Id_Cliente + FROM vn.invoiceOut io + JOIN vn2008.time tm ON tm.date = io.issued + WHERE io.issued BETWEEN @datSTART AND @datEND + GROUP BY io.clientFk) fm ON fm.firstMonth = vm.yearMonth AND fm.Id_Cliente = vm.Id_Cliente SET Muerto = 1 @@ -8128,7 +8100,8 @@ proc: BEGIN DECLARE vReserveDate DATETIME; DECLARE vParams CHAR(100); DECLARE vInventoryDate DATE; - DECLARE vIsLogifloraDay BOOLEAN; + DECLARE vLifeScope DATE; + DECLARE vWarehouseFkInventory INT; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN @@ -8149,43 +8122,42 @@ proc: BEGIN LEAVE proc; END IF; - -- Invoca al procedimiento que genera el stock virtual de Logiflora, si coincide con la peticion de refresco del disponible - IF vn.isLogifloraDay(vDated, vWarehouse) THEN - -- CALL edi.floramondo_offerRefresh; - SET vIsLogifloraDay = TRUE; - ELSE - SET vIsLogifloraDay = FALSE; - END IF; - -- Calcula algunos parámetros necesarios SET vStartDate = TIMESTAMP(vDated, '00:00:00'); SELECT inventoried INTO vInventoryDate FROM vn.config; + SELECT DATE_SUB(vStartDate, INTERVAL MAX(life) DAY) INTO vLifeScope FROM vn.itemType; SELECT SUBTIME(util.VN_NOW(), reserveTime) INTO vReserveDate FROM hedera.orderConfig; + SELECT w.id INTO vWarehouseFkInventory + FROM vn.warehouse w + WHERE w.code = 'inv'; + -- Calcula el ultimo dia de vida para cada producto DROP TEMPORARY TABLE IF EXISTS itemRange; CREATE TEMPORARY TABLE itemRange (PRIMARY KEY (itemFk)) ENGINE = MEMORY - SELECT c.itemFk, - IF(it.life IS NULL, - NULL, - TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) ended - FROM ( - SELECT b.itemFk, MAX(t.landed) landing - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse w ON w.id = t.warehouseInFk - WHERE t.landed BETWEEN vInventoryDate AND vStartDate - AND t.warehouseInFk = vWarehouse - AND NOT e.isExcludedFromAvailable - GROUP BY b.itemFk - ) c - JOIN vn.item i ON i.id = c.itemFk + SELECT i.id itemFk, + util.dayEnd(DATE_ADD(c.maxLanded, INTERVAL it.life DAY)) ended, it.life + FROM vn.item i + LEFT JOIN ( + SELECT b.itemFk, MAX(t.landed) maxLanded + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + WHERE t.landed BETWEEN vLifeScope AND vStartDate + AND t.warehouseInFk = vWarehouse + AND t.warehouseOutFk <> vWarehouseFkInventory + AND it.life + AND NOT e.isExcludedFromAvailable + GROUP BY b.itemFk + ) c ON i.id = c.itemFk JOIN vn.itemType it ON it.id = i.typeFk - HAVING ended >= vStartDate OR ended IS NULL; + HAVING ended >= vStartDate OR life IS NULL; -- Calcula el ATP DELETE FROM available WHERE calc_id = vCalc; @@ -8209,7 +8181,7 @@ proc: BEGIN WHERE i.landed >= vStartDate AND (ir.ended IS NULL OR i.landed <= ir.ended) AND i.warehouseInFk = vWarehouse - AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) + AND ISNULL(wf.entryFk) UNION ALL SELECT i.itemFk, i.shipped, i.quantity FROM vn.itemEntryOut i @@ -9319,6 +9291,61 @@ CREATE TABLE `ektConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `ektK1` +-- + +DROP TABLE IF EXISTS `ektK1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ektK1` ( + `id` smallint(6) unsigned NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características negativas de los articulos de subasta'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ektK2` +-- + +DROP TABLE IF EXISTS `ektK2`; +/*!50001 DROP VIEW IF EXISTS `ektK2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `ektK2` AS SELECT + 1 AS `id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ektK3` +-- + +DROP TABLE IF EXISTS `ektK3`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ektK3` ( + `id` smallint(6) unsigned NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características fitosanitarias de los articulos de subasta'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ektK4` +-- + +DROP TABLE IF EXISTS `ektK4`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ektK4` ( + `id` smallint(6) unsigned NOT NULL, + `description` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características calidad de los articulos de subasta'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `ektRecent` -- @@ -10398,6 +10425,7 @@ proc:BEGIN DECLARE vHasItemGroup BOOL; DECLARE vDescription VARCHAR(255); DECLARE vSaleFk INT; + DECLARE vDefaultEntry INT; -- Carga los datos necesarios del EKT SELECT e.ref, qty, package, putOrderFk MOD 1000000, i2.id , NOT ISNULL(eea.addressFk), NOT ISNULL(igto.group_code), @@ -10417,6 +10445,9 @@ proc:BEGIN CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription); LEAVE proc; END IF; + + SELECT defaultEntry INTO vDefaultEntry + FROM vn.entryConfig; -- Asigna la entrada SELECT vn.ekt_getEntry(vSelf) INTO vEntryFk; @@ -10476,10 +10507,9 @@ proc:BEGIN LEFT JOIN ekt l ON l.ref = e.ref LEFT JOIN vn.buy b ON b.ektFk = l.id LEFT JOIN vn.item i ON i.id = b.itemFk - JOIN vn2008.config cfg WHERE e.id = vSelf AND l.id != vSelf - AND b.itemFk != cfg.generic_item + AND b.itemFk != vDefaultEntry AND IF(t.s1, l.s1 = e.s1, TRUE) AND IF(t.s2, l.s2 = e.s2, TRUE) AND IF(t.s3, l.s3 = e.s3, TRUE) @@ -10518,7 +10548,7 @@ proc:BEGIN SELECT vEntryFk, vSelf, (@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue, - IFNULL(vItem, cfg.generic_item) itemFk, + IFNULL(vItem, vDefaultEntry) itemFk, e.qty stickers, @pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing, IFNULL(b.`grouping`, e.pac), @@ -10529,8 +10559,7 @@ proc:BEGIN FROM ekt e LEFT JOIN vn.buy b ON b.id = vBuy LEFT JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN vn.supplier s ON e.pro = s.id - JOIN vn2008.config cfg + LEFT JOIN vn.supplier s ON e.pro = s.id WHERE e.id = vSelf LIMIT 1; @@ -10761,7 +10790,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_scan`(vBarcode VARCHAR(512)) BEGIN /** - * Busca transaciones a partir de un código de barras, las marca como escaneadas + * Busca transaciones a partir de un codigo de barras, las marca como escaneadas * y las devuelve. * Ver https://wiki.verdnatura.es/index.php/Ekt#Algoritmos_de_lectura * @@ -10832,7 +10861,7 @@ BEGIN INSERT INTO tmp.ekt SELECT id FROM ekt - WHERE fec = vFec + WHERE fec >= vFec - INTERVAL 1 DAY AND (( vKlo = vDefaultKlo AND (klo = vKlo OR klo IS NULL OR klo = 0) @@ -10841,7 +10870,7 @@ BEGIN AND auction = vAuction AND agj = vShortAgj) ) - ORDER BY agj DESC + ORDER BY agj DESC, fec DESC LIMIT 1; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; @@ -18516,10 +18545,11 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceIn_add`(vInvoiceInFk INT, vX BEGIN /** * Traslada la info de contabilidad relacionada con las facturas recibidas - * + * * @vInvoiceInFk Factura recibida * @vXDiarioFk Id tabla XDiario - */ + */ + DECLARE vInvoiceInOriginalFk INT; DECLARE vDone BOOL DEFAULT FALSE; DECLARE vBase DOUBLE; DECLARE vVat DOUBLE; @@ -18536,25 +18566,25 @@ BEGIN DECLARE vInvoiceTypeInformative VARCHAR(1); DECLARE vIsInformativeExportation BOOL DEFAULT FALSE; - DECLARE vCursor CURSOR FOR + DECLARE vCursor CURSOR FOR SELECT it.taxableBase, CAST((( it.taxableBase / 100) * t.PorcentajeIva) AS DECIMAL (10,2)), t.PorcentajeIva, it.transactionTypeSageFk, it.taxTypeSageFk, tty.isIntracommunity, - tt.ClaveOperacionDefecto + tt.ClaveOperacionDefecto FROM vn.invoiceIn i JOIN vn.invoiceInTax it ON it.InvoiceInFk = i.id JOIN TiposIva t ON t.CodigoIva = it.taxTypeSageFk JOIN taxType tty ON tty.id = t.CodigoIva JOIN TiposTransacciones tt ON tt.CodigoTransaccion = it.transactionTypeSageFk LEFT JOIN vn.dua d ON d.id = vInvoiceInFk - WHERE i.id = vInvoiceInFk + WHERE i.id = vInvoiceInFk AND d.id IS NULL; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - + DELETE FROM movContaIVA WHERE id = vXDiarioFk; @@ -18577,22 +18607,22 @@ BEGIN vTaxCode, vIsIntracommunity, vOperationCode; - - IF vDone THEN + + IF vDone THEN LEAVE l; END IF; - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; - IF vOperationCode IS NOT NULL THEN + IF vOperationCode IS NOT NULL THEN UPDATE movContaIVA SET ClaveOperacionFactura = vOperationCode WHERE id = vXDiarioFk; END IF; - + SET vCounter = vCounter + 1; - CASE vCounter + CASE vCounter WHEN 1 THEN UPDATE movContaIVA SET BaseIva1 = vBase, @@ -18628,31 +18658,31 @@ BEGIN WHERE id = vXDiarioFk; ELSE SELECT vXDiarioFk INTO vXDiarioFk; - END CASE; + END CASE; IF vIsIntracommunity THEN UPDATE movContaIVA SET Intracomunitaria = TRUE WHERE id = vXDiarioFk; END IF; - - SET vTransactionCodeOld = vTransactionCode; - SET vTaxCodeOld = vTaxCode; - + + SET vTransactionCodeOld = vTransactionCode; + SET vTaxCodeOld = vTaxCode; + END LOOP; CLOSE vCursor; SELECT d.ASIEN AND x.ASIEN IS NULL INTO vIsInformativeExportation FROM vn.dua d - LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN + LEFT JOIN vn.XDiario x ON x.ASIEN = d.ASIEN AND x.SERIE = vSerialDua COLLATE utf8mb3_unicode_ci WHERE d.ASIEN = ( SELECT ASIEN - FROM vn.XDiario + FROM vn.XDiario WHERE id = vXDiarioFk) LIMIT 1; - + UPDATE movContaIVA mci JOIN tmp.invoiceIn ii ON ii.id = vInvoiceInFk JOIN vn.XDiario x ON x.id = mci.id @@ -18664,13 +18694,13 @@ BEGIN mci.Serie = ii.serial, mci.Factura = ii.id, mci.FechaFactura = ii.issued, - mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + - IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + - IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + + mci.ImporteFactura = IFNULL(mci.BaseIva1, 0) + IFNULL(mci.CuotaIva1, 0) + + IFNULL(mci.BaseIva2, 0) + IFNULL(mci.CuotaIva2, 0) + + IFNULL(mci.BaseIva3, 0) + IFNULL(mci.CuotaIva3, 0) + IFNULL(mci.BaseIva4, 0) + IFNULL(mci.CuotaIva4, 0), - mci.TipoFactura = IF(id.id, - IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), - IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)), + mci.TipoFactura = IF(id.id, + IF( ii.serial = vSerialDua COLLATE utf8mb3_unicode_ci, vInvoiceTypeReceived, vInvoiceTypeInformative), + IF(vIsInformativeExportation,vInvoiceTypeInformative, vInvoiceTypeReceived)), mci.CodigoCuentaFactura = x.SUBCTA, mci.CifDni = IF(LEFT(TRIM(s.nif), 2) = n.SiglaNacion, SUBSTRING(TRIM(s.nif), 3), s.nif), mci.Nombre = s.name, @@ -18698,7 +18728,7 @@ BEGIN JOIN (SELECT SUM(x2.BASEEURO) taxableBase, SUM(x2.EURODEBE) taxBase FROM vn.XDiario x1 JOIN vn.XDiario x2 ON x1.ASIEN = x2.ASIEN - WHERE x2.BASEEURO <> 0 + WHERE x2.BASEEURO <> 0 AND x1.id = vXDiarioFk )sub JOIN ClavesOperacion co ON co.Descripcion = 'Arrendamiento de locales de negocio' @@ -18706,11 +18736,42 @@ BEGIN mci.ClaveOperacionFactura = IF( t.Retencion = 'ARRENDAMIENTO Y SUBARRENDAMIENTO', co.ClaveOperacionFactura_, mci.ClaveOperacionFactura), mci.BaseRetencion = IF (t.Retencion = 'ACTIVIDADES AGRICOLAS O GANADERAS', sub.taxableBase + sub.taxBase, sub.taxableBase), mci.PorRetencion = t.PorcentajeRetencion, - mci.ImporteRetencion = iit.taxableBase * - 1 - WHERE mci.id = vXDiarioFk + mci.ImporteRetencion = iit.taxableBase * - 1 + WHERE mci.id = vXDiarioFk AND e.name = 'Retenciones' AND id.id IS NULL; + SELECT correctedFk INTO vInvoiceInOriginalFk + FROM vn.invoiceInCorrection + WHERE correctingFk = vInvoiceInFk; + + IF vInvoiceInOriginalFk THEN + + UPDATE movContaIVA mci + JOIN vn.invoiceInRefund iir ON iir.invoiceInRefundFk = vInvoiceInFk + JOIN (SELECT issued, + SUM(sub.taxableBase) taxableBase, + SUM(ROUND((sub.taxableBase * sub.PorcentajeIva) / 100 , 2)) vat + FROM(SELECT issued, + SUM(iit.taxableBase) taxableBase, + ti.PorcentajeIva + FROM vn.invoiceIn i + JOIN vn.invoiceInTax iit ON iit.invoiceInFk = i.id + JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk + WHERE i.id = vInvoiceInOriginalFk + GROUP BY ti.CodigoIva)sub + )invoiceInOriginal + JOIN ClavesOperacion co ON co.Descripcion = 'Factura rectificativa' + SET mci.TipoRectificativa = iir.refundCategoryFk, + mci.ClaseAbonoRectificativas = iir.refundType, + mci.FechaFacturaOriginal = invoiceInOriginal.issued, + mci.FechaOperacion = invoiceInOriginal.issued, + mci.BaseImponibleOriginal = invoiceInOriginal.taxableBase, + mci.CuotaIvaOriginal = invoiceInOriginal.vat, + mci.ClaveOperacionFactura = co.ClaveOperacionFactura_ + WHERE mci.id = vXDiarioFk; + + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24620,6 +24681,75 @@ DELIMITER ; -- /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP FUNCTION IF EXISTS `accountNumberToIban` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `accountNumberToIban`(vAccount VARCHAR(20) +) RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci + DETERMINISTIC +BEGIN +/** +* Calcula y genera el código IBAN correspondiente +* a un número de cuenta bancaria español. +* +* @param vAccount Número de cuenta bancaria +* @return vIban Código IBAN de 4 caracteres. +*/ + DECLARE vIban VARCHAR(4); + + SELECT + CONCAT('ES', + RIGHT( + CONCAT(0, + 98-MOD( + CONCAT( + MOD( + CONCAT( + MOD( + CONCAT( + MOD( + SUBSTRING(vAccount, 1, 8), + 97 + ), + SUBSTRING(vAccount,9,8) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 17, + 8 + ) + ), + 97 + ), + SUBSTRING( + CONCAT(vAccount, 142800), + 25, + 2 + ) + ), + 97 + ) + ), + 2 + ) + ) INTO vIban; + + RETURN vIban; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `accountShortToStandard` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -26382,6 +26512,65 @@ CREATE TABLE `absenceType` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `accountDetail` +-- + +DROP TABLE IF EXISTS `accountDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountDetail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `value` varchar(50) NOT NULL, + `accountDetailTypeFk` int(11) NOT NULL, + `supplierAccountFk` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `fk_account_detail_account_detail_type1_idx` (`accountDetailTypeFk`), + KEY `fk_account_detail_Proveedores_account1_idx` (`supplierAccountFk`), + CONSTRAINT `fk_account_detail_account_detail_type1` FOREIGN KEY (`accountDetailTypeFk`) REFERENCES `accountDetailType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_account_detail_account_id_proveedores_account` FOREIGN KEY (`supplierAccountFk`) REFERENCES `supplierAccount` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `accountDetailType` +-- + +DROP TABLE IF EXISTS `accountDetailType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountDetailType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `accountReconciliation` +-- + +DROP TABLE IF EXISTS `accountReconciliation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `accountReconciliation` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `supplierAccountFk` mediumint(8) unsigned NOT NULL, + `operationDated` datetime NOT NULL, + `valueDated` datetime NOT NULL, + `amount` double NOT NULL, + `concept` varchar(255) DEFAULT NULL, + `debitCredit` smallint(6) NOT NULL, + `calculatedCode` varchar(255) DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `idaccount_conciliacion_UNIQUE` (`id`), + KEY `fg_accconciliacion_key1_idx` (`supplierAccountFk`), + KEY `index_id_calculated` (`calculatedCode`), + CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`supplierAccountFk`) REFERENCES `supplierAccount` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `accounting` -- @@ -26595,15 +26784,15 @@ CREATE TABLE `agency` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(25) NOT NULL, `warehouseFk` smallint(5) unsigned DEFAULT NULL COMMENT 'A nulo si se puede enrutar desde todos los almacenes', - `warehouseAliasFk` smallint(5) unsigned DEFAULT NULL, + `warehouseAliasFk__` smallint(5) unsigned DEFAULT NULL COMMENT '@deprecated 2024-01-23 refs #5167', `isOwn` tinyint(1) NOT NULL DEFAULT 0, `workCenterFk` int(11) DEFAULT NULL, `isAnyVolumeAllowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Permite vender productos que tengan vn.itemType.IsUnconventionalSize = TRUE', PRIMARY KEY (`id`), KEY `warehouse_id` (`warehouseFk`), - KEY `agencias_alias_idx` (`warehouseAliasFk`), + KEY `agencias_alias_idx` (`warehouseAliasFk__`), KEY `agency_ibfk_3_idx` (`workCenterFk`), - CONSTRAINT `agency_FK` FOREIGN KEY (`warehouseAliasFk`) REFERENCES `warehouseAlias` (`id`) ON UPDATE CASCADE, + CONSTRAINT `agency_FK` FOREIGN KEY (`warehouseAliasFk__`) REFERENCES `warehouseAlias__` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -26733,18 +26922,32 @@ CREATE TABLE `agencyTermConfig` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `agencyWarehouse` +-- Table structure for table `airline` -- -DROP TABLE IF EXISTS `agencyWarehouse`; -/*!50001 DROP VIEW IF EXISTS `agencyWarehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `agencyWarehouse` AS SELECT - 1 AS `agencyFk`, - 1 AS `warehouseFk`, - 1 AS `agencyType` */; -SET character_set_client = @saved_cs_client; +DROP TABLE IF EXISTS `airline`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `airline` ( + `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(20) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `airport` +-- + +DROP TABLE IF EXISTS `airport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `airport` ( + `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `alertLevel` @@ -26956,6 +27159,154 @@ CREATE TABLE `awb` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `awbComponent` +-- + +DROP TABLE IF EXISTS `awbComponent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbComponent` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `awbFk` smallint(11) unsigned DEFAULT NULL, + `supplierFk` int(11) NOT NULL, + `dated__` date NOT NULL, + `typeFk` mediumint(3) unsigned DEFAULT NULL, + `awbRoleFk` tinyint(1) unsigned NOT NULL DEFAULT 1, + `awbUnitFk` varchar(10) DEFAULT NULL, + `value` decimal(10,2) DEFAULT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, + `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `unique_idx` (`awbFk`,`supplierFk`,`typeFk`), + KEY `Id_Moneda` (`currencyFk`), + KEY `awb_component_fk` (`typeFk`), + KEY `awb_role_fk` (`awbRoleFk`), + KEY `awb_unit_fk` (`awbUnitFk`), + CONSTRAINT `Id_Monedafk` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON DELETE CASCADE, + CONSTRAINT `awb_component_` FOREIGN KEY (`typeFk`) REFERENCES `awbComponentType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_role_fk` FOREIGN KEY (`awbRoleFk`) REFERENCES `awbRole` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_unit_fk` FOREIGN KEY (`awbUnitFk`) REFERENCES `awbUnit` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbComponentTemplate` +-- + +DROP TABLE IF EXISTS `awbComponentTemplate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbComponentTemplate` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `freightFk` int(11) DEFAULT NULL, + `airportIn` varchar(3) DEFAULT NULL, + `airportOut` varchar(3) DEFAULT NULL, + `airlineFk` smallint(2) unsigned DEFAULT NULL, + `typeFk` mediumint(3) unsigned NOT NULL, + `dated` date NOT NULL, + `awbRoleFk` tinyint(1) unsigned NOT NULL, + `awbUnit` varchar(10) DEFAULT NULL, + `value` decimal(10,3) DEFAULT NULL, + `maxValue` decimal(10,2) unsigned DEFAULT NULL, + `minValue` decimal(10,2) unsigned DEFAULT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, + `days` varchar(7) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `carguera_id_UNIQUE` (`freightFk`,`airportIn`,`airportOut`,`airlineFk`,`typeFk`,`dated`,`days`), + KEY `Id_Moneda` (`currencyFk`), + KEY `airline_idx` (`airlineFk`), + KEY `role_idx` (`awbRoleFk`), + KEY `awb_unit_fk1` (`awbUnit`), + KEY `awb_component_template_FK` (`typeFk`), + CONSTRAINT `Id_Moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_component_template_FK` FOREIGN KEY (`typeFk`) REFERENCES `awbComponentType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_component_template_FK_1` FOREIGN KEY (`airlineFk`) REFERENCES `airline` (`id`) ON UPDATE CASCADE, + CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awbUnit`) REFERENCES `awbUnit` (`id`) ON UPDATE CASCADE, + CONSTRAINT `role_fk` FOREIGN KEY (`awbRoleFk`) REFERENCES `awbRole` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbComponentType` +-- + +DROP TABLE IF EXISTS `awbComponentType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbComponentType` ( + `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, + `description` varchar(45) DEFAULT NULL, + `hasStems` tinyint(1) NOT NULL DEFAULT 1, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbDms` +-- + +DROP TABLE IF EXISTS `awbDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbDms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `awbFk` smallint(11) unsigned NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `awb_gestdoc_awb_fk` (`awbFk`), + KEY `awb_gestdoc_gestdoc_fk` (`dmsFk`), + CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbInvoiceIn` +-- + +DROP TABLE IF EXISTS `awbInvoiceIn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbInvoiceIn` ( + `awbFk` smallint(5) unsigned NOT NULL, + `invoiceInFk` mediumint(8) unsigned NOT NULL, + `sad` varchar(18) DEFAULT NULL, + PRIMARY KEY (`invoiceInFk`), + KEY `awb_id` (`awbFk`), + CONSTRAINT `awbInvoiceIn_ibfk_1` FOREIGN KEY (`awbFk`) REFERENCES `awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `awbInvoiceIn_ibfk_2` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbRole` +-- + +DROP TABLE IF EXISTS `awbRole`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbRole` ( + `id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `awbUnit` +-- + +DROP TABLE IF EXISTS `awbUnit`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `awbUnit` ( + `id` varchar(10) NOT NULL DEFAULT '', + `operation` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='tipos de unidades'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `awbVolume` -- @@ -26970,6 +27321,26 @@ SET character_set_client = utf8; 1 AS `buyFk` */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `balanceNestTree` +-- + +DROP TABLE IF EXISTS `balanceNestTree`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `balanceNestTree` ( + `lft` int(11) DEFAULT NULL, + `rgt` int(11) DEFAULT NULL, + `name` text DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `expenseFk` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `isSelected` tinyint(1) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `balanceNestTree_expense_FK` (`expenseFk`), + CONSTRAINT `balanceNestTree_expense_FK` FOREIGN KEY (`expenseFk`) REFERENCES `expense` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Temporary table structure for view `bank` -- @@ -27037,34 +27408,49 @@ CREATE TABLE `bankErrorCode` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `bankPolicy` +-- Table structure for table `bankPolicy` -- DROP TABLE IF EXISTS `bankPolicy`; -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `bankPolicy` AS SELECT - 1 AS `id`, - 1 AS `ref`, - 1 AS `amount`, - 1 AS `balanceInterestDrawn`, - 1 AS `commissionAvailableBalances`, - 1 AS `openingCommission`, - 1 AS `started`, - 1 AS `ended`, - 1 AS `bankFk`, - 1 AS `companyFk`, - 1 AS `supplierFk`, - 1 AS `description`, - 1 AS `hasGuarantee`, - 1 AS `dmsFk`, - 1 AS `notaryFk`, - 1 AS `currencyFk`, - 1 AS `amortizationTypeFk`, - 1 AS `periodicityTypeFk`, - 1 AS `insuranceExpired` */; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `bankPolicy` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(45) DEFAULT NULL, + `amount` double NOT NULL, + `committedFee` double DEFAULT NULL, + `nonCommittedFee` double DEFAULT NULL, + `annualFee` double DEFAULT NULL, + `started` date NOT NULL, + `ended` date DEFAULT NULL, + `accountingFk` int(11) NOT NULL, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, + `supplierFk` int(10) unsigned DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + `hasGuarantee` tinyint(1) NOT NULL DEFAULT 0, + `dmsFk` int(11) DEFAULT NULL, + `notaryFk` int(10) unsigned DEFAULT NULL, + `currencyFk` tinyint(3) unsigned DEFAULT 2, + `amortizationTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `periodicityTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, + `insuranceExpired` date DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Banco_Poliza_idx` (`accountingFk`), + KEY `Id_Poliza_Empresa_idx` (`companyFk`), + KEY `bankSupplierIdx1_idx` (`supplierFk`), + KEY `bankDmsIdx2_idx` (`dmsFk`), + KEY `bankNotaryIdx3_idx` (`notaryFk`), + KEY `asdf_idx` (`amortizationTypeFk`), + KEY `bankPeriodicityIdx4_idx` (`periodicityTypeFk`), + CONSTRAINT `Bancos_polizaCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Bancos_poliza_notaryFk` FOREIGN KEY (`notaryFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Bancos_poliza_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Id_Banco_Poliza` FOREIGN KEY (`accountingFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, + CONSTRAINT `asdf` FOREIGN KEY (`amortizationTypeFk`) REFERENCES `amortizationType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `bankDmsIdx2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `bankPeriodicityIdx4` FOREIGN KEY (`periodicityTypeFk`) REFERENCES `periodicityType` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lineas de credito asociadas a cuentas corrientes'; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `beach` @@ -27430,7 +27816,7 @@ CREATE TABLE `buy` ( KEY `buy_itemFk_IDX` (`itemFk`) USING BTREE, KEY `buy_fk_editor` (`editorFk`), CONSTRAINT `buy_FK` FOREIGN KEY (`itemOriginalFk`) REFERENCES `item` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `buy_FK_1` FOREIGN KEY (`containerFk`) REFERENCES `vn2008`.`container` (`container_id`) ON UPDATE CASCADE, + CONSTRAINT `buy_FK_1` FOREIGN KEY (`containerFk`) REFERENCES `vn2008`.`container__` (`container_id`) ON UPDATE CASCADE, CONSTRAINT `buy_ektFk` FOREIGN KEY (`ektFk`) REFERENCES `edi`.`ekt` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `buy_fk_4` FOREIGN KEY (`deliveryFk`) REFERENCES `edi`.`deliveryInformation` (`ID`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `buy_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`), @@ -28237,22 +28623,6 @@ CREATE TABLE `clientCredit` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `clientDefaultCompany` --- - -DROP TABLE IF EXISTS `clientDefaultCompany`; -/*!50001 DROP VIEW IF EXISTS `clientDefaultCompany`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `clientDefaultCompany` AS SELECT - 1 AS `id`, - 1 AS `clientFk`, - 1 AS `companyFk`, - 1 AS `started`, - 1 AS `finished` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `clientDms` -- @@ -29249,19 +29619,6 @@ CREATE TABLE `conveyorType` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `coolerPath` --- - -DROP TABLE IF EXISTS `coolerPath`; -/*!50001 DROP VIEW IF EXISTS `coolerPath`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `coolerPath` AS SELECT - 1 AS `id`, - 1 AS `description` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `coolerPathDetail` -- @@ -29275,7 +29632,7 @@ CREATE TABLE `coolerPathDetail` ( `hallway` varchar(3) NOT NULL, PRIMARY KEY (`coolerPathFk`,`hallway`), UNIQUE KEY `cooler_path_detail_id_UNIQUE` (`id`), - CONSTRAINT `coolerPathDetail_FK` FOREIGN KEY (`coolerPathFk`) REFERENCES `vn2008`.`cooler_path` (`cooler_path_id`) ON UPDATE CASCADE + CONSTRAINT `coolerPathDetail_FK` FOREIGN KEY (`coolerPathFk`) REFERENCES `vn2008`.`cooler_path__` (`cooler_path_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29546,6 +29903,82 @@ CREATE TABLE `deliveryMethod` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `deliveryNote` +-- + +DROP TABLE IF EXISTS `deliveryNote`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryNote` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ref` varchar(45) DEFAULT NULL, + `note` varchar(150) DEFAULT NULL, + `shipped` date NOT NULL, + `landed` date DEFAULT NULL, + `amount` double DEFAULT NULL, + `supplierFk` int(10) unsigned NOT NULL, + `companyFk` int(10) unsigned NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + `stateFk` int(11) NOT NULL, + `workerFk` int(10) unsigned NOT NULL COMMENT 'Id_Trabajador hace referencia a la persona que ha introducido el albarán', + `supervisorFk` int(10) unsigned NOT NULL, + `departmentFk` int(11) NOT NULL, + `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, + `farmingFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_albaran_Proveedores_idx` (`supplierFk`), + KEY `fk_albaran_empresa1_idx` (`companyFk`), + KEY `fk_albaran_warehouse1_idx` (`warehouseFk`), + KEY `fk_albaran_albaran_state1_idx` (`stateFk`), + KEY `fk_albaran_Trabajadores1_idx` (`workerFk`), + KEY `fk_albaran_Trabajadores2_idx` (`supervisorFk`), + KEY `fk_albaran_department1_idx` (`departmentFk`), + KEY `fk_albaran_recibida_idx` (`invoiceInFk`), + KEY `albaran_FK` (`farmingFk`), + CONSTRAINT `albaranCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `albaran_FK` FOREIGN KEY (`farmingFk`) REFERENCES `farming` (`id`), + CONSTRAINT `albaran_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_Trabajadores2` FOREIGN KEY (`supervisorFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_albaran_state1` FOREIGN KEY (`stateFk`) REFERENCES `deliveryNoteState` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `deliveryNoteDms` +-- + +DROP TABLE IF EXISTS `deliveryNoteDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryNoteDms` ( + `dmsFk` int(11) NOT NULL, + `deliveryNoteFk` int(11) NOT NULL, + PRIMARY KEY (`dmsFk`,`deliveryNoteFk`), + KEY `fk_albaran_gestdoc_gestdoc1_idx` (`dmsFk`), + KEY `fk_albaran_gestdoc_albaran1_idx` (`deliveryNoteFk`), + CONSTRAINT `albaran_gestdoc_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_albaran_gestdoc_albaran1` FOREIGN KEY (`deliveryNoteFk`) REFERENCES `deliveryNote` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `deliveryNoteState` +-- + +DROP TABLE IF EXISTS `deliveryNoteState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deliveryNoteState` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `state` varchar(45) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `deliveryPoint` -- @@ -29878,6 +30311,25 @@ CREATE TABLE `dms` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='document managment system'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `dmsStorageBox` +-- + +DROP TABLE IF EXISTS `dmsStorageBox`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `dmsStorageBox` ( + `id` int(11) NOT NULL, + `companyFk` int(10) unsigned NOT NULL, + `started` bigint(20) NOT NULL, + `ended` bigint(20) NOT NULL, + `created` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`,`companyFk`), + KEY `dmsStorageBox_company_FK` (`companyFk`), + CONSTRAINT `dmsStorageBox_company_FK` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Caja en la que se guardan la documentacion fisica de dms'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `dmsType` -- @@ -29902,27 +30354,6 @@ CREATE TABLE `dmsType` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `doc` --- - -DROP TABLE IF EXISTS `doc`; -/*!50001 DROP VIEW IF EXISTS `doc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `doc` AS SELECT - 1 AS `id`, - 1 AS `sref`, - 1 AS `brief`, - 1 AS `companyFk`, - 1 AS `order`, - 1 AS `file`, - 1 AS `original`, - 1 AS `workerFk`, - 1 AS `created`, - 1 AS `warehouseFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `dock` -- @@ -30366,6 +30797,21 @@ CREATE TABLE `entryObservation` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `entryOrder` +-- + +DROP TABLE IF EXISTS `entryOrder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `entryOrder` ( + `entryFk` int(11) NOT NULL, + `order` int(11) NOT NULL DEFAULT 1 COMMENT '1.- Ordenar por articulo\n2.- Ordenar por compra\n', + PRIMARY KEY (`entryFk`), + CONSTRAINT `entradas_entradas_orden` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `entryType` -- @@ -31211,6 +31657,29 @@ CREATE TABLE `floramondoConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `forecastedBalance` +-- + +DROP TABLE IF EXISTS `forecastedBalance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `forecastedBalance` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) DEFAULT NULL, + `amount` double NOT NULL DEFAULT 0, + `dated` date NOT NULL, + `accountingFk` int(11) DEFAULT NULL, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, + PRIMARY KEY (`id`), + KEY `Fecha_indice` (`dated`), + KEY `banco_prevision_idx` (`accountingFk`), + KEY `empresa_prevision_idx` (`companyFk`), + CONSTRAINT `Saldos_PrevisionCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `banco_prevision` FOREIGN KEY (`accountingFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `franceExpressConfig` -- @@ -31347,20 +31816,6 @@ CREATE TABLE `glsExpedition` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `grantGroup` --- - -DROP TABLE IF EXISTS `grantGroup`; -/*!50001 DROP VIEW IF EXISTS `grantGroup`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `grantGroup` AS SELECT - 1 AS `id`, - 1 AS `description`, - 1 AS `observationTypeFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `greuge` -- @@ -31788,6 +32243,32 @@ CREATE TABLE `invoiceInConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `invoiceInCorrection` +-- + +DROP TABLE IF EXISTS `invoiceInCorrection`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `invoiceInCorrection` ( + `correctingFk` mediumint(8) unsigned NOT NULL COMMENT 'Factura rectificativa', + `correctedFk` mediumint(8) unsigned NOT NULL COMMENT 'Factura rectificada', + `cplusRectificationTypeFk` int(10) unsigned NOT NULL, + `siiTypeInvoiceOutFk` int(10) unsigned NOT NULL, + `invoiceCorrectionTypeFk` int(11) NOT NULL DEFAULT 3, + PRIMARY KEY (`correctingFk`), + KEY `invoiceInCorrection_correctedFk` (`correctedFk`), + KEY `invoiceInCorrection_cplusRectificationTypeFk` (`cplusRectificationTypeFk`), + KEY `invoiceInCorrection_siiTypeInvoiceOut` (`siiTypeInvoiceOutFk`), + KEY `invoiceInCorrection_invoiceCorrectionTypeFk` (`invoiceCorrectionTypeFk`), + CONSTRAINT `invoiceInCorrection_correctedFk` FOREIGN KEY (`correctedFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_correctingFk` FOREIGN KEY (`correctingFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_cplusRectificationTypeFk` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `cplusRectificationType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_invoiceCorrectionTypeFk` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `invoiceCorrectionType` (`id`) ON UPDATE CASCADE, + CONSTRAINT `invoiceInCorrection_siiTypeInvoiceOut` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `siiTypeInvoiceOut` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `invoiceInDueDay` -- @@ -33801,6 +34282,24 @@ CREATE TABLE `mrw` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `mrwConfig` +-- + +DROP TABLE IF EXISTS `mrwConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mrwConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `url` varchar(100) DEFAULT NULL, + `user` varchar(100) DEFAULT NULL, + `password` varchar(100) DEFAULT NULL, + `franchiseCode` varchar(100) DEFAULT NULL, + `subscriberCode` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `mrwService` -- @@ -34284,6 +34783,7 @@ CREATE TABLE `packingSite` ( `scannerFk` int(11) DEFAULT NULL, `screenFk` int(11) DEFAULT NULL, `editorFk` int(10) unsigned DEFAULT NULL, + `hasNewLabelMrwMethod` tinyint(1) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `packingSite_UN` (`code`), UNIQUE KEY `printerRfidFk` (`printerRfidFk`), @@ -35238,6 +35738,7 @@ CREATE TABLE `professionalCategory` ( `name` varchar(50) NOT NULL, `level` int(11) unsigned DEFAULT NULL, `dayBreak` int(11) unsigned DEFAULT NULL, + `code` varchar(25) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `prefessionalCategory_UN` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -35325,18 +35826,22 @@ CREATE TABLE `projectState` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `promissoryNote` +-- Table structure for table `promissoryNote` -- DROP TABLE IF EXISTS `promissoryNote`; -/*!50001 DROP VIEW IF EXISTS `promissoryNote`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `promissoryNote` AS SELECT - 1 AS `id`, - 1 AS `Concept`, - 1 AS `paymentFk` */; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `promissoryNote` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `issued` timestamp NOT NULL DEFAULT current_timestamp(), + `Concept` varchar(50) DEFAULT NULL, + `paymentFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `pago_id` (`paymentFk`), + CONSTRAINT `promissoryNote_ibfk_2` FOREIGN KEY (`paymentFk`) REFERENCES `payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `property` @@ -35724,6 +36229,26 @@ CREATE TABLE `referenceRateConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `remittance` +-- + +DROP TABLE IF EXISTS `remittance`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `remittance` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` datetime DEFAULT NULL, + `accountingFk` int(11) DEFAULT 0, + `companyFk` int(10) unsigned NOT NULL DEFAULT 442, + PRIMARY KEY (`id`), + KEY `Id_Banco` (`accountingFk`), + KEY `empresa_id` (`companyFk`), + CONSTRAINT `RemesasCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `remittance_ibfk_2` FOREIGN KEY (`accountingFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `report` -- @@ -36845,7 +37370,7 @@ DROP TABLE IF EXISTS `sectorType`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sectorType` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(100) NOT NULL, + `code` varchar(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37325,6 +37850,24 @@ CREATE TABLE `specieGeoInvasive` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `split` +-- + +DROP TABLE IF EXISTS `split`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `split` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) DEFAULT NULL, + `entryFk` int(11) DEFAULT NULL, + `dated` datetime DEFAULT NULL, + `note` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Entrada` (`entryFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `splitFilter` -- @@ -37347,6 +37890,26 @@ CREATE TABLE `splitFilter` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='define los clientes que tienen split y el nombre a mostrar en la etiqueta'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `splitLine` +-- + +DROP TABLE IF EXISTS `splitLine`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `splitLine` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `splitFk` int(11) NOT NULL, + `itemFk` int(11) DEFAULT NULL, + `buyFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Split` (`splitFk`), + KEY `Id_Compra` (`buyFk`), + CONSTRAINT `Id_Compra` FOREIGN KEY (`buyFk`) REFERENCES `buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `splitLine_ibfk_1` FOREIGN KEY (`splitFk`) REFERENCES `split` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `starredModule` -- @@ -37661,6 +38224,20 @@ CREATE TABLE `supplierDebtConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `supplierDms` +-- + +DROP TABLE IF EXISTS `supplierDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierDms` ( + `supplierFk` int(11) NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`supplierFk`,`dmsFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `supplierExpense` -- @@ -38869,22 +39446,6 @@ CREATE TABLE `time` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Tabla de referencia para las semanas, años y meses'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `timeControlDevice` --- - -DROP TABLE IF EXISTS `timeControlDevice`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `timeControlDevice` ( - `id` int(10) NOT NULL AUTO_INCREMENT, - `name` varchar(255) DEFAULT NULL, - `key` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `town` -- @@ -39440,6 +40001,11 @@ CREATE TABLE `vehicle` ( `ppeFk` int(11) DEFAULT NULL, `countryCodeFk` varchar(2) DEFAULT 'ES', `leasing` varchar(50) DEFAULT NULL COMMENT 'Id de arrendamiento', + `supplierFk` int(10) unsigned DEFAULT NULL COMMENT 'supplier from whom the vehicle was purchased', + `import` decimal(10,2) DEFAULT NULL, + `supplierCoolerFk` int(10) unsigned DEFAULT NULL, + `vin` varchar(50) DEFAULT NULL, + `bankPolicyFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `vehicle_UN` (`numberPlate`), KEY `empresa_id` (`companyFk`), @@ -39447,11 +40013,17 @@ CREATE TABLE `vehicle` ( KEY `vehicle_deliveryPointFk_idx` (`deliveryPointFk`), KEY `vehicle_FK` (`fuelTypeFk`), KEY `vehicle_FK_1` (`ppeFk`), + KEY `vehicle_supplierFk` (`supplierFk`), + KEY `vehicle_supplierCoolerFk` (`supplierCoolerFk`), + KEY `vehicle_bankPolicyFk` (`bankPolicyFk`), CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `vehicleCompany_Fk` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `vehicle_FK` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `vehicle_FK_1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE + CONSTRAINT `vehicle_bankPolicyFk` FOREIGN KEY (`bankPolicyFk`) REFERENCES `bankPolicy` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_supplierCoolerFk` FOREIGN KEY (`supplierCoolerFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39467,6 +40039,40 @@ CREATE TABLE `vehicleConfig` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `vehicleConsumption` +-- + +DROP TABLE IF EXISTS `vehicleConsumption`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleConsumption` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `vehicleFk` int(10) unsigned NOT NULL, + `dated` date NOT NULL, + `km` int(20) unsigned NOT NULL, + `liters` double unsigned NOT NULL, + `price` double unsigned NOT NULL, + `adblue` decimal(10,2) NOT NULL DEFAULT 0.00, + `tolls` double DEFAULT NULL, + `discount` double DEFAULT NULL, + `silla` int(11) NOT NULL DEFAULT 0 COMMENT 'indica si han repostado en la gasolinera de la rotonda', + `created` timestamp NULL DEFAULT current_timestamp(), + `others` double DEFAULT NULL, + `fuelTypeFk` varchar(45) DEFAULT NULL, + `supplierFk` int(10) unsigned DEFAULT NULL, + `liters100km` decimal(10,2) DEFAULT NULL COMMENT 'se rellena en Vehiculos_consumo_beforeInsert y son los litros consumidos a los 100 kilometros', + `gasoline` decimal(10,2) NOT NULL DEFAULT 0.00, + PRIMARY KEY (`id`,`vehicleFk`), + KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`vehicleFk`), + KEY `fuelTypeFk_idx` (`fuelTypeFk`), + KEY `proveedoresFk_idx` (`supplierFk`), + CONSTRAINT `Vehiculos_consumo_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fuelTypeFk` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `vehicleDms` -- @@ -39763,7 +40369,7 @@ CREATE TABLE `warehouse` ( `hasDms` tinyint(1) NOT NULL DEFAULT 0, `pickUpAgencyModeFk` int(11) DEFAULT NULL, `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT 0, - `aliasFk` smallint(5) unsigned DEFAULT NULL, + `aliasFk__` smallint(5) unsigned DEFAULT NULL COMMENT '@deprecated 2024-01-23 refs #5167', `labelReport` int(11) DEFAULT NULL, `hasUbications` tinyint(1) NOT NULL DEFAULT 1, `hasProduction` tinyint(1) NOT NULL DEFAULT 0, @@ -39778,44 +40384,31 @@ CREATE TABLE `warehouse` ( UNIQUE KEY `name_UNIQUE` (`name`), KEY `Id_Paises` (`countryFk`), KEY `isComparativeIdx` (`isComparative`), - KEY `warehouse_ibfk_1_idx` (`aliasFk`), + KEY `warehouse_ibfk_1_idx` (`aliasFk__`), KEY `warehouse_FK` (`addressFk`), KEY `warehouse_FK_1` (`pickUpAgencyModeFk`), CONSTRAINT `warehouse_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `warehouse_FK_1` FOREIGN KEY (`pickUpAgencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`), - CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk`) REFERENCES `warehouseAlias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk__`) REFERENCES `warehouseAlias__` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `warehouseAlias` +-- Table structure for table `warehouseAlias__` -- -DROP TABLE IF EXISTS `warehouseAlias`; +DROP TABLE IF EXISTS `warehouseAlias__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `warehouseAlias` ( +CREATE TABLE `warehouseAlias__` ( `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(15) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='@deprecated 2024-01-23 refs #5167'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `warehouseJoined` --- - -DROP TABLE IF EXISTS `warehouseJoined`; -/*!50001 DROP VIEW IF EXISTS `warehouseJoined`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouseJoined` AS SELECT - 1 AS `warehouseFk`, - 1 AS `warehouseAliasFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `workCenter` -- @@ -43460,6 +44053,49 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP FUNCTION IF EXISTS `intrastat_estimateNet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `intrastat_estimateNet`(vSelf INT, + vStems INT +) RETURNS double + DETERMINISTIC +BEGIN +/** +* Calcula un valor neto estimado en función de +* datos históricos de facturas intrastat. +* +* @param vSelf Id de intrastat +* @param vStems Número de unidades +* @return vNet +*/ + DECLARE vNet DOUBLE; + + SELECT ROUND(vStems / (SUM(average) / COUNT(average)), 2) INTO vNet + FROM ( + SELECT *, stems / net average + FROM invoiceInIntrastat + WHERE intrastatFk = vSelf + AND net + AND stems > 0 + ORDER BY dated DESC + LIMIT 20 + ) sub; + + RETURN vNet/2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `invoiceOutAmount` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -43750,8 +44386,8 @@ BEGIN FROM ( SELECT DISTINCT t.Id_Ruta FROM vn2008.scan_line sl - JOIN vn2008.expeditions e ON e.expeditions_id = sl.code - JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticket_id + JOIN expedition e ON e.id = sl.code + JOIN vn2008.Tickets t ON t.Id_Ticket = e.ticketFk WHERE sl.scan_id = vScanId AND t.Id_Ruta ) t1; @@ -44210,32 +44846,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vQuantity DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vQuantity,0); - - RETURN vResult; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP FUNCTION IF EXISTS `orderTotalVolume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -46408,7 +47018,7 @@ BEGIN LEFT JOIN vn.supplier s ON s.id = bp.supplierFk LEFT JOIN vn.bank b - ON b.id = bp.bankFk + ON b.id = bp.accountingFk WHERE bp.insuranceExpired = util.VN_CURDATE(); END ;; DELIMITER ; @@ -46619,14 +47229,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_afterUpsert` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT) BEGIN @@ -46703,7 +47313,9 @@ BEGIN WHERE b.id = vSelf; END IF; - + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT vSelf id; + CALL buy_checkItem(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46739,6 +47351,47 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `buy_checkItem` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkItem`() +BEGIN +/** + * Checks if the item has weightByPiece or size null on any buy. + * + * @param tmp.buysToCheck(id as INT). + */ + DECLARE hasVolumetricAgency INT; + + SELECT a.hasWeightVolumetric INTO hasVolumetricAgency + FROM entry e + JOIN travel t ON t.id = e.travelFk + JOIN agencyMode a ON a.id = t.agencyModeFk + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + JOIN tmp.buysToCheck bt ON bt.id = b.id + WHERE (i.weightByPiece IS NULL OR i.`size` IS NULL) + AND a.hasWeightVolumetric + LIMIT 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck; + + IF hasVolumetricAgency THEN + CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `buy_getSplit` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -47970,6 +48623,7 @@ BEGIN FROM vn.expeditionTruck WHERE eta < v3Month; + DELETE FROM XDiario WHERE FECHA < v3Month OR FECHA IS NULL; -- borrar travels sin entradas DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; CREATE TEMPORARY TABLE tmp.thermographToDelete @@ -48800,7 +49454,7 @@ BEGIN SELECT lc.companyFk, c.id, 0, - - (NZ(lc.credit) - NZ(lc.debit)) + - (IFNULL(lc.credit, 0) - IFNULL(lc.debit, 0)) FROM tmp.ledgerComparative lc JOIN client c ON c.accountingAccount = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo @@ -49333,9 +49987,9 @@ BEGIN ish.created, ish.visible, IFNULL( - IF(st.description = 'previousByPacking', ish.packing, g.`grouping`), + IF(st.code = 'previousByPacking', ish.packing, g.`grouping`), 1) `grouping`, - st.description = 'previousPrepared' isPreviousPrepared, + st.code = 'previousPrepared' isPreviousPrepared, iss.id itemShelvingSaleFk, ts.ticketFk, iss.id, @@ -49818,14 +50472,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT) proc:BEGIN @@ -50033,7 +50687,8 @@ proc:BEGIN UPDATE tmp.productionBuffer pb JOIN ( SELECT SUM(litros) liters, - @lines:= COUNT(*) + @lines `lines`, + @lines:= COUNT(*) + @lines, + COUNT(*) `lines`, MAX(i.`size`) height, @volume := SUM(sv.volume) + @volume volume FROM saleVolume sv @@ -51385,7 +52040,7 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) BEGIN /** * Genera el asiento de un DUA y marca las entradas como confirmadas - * + * * @param vDuaFk Id del dua a recalcular */ DECLARE done BOOL DEFAULT FALSE; @@ -51405,7 +52060,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; OPEN rs; - + UPDATE invoiceIn ii JOIN entry e ON e.invoiceInFk = ii.id JOIN duaEntry de ON de.entryFk = e.id @@ -51423,35 +52078,35 @@ BEGIN WHERE id = vDuaFk; FETCH rs INTO vInvoiceFk; - + WHILE NOT done DO CALL invoiceIn_booking(vInvoiceFk); - + IF vCounter > 0 OR vASIEN > 0 THEN - - UPDATE vn2008.XDiario x + + UPDATE XDiario x JOIN ledgerConfig lc ON lc.lastBookEntry = x.ASIEN SET x.ASIEN = vASIEN; - + ELSE - + SELECT lastBookEntry INTO vASIEN FROM ledgerConfig; - + END IF; - + SET vCounter = vCounter + 1; - + FETCH rs INTO vInvoiceFk; END WHILE; CLOSE rs; - UPDATE dua + UPDATE dua SET ASIEN = vASIEN WHERE id = vDuaFk; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52344,6 +52999,230 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entry_getTransfer` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getTransfer`( + vSelf INT +) +BEGIN +/** + * Retorna los artículos trasladables a partir de una entrada. + * + * @param vSelf Id de entrada + */ + DECLARE vDateShipped DATE; + DECLARE vDateLanded DATE; + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vCalcVisible INT; + DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate(); + + SELECT shipped, landed, warehouseInFk, warehouseOutFk + INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id + WHERE e.id = vSelf; + + CALL vn.rate_getPrices(vDateShipped, vWarehouseIn); + + -- Traslado en almacen origen + CREATE OR REPLACE TEMPORARY TABLE tBuy + (PRIMARY KEY (itemFk), INDEX(buyFk)) + ENGINE = MEMORY + SELECT * + FROM ( + SELECT b.itemFk, b.id buyFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vInventoryDate AND vDateShipped + AND NOT b.isIgnored + AND b.price2 >= 0 + ORDER BY (vWarehouseOut = t.warehouseInFk) DESC, t.landed DESC + LIMIT 10000000000000000000 + ) sub + GROUP BY itemFk; + + IF vDateShipped >= util.VN_CURDATE() THEN + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseOut); + + CREATE OR REPLACE TEMPORARY TABLE tItem ( + `itemFk` int(10) unsigned NOT NULL, + `visible` int(11) NOT NULL DEFAULT 0, + `available` int(11) NOT NULL DEFAULT 0, + `visibleLanding` int(11) NOT NULL DEFAULT 0, + `availableLanding` int(11) NOT NULL DEFAULT 0, + UNIQUE INDEX i USING HASH (itemFk) + ) ENGINE = MEMORY; + + INSERT INTO tItem(itemFk, visible) + SELECT item_id itemFk, visible + FROM `cache`.visible + WHERE calc_id = vCalcVisible + AND visible; + + CALL `cache`.visible_refresh(vCalcVisible, TRUE, vWarehouseIn); + + INSERT INTO tItem(itemFk, visibleLanding) + SELECT item_id, `visible` + FROM `cache`.`visible` v + WHERE v.calc_id = vCalcVisible + AND v.`visible` + ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; + + CALL vn2008.availableTraslate(vWarehouseOut, vDateShipped, NULL); + + INSERT INTO tItem(itemFk, available) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE available = a.available; + + CALL vn2008.availableTraslate(vWarehouseIn, vDateLanded, vWarehouseOut); + + INSERT INTO tItem(itemFk, availableLanding) + SELECT a.item_id, a.available + FROM vn2008.availableTraslate a + WHERE a.available + ON DUPLICATE KEY UPDATE availableLanding = a.available; + ELSE + CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL); + + CREATE OR REPLACE TEMPORARY TABLE tItem + (UNIQUE INDEX i USING HASH (itemFk)) + ENGINE = MEMORY + SELECT itemFk, + `visible`, + available, + 0 visibleLanding, + 0 availableLanding + FROM tmp.itemList; + END IF; + + CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); + + CREATE OR REPLACE TEMPORARY TABLE tTransfer + ENGINE = MEMORY + SELECT it.code `type`, + it.categoryFk, + i.typeFk, + i.id itemFk, + i.name item, + i.`size`, + i.category, + i.inkFk, + o.code originCode, + b2.quantity, + i.stems, + CAST(ti.visible AS DECIMAL(10,0)) vis1, + CAST(ti.available AS DECIMAL(10,0)) ava1, + CAST(ti.visibleLanding AS DECIMAL(10,0)) vis2, + CAST(ti.availableLanding AS DECIMAL(10,0)) ava2, + COALESCE(b2.`grouping`, b.`grouping`) `grouping`, + COALESCE(b2.packing, b.packing) packing, + COALESCE(b3.groupingMode, b2.groupingMode, b.groupingMode) package, + IFNULL(p.name, s.nickname) productor, + TRUE tinta, + b.packagingFk, + b2.id buyFk, + b2.stickers, + b.ektFk, + it.workerFk, + pa.volume, + IFNULL(pa.width, 0) width, + IFNULL(pa.`depth`, 0) `depth`, + IFNULL(pa.height, 0) height, + IFNULL(b.buyingValue, 0) buyingValue, + IFNULL(b.comissionValue, 0) comissionValue, + IFNULL(b.freightValue, 0) freightValue, + am.m3, + e.commission, + pa.isPackageReturnable, + IFNULL(pa2.value, pa.value) `value`, + r.rate3 r3, + r.rate2 r2, + it.promo, + b.`grouping` groupingOrigin, + b.packing packingOrigin, + b.id buyFkOrigin, + pa.returnCost, + b.weight + FROM vn.item i + JOIN tItem ti ON ti.itemFk = i.id + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN tBuy lb ON lb.itemFk = i.id + LEFT JOIN vn.buy b ON b.id = lb.buyFk + LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk + LEFT JOIN vn.entry e2 ON e2.id = b.entryFk + LEFT JOIN vn.supplier s ON s.id = e2.supplierFk + LEFT JOIN vn.entry e ON e.id = vSelf + LEFT JOIN vn.travel tr ON tr.id = e.travelFk + LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk + LEFT JOIN vn.buy b2 ON b2.itemFk = i.id + AND b2.entryFk = vSelf + LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk + LEFT JOIN tmp.rate r ON TRUE + LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id + LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk + WHERE ic.display + AND NOT e.isRaid + AND (ti.visible OR ti.available) + ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name; + + CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); + + SET @carriage := 0; + SET @comission := 0; + SET @packaging := 0; + SET @rate3 := 0; + SET @cost := 0; + SELECT *, + quantity - MOD(quantity , `grouping`) subQuantity, + MOD(quantity, `grouping`) soll, + ROUND((IF(volume > 0,volume, width * `depth` * + IF(height = 0, `size` + 10, height))) / + packing, 0) cm3, + buyingValue + comissionValue + freightValue cost, + @carriage := ROUND((IF(volume > 0, volume, width * `depth` * + IF(height = 0, `size` + 10, height))) * + m3 / 1000000 / Packing, 3) carriage, + @comission := ROUND((buyingValue + comissionValue + freightValue) * + commission / 100, 3) commission, + ROUND(@packaging := (returnCost + IF(isPackageReturnable, 0, value)) + / packing, 3) packaging, + @cost := IFNULL((buyingValue + comissionValue + freightValue), 0) + + IFNULL(@packaging, 0) + + IFNULL(@carriage, 0) + + IFNULL(@comission, 0) expense, + @rate3 := ROUND(@cost / ( (100 - r3 - promo) / 100), 2) rate3, + ROUND(@rate3 * (1 + ((r2 - r3)/100)), 2) rate2, + FALSE selected + FROM tTransfer; + + DROP TEMPORARY TABLE IF EXISTS + tTransfer, + tItem, + tBuy, + tmp.buyUltimateFromInterval, + tmp.rate, + tmp.itemList; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_lock` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -53785,147 +54664,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `fustControl` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT p.id FustCode, - CAST(sent.stucks AS DECIMAL(10,0)) FH, - CAST(tp.stucks AS DECIMAL(10,0)) Tickets, - CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, - CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo - FROM vn.packaging p - LEFT JOIN ( - SELECT FustCode, sum(fustQuantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,b.packagingFk) FustCode, s.quantity / b.packing AS fustQuantity - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - JOIN vn.packaging p ON p.id = b.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA') sub - GROUP BY FustCode) sent ON sent.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0) sub - GROUP BY FustCode) tp ON tp.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND t.clientFk = vSijsnerClientFk) sub - GROUP BY FustCode) sj ON sj.FustCode = p.id - WHERE sent.stucks - OR tp.stucks - OR sj.stucks; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `fustControlDetail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT a.nickname shopName, - a.city , - IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, - tp.quantity, - tp.ticketFk, - CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `fv_pca` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -54053,13 +54791,13 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`() BEGIN SELECT - e.expeditions_id as expeditionFk, - date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, - e.ticket_id as ticketFk, + e.id as expeditionFk, + date_format(e.created,'%Y-%m-%d') as expeditionDate, + e.ticketFk, t.routeFk as routeFk - FROM vn2008.expeditions e - INNER JOIN vn.ticket t ON t.id = e.ticket_id - WHERE DATE(odbc_date) = util.VN_CURDATE(); + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + WHERE DATE(e.created) = util.VN_CURDATE(); END ;; DELIMITER ; @@ -56564,31 +57302,30 @@ BEGIN ) alb ON alb.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta + FROM itemTicketOut + WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseFk = vWarehouseFk + GROUP BY itemFk ) sale ON sale.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra + FROM itemEntryIn + WHERE landed BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseInFk = vWarehouseFk AND isVirtualStock = FALSE - GROUP BY item_id + GROUP BY itemFk ) buy ON buy.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado + FROM itemEntryOut + WHERE shipped BETWEEN util.VN_CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(util.VN_CURDATE())) + AND warehouseOutFk = vWarehouseFk + GROUP BY itemFk ) mov ON mov.item_id = i.id WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) AND i.itemPackingTypeFk = 'H' - AND ic.shortLife - ; + AND ic.shortLife; END ;; DELIMITER ; @@ -56768,28 +57505,23 @@ BEGIN * @param vItemFk Identificador de vn.item * @param vSectorFk Identificador de vn.sector */ - DECLARE vWarehouseAliasFk INT; - - SELECT w.aliasFk INTO vWarehouseAliasFk - FROM vn.sector s - JOIN vn.warehouse w ON w.id = s.warehouseFk - WHERE s.id = vSectorFk; - SELECT ish.shelvingFk shelving, - p.code parking, - sum(ish.visible) as stockTotal, - ish.created, - p.pickingOrder + p.code parking, + SUM(ish.visible) stockTotal, + ish.created, + p.pickingOrder FROM vn.itemShelving ish JOIN vn.shelving sh ON sh.code = ish.shelvingFk JOIN vn.parking p ON p.id = sh.parkingFk JOIN vn.sector sc ON sc.id = p.sectorFk JOIN vn.warehouse w ON w.id = sc.warehouseFk - WHERE w.aliasFk = vWarehouseAliasFk - AND ish.visible > 0 - AND ish.itemFk = vItemFk + WHERE sc.id = vSectorFk + AND ish.visible > 0 + AND ish.itemFk = vItemFk GROUP BY ish.id - ORDER BY (sc.id = vSectorFk) DESC, sh.priority DESC, ish.created, p.pickingOrder; + ORDER BY sh.priority DESC, + ish.created, + p.pickingOrder; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57640,12 +58372,12 @@ proc:BEGIN CREATE TEMPORARY TABLE tmp.itemOutTime SELECT *,SUM(amount) quantity FROM - (SELECT item_id itemFk, - amount, + (SELECT io.itemFk, + io.quantity amount, IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes - FROM vn2008.item_out io - JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id + FROM itemTicketOut io + JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.itemFk JOIN vn.ticket t on t.id= io.ticketFk JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk JOIN vn.state s ON s.id = ts.stateFk @@ -57657,10 +58389,10 @@ proc:BEGIN ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk WHERE t.warehouseFk = vWarehouseFk AND s.isPicked = 0 - AND NOT io.Reservado + AND NOT io.reserved AND stPrevious.saleFk IS NULL - AND io.dat >= util.VN_CURDATE() - AND io.dat < util.VN_CURDATE() + INTERVAL 1 DAY + AND io.shipped >= util.VN_CURDATE() + AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY ) sub GROUP BY itemFk, hours, minutes; @@ -58525,11 +59257,13 @@ BEGIN p.code, ish.id, s.priority, - ish.isChecked + ish.isChecked, + ic.url FROM itemShelving ish JOIN item i ON i.id = ish.itemFk JOIN shelving s ON vSelf = s.code COLLATE utf8_unicode_ci LEFT JOIN parking p ON s.parkingFk = p.id + JOIN hedera.imageConfig ic WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vSelf; END ;; DELIMITER ; @@ -60379,7 +61113,8 @@ BEGIN SUM(IFNULL(sub.amount,0)) lack, i.inkFk, IFNULL(im.timed, util.midnight()) timed, - IFNULL(izc.timed, util.midnight()) minTimed + IFNULL(izc.timed, util.midnight()) minTimed, + o.name originFk FROM (SELECT item_id, warehouse_id, amount @@ -60398,6 +61133,7 @@ BEGIN JOIN itemCategory ic ON ic.id = it.categoryFk LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id + JOIN origin o ON o.id = i.originFk WHERE w.isForTicket AND ic.display AND it.code != 'GEN' @@ -63407,7 +64143,7 @@ proc: BEGIN ENGINE = MEMORY SELECT ish.itemFk, p.sectorFk, - st.description = 'previousPrepared' isPreviousPrepared, + st.code = 'previousPrepared' isPreviousPrepared, sc.itemPackingTypeFk FROM itemShelving ish JOIN shelving sh ON sh.code = ish.shelvingFk @@ -63792,7 +64528,7 @@ BEGIN JOIN client c ON c.id = t.clientFk JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id JOIN packagingConfig pc - WHERE IF(st.description = 'previousByPacking', + WHERE IF(st.code = 'previousByPacking', i.`size` > pc.previousPreparationMinimumSize AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), TRUE) @@ -66235,14 +66971,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_replaceItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT) BEGIN @@ -66266,11 +67002,8 @@ BEGIN DECLARE vAgencyModeFk INT; DECLARE vNewPrice DECIMAL(10,2); DECLARE vOldPrice DECIMAL(10,2); - DECLARE vOption INT DEFAULT NULL; + DECLARE vOption VARCHAR(255); DECLARE vNewSaleFk INT; - DECLARE vChangePrice INT DEFAULT 1; - DECLARE vBuyerDiscount INT DEFAULT 4; - DECLARE vManaDiscount INT DEFAULT 3; DECLARE vForceToGrouping INT DEFAULT 1; DECLARE vForceToPacking INT DEFAULT 2; DECLARE vFinalPrice DECIMAL(10,2); @@ -66330,16 +67063,13 @@ BEGIN IF vNewPrice IS NULL THEN CALL util.throw('price retrieval failed'); END IF; + IF vNewPrice > vOldPrice THEN SET vFinalPrice = vOldPrice; - IF worker_isInDepartment('vt') THEN - SET vOption = vManaDiscount; - ELSE - SET vOption = vBuyerDiscount; - END IF; + SET vOption = 'substitution'; ELSE SET vFinalPrice = vNewPrice; - SET vOption = vChangePrice; + SET vOption = 'renewPrices'; END IF; START TRANSACTION; @@ -66972,26 +67702,26 @@ BEGIN ) fue ON fue.itemFk = i.id LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as venta + FROM itemTicketOut + WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseFk = vWarehouseFk + GROUP BY itemFk ) sale ON sale.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as compra + FROM itemEntryIn + WHERE landed BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseInFk = vWarehouseFk AND isVirtualStock = FALSE - GROUP BY item_id + GROUP BY itemFk ) buy ON buy.item_id = i.id LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN util.VN_CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id + SELECT itemFk item_id, CAST(sum(quantity)AS DECIMAL(10,0)) as traslado + FROM itemEntryOut + WHERE shipped BETWEEN util.VN_CURDATE() AND util.dayend(vDated) + AND warehouseOutFk = vWarehouseFk + GROUP BY itemFk ) mov ON mov.item_id = i.id WHERE v.amount; @@ -67671,7 +68401,7 @@ BEGIN SELECT lc.companyFk, s.id, 0, - - (NZ(lc.debit) - NZ(lc.credit)) + - (IFNULL(lc.debit, 0) - IFNULL(lc.credit, 0)) FROM tmp.ledgerComparative lc JOIN supplier s ON s.account = lc.account WHERE lc.`date` BETWEEN vDateFrom AND vDateTo @@ -67756,6 +68486,158 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `supplier_statement` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_statement`( + vSupplierFk INT, + vCurrencyFk INT, + vCompanyFk INT, + vOrderBy VARCHAR(15), + vIsConciliated BOOL +) +BEGIN +/** + * Crea un estado de cuenta de proveedores calculando + * los saldos en euros y en la moneda especificada. + * + * @param vSupplierFk Id del proveedor + * @param vCurrencyFk Id de la moneda + * @param vCompanyFk Id de la empresa + * @param vOrderBy Criterio de ordenación + * @param vIsConciliated Indica si está conciliado o no + * @return tmp.supplierStatement + */ + SET @euroBalance:= 0; + SET @currencyBalance:= 0; + + CREATE OR REPLACE TEMPORARY TABLE tmp.supplierStatement + ENGINE = MEMORY + SELECT *, + @euroBalance:= ROUND( + @euroBalance + IFNULL(paymentEuros, 0) - + IFNULL(invoiceEuros, 0), 2 + ) euroBalance, + @currencyBalance:= ROUND( + @currencyBalance + IFNULL(paymentCurrency, 0) - + IFNULL(invoiceCurrency, 0), 2 + ) currencyBalance + FROM ( + SELECT * FROM + ( + SELECT NULL bankFk, + ii.companyFk, + ii.serial, + ii.id, + CASE + WHEN vOrderBy = 'issued' THEN ii.issued + WHEN vOrderBy = 'bookEntried' THEN ii.bookEntried + WHEN vOrderBy = 'booked' THEN ii.booked + WHEN vOrderBy = 'dueDate' THEN iid.dueDated + END dated, + CONCAT('S/Fra ', ii.supplierRef) sref, + IF(ii.currencyFk > 1, + ROUND(SUM(iid.foreignValue) / SUM(iid.amount), 3), + NULL + ) changeValue, + CAST(SUM(iid.amount) AS DECIMAL(10,2)) invoiceEuros, + CAST(SUM(iid.foreignValue) AS DECIMAL(10,2)) invoiceCurrency, + NULL paymentEuros, + NULL paymentCurrency, + ii.currencyFk, + ii.isBooked, + c.code, + 'invoiceIn' statementType + FROM invoiceIn ii + JOIN invoiceInDueDay iid ON iid.invoiceInFk = ii.id + JOIN currency c ON c.id = ii.currencyFk + WHERE ii.issued > '2014-12-31' + AND ii.supplierFk = vSupplierFk + AND vCurrencyFk IN (ii.currencyFk, 0) + AND vCompanyFk IN (ii.companyFk, 0) + AND (vIsConciliated = ii.isBooked OR NOT vIsConciliated) + GROUP BY iid.id + UNION ALL + SELECT p.bankFk, + p.companyFk, + NULL, + p.id, + CASE + WHEN vOrderBy = 'issued' THEN p.received + WHEN vOrderBy = 'bookEntried' THEN p.received + WHEN vOrderBy = 'booked' THEN p.received + WHEN vOrderBy = 'dueDate' THEN p.dueDated + END, + CONCAT(IFNULL(pm.name, ''), + IF(pn.concept <> '', + CONCAT(' : ', pn.concept), + '') + ), + IF(p.currencyFk > 1, p.divisa / p.amount, NULL), + NULL, + NULL, + p.amount, + p.divisa, + p.currencyFk, + p.isConciliated, + c.code, + 'payment' + FROM payment p + LEFT JOIN currency c ON c.id = p.currencyFk + LEFT JOIN bank b ON b.id = p.bankFk + LEFT JOIN payMethod pm ON pm.id = p.payMethodFk + LEFT JOIN promissoryNote pn ON pn.paymentFk = p.id + WHERE p.received > '2014-12-31' + AND p.supplierFk = vSupplierFk + AND vCurrencyFk IN (p.currencyFk, 0) + AND vCompanyFk IN (p.companyFk, 0) + AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated) + UNION ALL + SELECT NULL, + companyFk, + NULL, + se.id, + CASE + WHEN vOrderBy = 'issued' THEN se.dated + WHEN vOrderBy = 'bookEntried' THEN se.dated + WHEN vOrderBy = 'booked' THEN se.dated + WHEN vOrderBy = 'dueDate' THEN se.dueDated + END, + se.description, + 1, + amount, + NULL, + NULL, + NULL, + currencyFk, + isConciliated, + c.`code`, + 'expense' + FROM supplierExpense se + JOIN currency c ON c.id = se.currencyFk + WHERE se.supplierFk = vSupplierFk + AND vCurrencyFk IN (se.currencyFk,0) + AND vCompanyFk IN (se.companyFk,0) + AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated) + ) sub + ORDER BY (dated IS NULL AND NOT isBooked), + dated, + IF(vOrderBy = 'dueDate', id, NULL) + LIMIT 10000000000000000000 + ) t; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticketBoxesView` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -71766,14 +72648,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_setState` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`( vSelf INT, @@ -71807,8 +72689,8 @@ BEGIN CALL util.throw('ASSIGN_ZONE_FIRST'); END IF; - SET vCanChangeState = ( - vStateCode <> 'ON_CHECKING' OR + SET vCanChangeState = (( + vStateCode <> 'ON_CHECKING' AND vStateCode <> 'CHECKED') OR vticketAlertLevel < vPackedAlertLevel )AND NOT ( vTicketStateCode IN ('CHECKED', 'CHECKING') @@ -71827,6 +72709,7 @@ BEGIN ELSE CALL util.throw('INCORRECT_TICKET_STATE'); END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73242,6 +74125,128 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `travel_getDetailFromContinent` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_getDetailFromContinent`( + vContinentFk INT +) +BEGIN +/** + * Devuelve los detalles de los vuelos que tienen + * un almacén de salida de un continente. + * + * @param vContinentFk Id de continente + */ + DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; + SELECT IFNULL(CONCAT(" ", entryFk), travelFk) travelAndEntry, + sub.* + FROM ( + SELECT tr.id travelFk, + NULL entryFk, + TRUE isTravel, + am.name agency, + tr.ref, + tr.shipped, + wOut.name originBoxes, + tr.landed, + wIn.name destination, + SUM(b.stickers) stickers, + NULL evaNotes, + tr.kg, + CAST(SUM(b.weight * b.stickers) AS INT) loadedkg, + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ) volumeKg, + NULL loadPriority, + NULL invoiceAmount, + s.nickname freighter, + NULL reference + FROM travel tr + LEFT JOIN supplier s ON s.id = tr.cargoSupplierFk + LEFT JOIN entry e ON e.travelFk = tr.id + LEFT JOIN buy b ON b.entryFk = e.id + LEFT JOIN packaging p ON p.id = b.packagingFk + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN country co ON co.id = wOut.countryFk + JOIN agencyMode am ON am.id = tr.agencyModeFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND co.continentFk = vContinentFk + GROUP BY tr.id + UNION ALL + SELECT e.travelFk, + e.id, + FALSE, + s.name, + e.invoiceNumber, + tr.shipped, + wOut.name, + tr.landed, + wIn.name, + SUM(b.stickers), + e.evaNotes, + NULL, + CAST(SUM(b.weight * b.stickers) AS INT), + CAST( + SUM(vc.aerealVolumetricDensity * + b.stickers * + IF(p.volume, + p.volume, + p.width * p.depth * p.height + ) / 1000000 + ) AS INT + ), + loadPriority, + e.invoiceAmount, + s2.nickname, + e.reference + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN packaging p ON p.id = b.packagingFk + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN supplier s ON s.id = e.supplierFk + JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN supplier s2 ON s2.id = tr.cargoSupplierFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN country co ON co.id = wOut.countryFk + JOIN volumeConfig vc + WHERE tr.landed >= vDateFrom + AND co.continentFk = vContinentFk + GROUP BY e.id + ) sub + ORDER BY landed ASC, + shipped ASC, + travelFk, + isTravel DESC, + (loadPriority > 0) DESC, + loadPriority, + agency, + evaNotes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `travel_getEntriesMissingPackage` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -75208,7 +76213,7 @@ BEGIN SET vDated = DATE(vTimed); - SELECT IF(pc.name = 'Conductor +3500kg', + SELECT IF(pc.code = 'driveCE', wc.dayBreakDriver, wc.dayBreak), wc.shortWeekBreak, @@ -76384,6 +77389,60 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `XDiario_check` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_check`() +BEGIN +/** + * Realiza la revisión diaria de los asientos contables, + * identificando y notificando los asientos descuadrados + * y ajustando los saldos en caso necesario. + */ + INSERT INTO mail (receiver, subject, body) + SELECT 'cau@verdnatura.es', + 'Asientos descuadrados', + GROUP_CONCAT(CONCAT(' Asiento: ', ASIEN, ' - Importe:', recon) SEPARATOR ' | \n') + FROM ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING ABS(SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0))) > 0.01 + ) sub + HAVING COUNT(*); + + UPDATE XDiario xd + JOIN ( + SELECT xd.id, SUBCTA, recon + FROM XDiario xd + JOIN ( + SELECT ASIEN, + SUM(IFNULL(ROUND(Eurodebe, 2), 0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) recon + FROM XDiario + WHERE NOT enlazado + GROUP BY ASIEN + HAVING recon + ) sub ON sub.ASIEN = xd.ASIEN + WHERE xd.SUBCTA > '5999999999' + GROUP BY xd.ASIEN + ) sub ON sub.id = xd.id + SET xd.Eurohaber = IF(IFNULL(xd.Eurohaber, 0) = 0, xd.Eurohaber, xd.Eurohaber + sub.recon), + xd.Eurodebe = IF(IFNULL(xd.Eurodebe, 0) = 0, xd.Eurodebe, xd.Eurodebe - sub.recon); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `XDiario_checkDate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -77965,13 +79024,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Agencias_province` +-- Table structure for table `Agencias_province__` -- -DROP TABLE IF EXISTS `Agencias_province`; +DROP TABLE IF EXISTS `Agencias_province__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Agencias_province` ( +CREATE TABLE `Agencias_province__` ( `province_id` smallint(6) unsigned NOT NULL, `agency_id` smallint(5) unsigned NOT NULL, `zona` tinyint(4) NOT NULL, @@ -77981,10 +79040,10 @@ CREATE TABLE `Agencias_province` ( PRIMARY KEY (`province_id`,`agency_id`,`warehouse_id`), KEY `warehouse_id` (`warehouse_id`), KEY `agency_id` (`agency_id`), - CONSTRAINT `Agencias_province_ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Agencias_province_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Agencias_province_ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Agencias_province___ibfk_1` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Agencias_province___ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Agencias_province___ibfk_3` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78047,32 +79106,18 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `Articles_botanical` +-- Table structure for table `Baldas__` -- -DROP TABLE IF EXISTS `Articles_botanical`; -/*!50001 DROP VIEW IF EXISTS `Articles_botanical`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Articles_botanical` AS SELECT - 1 AS `Id_Article`, - 1 AS `genus_id`, - 1 AS `specie_id` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Baldas` --- - -DROP TABLE IF EXISTS `Baldas`; +DROP TABLE IF EXISTS `Baldas__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Baldas` ( +CREATE TABLE `Baldas__` ( `Id_Estanterias` int(11) NOT NULL, `Id_Baldas` int(11) NOT NULL, `h` int(11) NOT NULL, PRIMARY KEY (`Id_Estanterias`,`Id_Baldas`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78094,58 +79139,43 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Bancos_poliza` +-- Temporary table structure for view `Bancos_poliza` -- DROP TABLE IF EXISTS `Bancos_poliza`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Bancos_poliza` ( - `poliza_id` int(11) NOT NULL AUTO_INCREMENT, - `referencia` varchar(45) DEFAULT NULL, - `importe` double NOT NULL, - `com_dispuesto` double DEFAULT NULL, - `com_no_dispuesto` double DEFAULT NULL, - `com_anual` double DEFAULT NULL, - `apertura` date NOT NULL, - `cierre` date DEFAULT NULL, - `Id_Banco` int(11) NOT NULL, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - `supplierFk` int(10) unsigned DEFAULT NULL, - `description` varchar(255) DEFAULT NULL, - `hasGuarantee` tinyint(1) NOT NULL DEFAULT 0, - `dmsFk` int(11) DEFAULT NULL, - `notaryFk` int(10) unsigned DEFAULT NULL, - `currencyFk` tinyint(3) unsigned DEFAULT 2, - `amortizationTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `periodicityTypeFk` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - `insuranceExpired` date DEFAULT NULL, - PRIMARY KEY (`poliza_id`), - KEY `Id_Banco_Poliza_idx` (`Id_Banco`), - KEY `Id_Poliza_Empresa_idx` (`empresa_id`), - KEY `bankSupplierIdx1_idx` (`supplierFk`), - KEY `bankDmsIdx2_idx` (`dmsFk`), - KEY `bankNotaryIdx3_idx` (`notaryFk`), - KEY `asdf_idx` (`amortizationTypeFk`), - KEY `bankPeriodicityIdx4_idx` (`periodicityTypeFk`), - CONSTRAINT `Bancos_polizaCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Bancos_poliza_notaryFk` FOREIGN KEY (`notaryFk`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Bancos_poliza_supplierFk` FOREIGN KEY (`supplierFk`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Id_Banco_Poliza` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`accounting` (`id`) ON UPDATE CASCADE, - CONSTRAINT `asdf` FOREIGN KEY (`amortizationTypeFk`) REFERENCES `vn`.`amortizationType` (`code`) ON UPDATE CASCADE, - CONSTRAINT `bankDmsIdx2` FOREIGN KEY (`dmsFk`) REFERENCES `vn`.`dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `bankPeriodicityIdx4` FOREIGN KEY (`periodicityTypeFk`) REFERENCES `vn`.`periodicityType` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Lineas de credito asociadas a cuentas corrientes'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Bancos_poliza`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Bancos_poliza` AS SELECT + 1 AS `poliza_id`, + 1 AS `referencia`, + 1 AS `importe`, + 1 AS `com_dispuesto`, + 1 AS `com_no_dispuesto`, + 1 AS `com_anual`, + 1 AS `apertura`, + 1 AS `cierre`, + 1 AS `Id_Banco`, + 1 AS `empresa_id`, + 1 AS `supplierFk`, + 1 AS `description`, + 1 AS `hasGuarantee`, + 1 AS `dmsFk`, + 1 AS `notaryFk`, + 1 AS `currencyFk`, + 1 AS `amortizationTypeFk`, + 1 AS `periodicityTypeFk`, + 1 AS `insuranceExpired` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `Brasa` +-- Table structure for table `Brasa__` -- -DROP TABLE IF EXISTS `Brasa`; +DROP TABLE IF EXISTS `Brasa__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Brasa` ( +CREATE TABLE `Brasa__` ( `Id_Cliente` int(10) unsigned NOT NULL DEFAULT 0, `Cliente` varchar(50) NOT NULL, `Vista` int(10) unsigned NOT NULL DEFAULT 0, @@ -78154,7 +79184,7 @@ CREATE TABLE `Brasa` ( `Grupo` int(10) unsigned NOT NULL, PRIMARY KEY (`Id_Cliente`), KEY `Index_1` (`Id_Cliente`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78189,17 +79219,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Clases` +-- Table structure for table `Clases__` -- -DROP TABLE IF EXISTS `Clases`; +DROP TABLE IF EXISTS `Clases__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clases` ( +CREATE TABLE `Clases__` ( `Id_Clase` int(11) NOT NULL DEFAULT 0, `Clase` varchar(50) DEFAULT NULL, PRIMARY KEY (`Id_Clase`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78259,13 +79289,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Clientes_dits` +-- Table structure for table `Clientes_dits__` -- -DROP TABLE IF EXISTS `Clientes_dits`; +DROP TABLE IF EXISTS `Clientes_dits__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_dits` ( +CREATE TABLE `Clientes_dits__` ( `idClientes_dits` int(11) NOT NULL AUTO_INCREMENT, `idaccion_dits` int(11) NOT NULL, `ODBC_DATE` timestamp NOT NULL DEFAULT current_timestamp(), @@ -78275,18 +79305,18 @@ CREATE TABLE `Clientes_dits` ( `value_new` varchar(100) DEFAULT NULL, PRIMARY KEY (`idClientes_dits`), KEY `idaccion_dits` (`idaccion_dits`), - CONSTRAINT `Clientes_dits_ibfk_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Clientes_dits___ibfk_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits__` (`idaccion_dits`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Clientes_empresa` +-- Table structure for table `Clientes_empresa__` -- -DROP TABLE IF EXISTS `Clientes_empresa`; +DROP TABLE IF EXISTS `Clientes_empresa__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_empresa` ( +CREATE TABLE `Clientes_empresa__` ( `Id_Clientes_empresa` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Id_Cliente` int(11) NOT NULL, `empresa_id` int(10) unsigned NOT NULL, @@ -78295,33 +79325,33 @@ CREATE TABLE `Clientes_empresa` ( PRIMARY KEY (`Id_Clientes_empresa`), KEY `empresa_id_idx` (`empresa_id`), CONSTRAINT `Clientes_empresaCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON DELETE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Empresa por defecto para crear los tickets'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Clientes_event` +-- Table structure for table `Clientes_event__` -- -DROP TABLE IF EXISTS `Clientes_event`; +DROP TABLE IF EXISTS `Clientes_event__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_event` ( +CREATE TABLE `Clientes_event__` ( `Id_Cliente` int(11) NOT NULL, `quantity` tinyint(3) unsigned NOT NULL, `odbc_date` timestamp NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`Id_Cliente`), - CONSTRAINT `Clientes_event_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Clientes_event___ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Clientes_potenciales` +-- Table structure for table `Clientes_potenciales__` -- -DROP TABLE IF EXISTS `Clientes_potenciales`; +DROP TABLE IF EXISTS `Clientes_potenciales__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Clientes_potenciales` ( +CREATE TABLE `Clientes_potenciales__` ( `id` int(11) NOT NULL, `PAIS` varchar(12) DEFAULT NULL, `ACTIVIDAD` varchar(10) DEFAULT NULL, @@ -78341,21 +79371,7 @@ CREATE TABLE `Clientes_potenciales` ( `Notas` varchar(255) DEFAULT NULL, `odbc_date` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`NOMBRE`,`POBLACION`,`DIR_POSTAL`,`TELEFONO`,`TELEFONO2`,`FAX`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Colores__` --- - -DROP TABLE IF EXISTS `Colores__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Colores__` ( - `Id_Color` int(11) NOT NULL DEFAULT 0, - `Color` varchar(50) DEFAULT NULL, - PRIMARY KEY (`Id_Color`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #5903 deprecated 2023-06-30'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78375,23 +79391,6 @@ SET character_set_client = utf8; 1 AS `countryFk` */; SET character_set_client = @saved_cs_client; --- --- Table structure for table `Comparativa__` --- - -DROP TABLE IF EXISTS `Comparativa__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Comparativa__` ( - `Periodo` int(11) NOT NULL, - `Id_Article` bigint(20) NOT NULL, - `warehouse_id` int(11) NOT NULL, - `Cantidad` mediumint(9) NOT NULL DEFAULT 0, - `price` mediumint(8) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`Periodo`,`Id_Article`,`warehouse_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='20/11/2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Temporary table structure for view `Compres` -- @@ -78448,13 +79447,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Compres_ok` +-- Table structure for table `Compres_ok__` -- -DROP TABLE IF EXISTS `Compres_ok`; +DROP TABLE IF EXISTS `Compres_ok__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Compres_ok` ( +CREATE TABLE `Compres_ok__` ( `Id_Compra` int(11) NOT NULL, `valor` tinyint(3) unsigned NOT NULL DEFAULT 0, `odbc_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), @@ -78467,8 +79466,8 @@ CREATE TABLE `Compres_ok` ( KEY `Id_Accion` (`Id_Accion`), KEY `Compres_ok_Id_Trabajador_idx` (`Id_Trabajador`), CONSTRAINT `Compres_ok_Id_Trabajador` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`), - CONSTRAINT `Compres_ok_ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Compres_ok___ibfk_1` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78498,36 +79497,36 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Consignatarios_devices` +-- Table structure for table `Consignatarios_devices__` -- -DROP TABLE IF EXISTS `Consignatarios_devices`; +DROP TABLE IF EXISTS `Consignatarios_devices__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Consignatarios_devices` ( +CREATE TABLE `Consignatarios_devices__` ( `Id_Consigna` int(11) NOT NULL, `serialNumber` varchar(45) NOT NULL, `notas` varchar(45) DEFAULT NULL, PRIMARY KEY (`Id_Consigna`,`serialNumber`), CONSTRAINT `Condigna_devices` FOREIGN KEY (`Id_Consigna`) REFERENCES `vn`.`address` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Conteo` +-- Table structure for table `Conteo__` -- -DROP TABLE IF EXISTS `Conteo`; +DROP TABLE IF EXISTS `Conteo__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Conteo` ( +CREATE TABLE `Conteo__` ( `Id_Conteo` int(11) NOT NULL AUTO_INCREMENT, `Id_Article` int(11) NOT NULL, `Fecha` timestamp NOT NULL DEFAULT current_timestamp(), `dispositivo` varchar(15) DEFAULT NULL, `warehouse_id` int(10) unsigned NOT NULL DEFAULT 1, PRIMARY KEY (`Id_Conteo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78573,31 +79572,6 @@ SET character_set_client = utf8; 1 AS `Lleno` */; SET character_set_client = @saved_cs_client; --- --- Table structure for table `Enlaces Facturas__` --- - -DROP TABLE IF EXISTS `Enlaces Facturas__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Enlaces Facturas__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `Asiento` int(11) DEFAULT 0, - `Apunte` int(11) DEFAULT 0, - `Data` datetime DEFAULT NULL, - `Concepto` varchar(40) DEFAULT NULL, - `Cuenta` varchar(10) DEFAULT NULL, - `Debe` double DEFAULT NULL, - `Haber` double DEFAULT NULL, - `Contrapartida` varchar(10) DEFAULT NULL, - `Contabilizado` tinyint(1) NOT NULL DEFAULT 0, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - PRIMARY KEY (`id`), - KEY `empresa_id` (`empresa_id`), - CONSTRAINT `EnlacesFacturas__Company_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Temporary table structure for view `Entradas` -- @@ -78647,38 +79621,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Entradas_dits__` +-- Table structure for table `Entradas_kop__` -- -DROP TABLE IF EXISTS `Entradas_dits__`; +DROP TABLE IF EXISTS `Entradas_kop__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_dits__` ( - `idEntrada_dits` int(11) NOT NULL AUTO_INCREMENT, - `idaccion_dits` int(11) NOT NULL, - `ODBC_DATE` timestamp NOT NULL DEFAULT current_timestamp(), - `Id_Ticket` int(11) NOT NULL, - `Id_Trabajador` int(10) unsigned DEFAULT NULL, - `value_old` varchar(100) DEFAULT NULL, - `value_new` varchar(100) DEFAULT NULL, - PRIMARY KEY (`idEntrada_dits`), - KEY `fgkey_entradas_1_idx` (`idaccion_dits`), - KEY `fgkey_entradas_2_idx` (`Id_Ticket`), - KEY `fgkey_entradas_3_idx` (`Id_Trabajador`), - CONSTRAINT `Entradas_dits___ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fgkey_entradas_1` FOREIGN KEY (`idaccion_dits`) REFERENCES `accion_dits` (`idaccion_dits`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `fgkey_entradas_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6039 @deprecated 2023-08-04'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Entradas_kop` --- - -DROP TABLE IF EXISTS `Entradas_kop`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_kop` ( +CREATE TABLE `Entradas_kop__` ( `Id_Entradas_kop` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Id_Entrada` int(11) NOT NULL, `kop` int(11) DEFAULT NULL, @@ -78686,97 +79635,30 @@ CREATE TABLE `Entradas_kop` ( PRIMARY KEY (`Id_Entradas_kop`), KEY `entradas_entradas_kop_idx` (`Id_Entrada`), CONSTRAINT `entradas_entradas_kop` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relaciona las entradas con los origenes de compra'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Entradas_orden` +-- Temporary table structure for view `Entradas_orden` -- DROP TABLE IF EXISTS `Entradas_orden`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_orden` ( - `Id_Entrada` int(11) NOT NULL, - `orden` int(11) NOT NULL DEFAULT 1 COMMENT '1.- Ordenar por articulo\n2.- Ordenar por compra\n', - PRIMARY KEY (`Id_Entrada`), - CONSTRAINT `entradas_entradas_orden` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Entradas_stack__` --- - -DROP TABLE IF EXISTS `Entradas_stack__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_stack__` ( - `Id_Entrada` int(11) NOT NULL, - `label_number` smallint(6) DEFAULT 0, - PRIMARY KEY (`Id_Entrada`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Entradas_turno__` --- - -DROP TABLE IF EXISTS `Entradas_turno__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Entradas_turno__` ( - `Id_Entrada` int(11) NOT NULL, - `weekDay` tinyint(2) NOT NULL DEFAULT 0, - PRIMARY KEY (`Id_Entrada`), - CONSTRAINT `entrada_entrada_turno` FOREIGN KEY (`Id_Entrada`) REFERENCES `vn`.`entry` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `EnvioMasivo__` --- - -DROP TABLE IF EXISTS `EnvioMasivo__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `EnvioMasivo__` ( - `Id` int(11) NOT NULL AUTO_INCREMENT, - `Cliente` varchar(40) NOT NULL, - `Direccion` varchar(80) NOT NULL, - `CP` varchar(5) NOT NULL, - `Poblacion` varchar(40) NOT NULL, - `Telefono` varchar(9) NOT NULL, - `Bultos` int(11) NOT NULL, - `Observaciones` varchar(40) DEFAULT NULL, - `IdTicket` int(11) NOT NULL, - PRIMARY KEY (`Id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `Equipos` --- - -DROP TABLE IF EXISTS `Equipos`; -/*!50001 DROP VIEW IF EXISTS `Equipos`*/; +/*!50001 DROP VIEW IF EXISTS `Entradas_orden`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `Equipos` AS SELECT - 1 AS `alias`, - 1 AS `descripcion`, - 1 AS `trabajador_id`, - 1 AS `windowsSerial` */; +/*!50001 CREATE VIEW `Entradas_orden` AS SELECT + 1 AS `Id_Entrada`, + 1 AS `orden` */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Espionajes` +-- Table structure for table `Espionajes__` -- -DROP TABLE IF EXISTS `Espionajes`; +DROP TABLE IF EXISTS `Espionajes__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Espionajes` ( +CREATE TABLE `Espionajes__` ( `idEspionaje` int(11) NOT NULL AUTO_INCREMENT, `Id_Trabajador` varchar(45) DEFAULT NULL, `Fecha` date DEFAULT NULL, @@ -78785,188 +79667,67 @@ CREATE TABLE `Espionajes` ( `Id_Equipo` int(11) DEFAULT NULL, PRIMARY KEY (`idEspionaje`), KEY `index` (`Id_Trabajador`,`Fecha`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Estados` +-- Table structure for table `Estados__` -- -DROP TABLE IF EXISTS `Estados`; +DROP TABLE IF EXISTS `Estados__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estados` ( +CREATE TABLE `Estados__` ( `Id_Estado` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `Estado` varchar(50) DEFAULT NULL, PRIMARY KEY (`Id_Estado`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Estanterias__` +-- Table structure for table `Familias__` -- -DROP TABLE IF EXISTS `Estanterias__`; +DROP TABLE IF EXISTS `Familias__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estanterias__` ( - `Id_Estanterias` int(11) NOT NULL AUTO_INCREMENT, - `w` int(11) DEFAULT NULL, - `d` int(11) DEFAULT NULL, - `modelo` varchar(255) DEFAULT NULL, - PRIMARY KEY (`Id_Estanterias`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Estanterias_distri__` --- - -DROP TABLE IF EXISTS `Estanterias_distri__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estanterias_distri__` ( - `idEstanterias_distri` int(11) NOT NULL, - `posinicial` int(11) NOT NULL, - `posfinal` int(11) NOT NULL, - `Id_Estanterias` int(11) NOT NULL, - PRIMARY KEY (`Id_Estanterias`,`idEstanterias_distri`), - KEY `Estanterias_fgkey1_idx` (`Id_Estanterias`), - KEY `est_distrib_fgkey1_idx` (`idEstanterias_distri`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `Estanterias_distri_name__` --- - -DROP TABLE IF EXISTS `Estanterias_distri_name__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Estanterias_distri_name__` ( - `idEstanterias_distri` int(11) NOT NULL AUTO_INCREMENT, - `Descripcion` varchar(255) NOT NULL, - PRIMARY KEY (`idEstanterias_distri`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `Facturas` --- - -DROP TABLE IF EXISTS `Facturas`; -/*!50001 DROP VIEW IF EXISTS `Facturas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Facturas` AS SELECT - 1 AS `factura_id`, - 1 AS `Id_Factura`, - 1 AS `Serie`, - 1 AS `Fecha`, - 1 AS `Importe`, - 1 AS `Id_Cliente`, - 1 AS `odbc_date`, - 1 AS `empresa_id`, - 1 AS `Vencimiento`, - 1 AS `booked`, - 1 AS `Id_Banco`, - 1 AS `siiTypeInvoiceOutFk`, - 1 AS `cplusTaxBreakFk`, - 1 AS `cplusSubjectOpFk`, - 1 AS `siiTrascendencyInvoiceOutFk`, - 1 AS `pdf` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Familias` --- - -DROP TABLE IF EXISTS `Familias`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Familias` ( +CREATE TABLE `Familias__` ( `Familia` varchar(3) NOT NULL, `Subcuenta` varchar(10) DEFAULT NULL, `Descripcion` varchar(50) DEFAULT NULL, PRIMARY KEY (`Familia`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Forms` +-- Table structure for table `Forms__` -- -DROP TABLE IF EXISTS `Forms`; +DROP TABLE IF EXISTS `Forms__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Forms` ( +CREATE TABLE `Forms__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `titulo` varchar(50) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `Gastos` +-- Table structure for table `Grupos__` -- -DROP TABLE IF EXISTS `Gastos`; -/*!50001 DROP VIEW IF EXISTS `Gastos`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Gastos` AS SELECT - 1 AS `Id_Gasto`, - 1 AS `Gasto`, - 1 AS `isWithheld` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Greuges` --- - -DROP TABLE IF EXISTS `Greuges`; -/*!50001 DROP VIEW IF EXISTS `Greuges`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Greuges` AS SELECT - 1 AS `Id`, - 1 AS `Id_Cliente`, - 1 AS `Comentario`, - 1 AS `Importe`, - 1 AS `Fecha`, - 1 AS `odbc_date`, - 1 AS `Greuges_type_id`, - 1 AS `Id_Ticket` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `Greuges_type` --- - -DROP TABLE IF EXISTS `Greuges_type`; -/*!50001 DROP VIEW IF EXISTS `Greuges_type`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Greuges_type` AS SELECT - 1 AS `Greuges_type_id`, - 1 AS `name` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Grupos` --- - -DROP TABLE IF EXISTS `Grupos`; +DROP TABLE IF EXISTS `Grupos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Grupos` ( +CREATE TABLE `Grupos__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `Grupo` varchar(45) NOT NULL, `observation_type_id` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -78986,34 +79747,19 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Informes` +-- Table structure for table `Informes__` -- -DROP TABLE IF EXISTS `Informes`; +DROP TABLE IF EXISTS `Informes__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Informes` ( +CREATE TABLE `Informes__` ( `Id_Informe` tinyint(3) unsigned NOT NULL, `Informe` varchar(50) DEFAULT NULL, PRIMARY KEY (`Id_Informe`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `Intrastat` --- - -DROP TABLE IF EXISTS `Intrastat`; -/*!50001 DROP VIEW IF EXISTS `Intrastat`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Intrastat` AS SELECT - 1 AS `Codintrastat`, - 1 AS `Definicion`, - 1 AS `iva_group_id`, - 1 AS `iva_codigo_id` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `Jefes__` -- @@ -79048,13 +79794,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Monitoring` +-- Table structure for table `Monitoring__` -- -DROP TABLE IF EXISTS `Monitoring`; +DROP TABLE IF EXISTS `Monitoring__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Monitoring` ( +CREATE TABLE `Monitoring__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `equipo_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `user_id` int(10) unsigned NOT NULL, @@ -79069,9 +79815,9 @@ CREATE TABLE `Monitoring` ( KEY `cliente_id` (`cliente_id`), KEY `ticket_id` (`ticket_id`), CONSTRAINT `Monitoring_FK` FOREIGN KEY (`equipo_id`) REFERENCES `vn`.`host` (`code`) ON UPDATE CASCADE, - CONSTRAINT `Monitoring_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `vn`.`worker` (`id`), - CONSTRAINT `Monitoring_ibfk_3` FOREIGN KEY (`form_id`) REFERENCES `Forms` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Monitoring___ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `vn`.`worker` (`id`), + CONSTRAINT `Monitoring___ibfk_3` FOREIGN KEY (`form_id`) REFERENCES `Forms__` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79100,20 +79846,20 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Movimientos_avisar` +-- Table structure for table `Movimientos_avisar__` -- -DROP TABLE IF EXISTS `Movimientos_avisar`; +DROP TABLE IF EXISTS `Movimientos_avisar__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Movimientos_avisar` ( +CREATE TABLE `Movimientos_avisar__` ( `Id_Movimiento` int(11) NOT NULL, `Id_Remitente` int(11) DEFAULT NULL, PRIMARY KEY (`Id_Movimiento`), KEY `Movimiento` (`Id_Movimiento`), KEY `Remitente` (`Id_Remitente`), CONSTRAINT `Id_Movimientos_avisar_fk` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79151,13 +79897,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Movimientos_revisar` +-- Table structure for table `Movimientos_revisar__` -- -DROP TABLE IF EXISTS `Movimientos_revisar`; +DROP TABLE IF EXISTS `Movimientos_revisar__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Movimientos_revisar` ( +CREATE TABLE `Movimientos_revisar__` ( `Id_Movimiento` int(11) NOT NULL, `Comentario` varchar(255) DEFAULT NULL, `Revisado` tinyint(1) NOT NULL DEFAULT 0, @@ -79166,8 +79912,8 @@ CREATE TABLE `Movimientos_revisar` ( PRIMARY KEY (`Id_Movimiento`), KEY `Remitente` (`Id_Remitente`), KEY `Destinatario` (`Id_Destinatario`), - CONSTRAINT `Movimientos_revisar_ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `Movimientos_revisar___ibfk_1` FOREIGN KEY (`Id_Movimiento`) REFERENCES `vn`.`sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79231,27 +79977,19 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Pagares` +-- Temporary table structure for view `Pagares` -- DROP TABLE IF EXISTS `Pagares`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Pagares` ( - `kk_Vencimiento` datetime DEFAULT NULL, - `kk_Importe` double DEFAULT 0, - `Fechaemision` timestamp NOT NULL DEFAULT current_timestamp(), - `Id_Pagare` int(11) NOT NULL AUTO_INCREMENT, - `Concepto` varchar(50) DEFAULT NULL, - `kk_id_proveedor` int(11) DEFAULT NULL, - `kk_empresa_id` smallint(5) unsigned DEFAULT NULL, - `pago_id` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`Id_Pagare`), - KEY `empresa_id` (`kk_empresa_id`), - KEY `pago_id` (`pago_id`), - CONSTRAINT `Pagares_ibfk_2` FOREIGN KEY (`pago_id`) REFERENCES `vn`.`payment` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Pagares`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Pagares` AS SELECT + 1 AS `Id_Pagare`, + 1 AS `Fechaemision`, + 1 AS `Concepto`, + 1 AS `pago_id` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Paises` @@ -79288,7 +80026,7 @@ CREATE TABLE `Permisos__` ( KEY `empresa_id` (`empresa_id`), KEY `Permisos_ibfk_3_idx` (`Id_Trabajador`), CONSTRAINT `PermisosCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Permisos___ibfk_2` FOREIGN KEY (`Id_Grupo`) REFERENCES `Grupos` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `Permisos___ibfk_2` FOREIGN KEY (`Id_Grupo`) REFERENCES `Grupos__` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `Permisos___ibfk_3` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -79308,19 +80046,6 @@ SET character_set_client = utf8; 1 AS `PrecioEspecial` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `Prioridades` --- - -DROP TABLE IF EXISTS `Prioridades`; -/*!50001 DROP VIEW IF EXISTS `Prioridades`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Prioridades` AS SELECT - 1 AS `Id_Prioridad`, - 1 AS `Prioridad` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `Proveedores` -- @@ -79378,13 +80103,13 @@ CREATE TABLE `Proveedores_cargueras` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Proveedores_comunicados` +-- Table structure for table `Proveedores_comunicados__` -- -DROP TABLE IF EXISTS `Proveedores_comunicados`; +DROP TABLE IF EXISTS `Proveedores_comunicados__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Proveedores_comunicados` ( +CREATE TABLE `Proveedores_comunicados__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id_Proveedor` int(10) unsigned NOT NULL, `escrito_id` int(11) NOT NULL, @@ -79392,39 +80117,38 @@ CREATE TABLE `Proveedores_comunicados` ( PRIMARY KEY (`id`), KEY `Proveedor` (`Id_Proveedor`), KEY `Escrito` (`escrito_id`), - CONSTRAINT `Proveedores_comunicados_ibfk_4` FOREIGN KEY (`escrito_id`) REFERENCES `Proveedores_escritos` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Proveedores_comunicados___ibfk_4` FOREIGN KEY (`escrito_id`) REFERENCES `Proveedores_escritos__` (`id`) ON UPDATE CASCADE, CONSTRAINT `Proveedores_comunicados_supplierFk` FOREIGN KEY (`Id_Proveedor`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Proveedores_escritos` +-- Table structure for table `Proveedores_escritos__` -- -DROP TABLE IF EXISTS `Proveedores_escritos`; +DROP TABLE IF EXISTS `Proveedores_escritos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Proveedores_escritos` ( +CREATE TABLE `Proveedores_escritos__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `escrito` varchar(45) NOT NULL, `informe` varchar(45) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Proveedores_gestdoc` +-- Temporary table structure for view `Proveedores_gestdoc` -- DROP TABLE IF EXISTS `Proveedores_gestdoc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Proveedores_gestdoc` ( - `Id_Proveedor` int(11) NOT NULL, - `gestdoc_id` int(11) NOT NULL, - PRIMARY KEY (`Id_Proveedor`,`gestdoc_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Proveedores_gestdoc`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Proveedores_gestdoc` AS SELECT + 1 AS `Id_Proveedor`, + 1 AS `gestdoc_id` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Recibos` @@ -79463,24 +80187,19 @@ CREATE TABLE `Recibos_recorded__` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Remesas` +-- Temporary table structure for view `Remesas` -- DROP TABLE IF EXISTS `Remesas`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Remesas` ( - `Id_Remesa` int(11) NOT NULL AUTO_INCREMENT, - `Fecha Remesa` datetime DEFAULT NULL, - `Banco` int(11) DEFAULT 0, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - PRIMARY KEY (`Id_Remesa`), - KEY `Id_Banco` (`Banco`), - KEY `empresa_id` (`empresa_id`), - CONSTRAINT `RemesasCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Remesas_ibfk_2` FOREIGN KEY (`Banco`) REFERENCES `vn`.`accounting` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Remesas`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Remesas` AS SELECT + 1 AS `Id_Remesa`, + 1 AS `Fecha Remesa`, + 1 AS `Banco`, + 1 AS `empresa_id` */; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `Reservas__` @@ -79537,80 +80256,67 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Saldos_Prevision` +-- Temporary table structure for view `Saldos_Prevision` -- DROP TABLE IF EXISTS `Saldos_Prevision`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Saldos_Prevision` ( - `Saldos_Prevision_id` int(11) NOT NULL AUTO_INCREMENT, - `Descripcion` varchar(45) DEFAULT NULL, - `Importe` double NOT NULL DEFAULT 0, - `Fecha` date NOT NULL, - `Id_Banco` int(11) DEFAULT NULL, - `empresa_id` int(10) unsigned NOT NULL DEFAULT 442, - PRIMARY KEY (`Saldos_Prevision_id`), - KEY `Fecha_indice` (`Fecha`), - KEY `banco_prevision_idx` (`Id_Banco`), - KEY `empresa_prevision_idx` (`empresa_id`), - CONSTRAINT `Saldos_PrevisionCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `banco_prevision` FOREIGN KEY (`Id_Banco`) REFERENCES `vn`.`accounting` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Aqui ponemos los gastos e ingresos pendientes de introducir '; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Saldos_Prevision`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Saldos_Prevision` AS SELECT + 1 AS `Saldos_Prevision_id`, + 1 AS `Descripcion`, + 1 AS `Importe`, + 1 AS `Fecha`, + 1 AS `Id_Banco`, + 1 AS `empresa_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `Series` +-- Table structure for table `Series__` -- -DROP TABLE IF EXISTS `Series`; +DROP TABLE IF EXISTS `Series__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Series` ( +CREATE TABLE `Series__` ( `Id_Serie` varchar(2) NOT NULL, `Serie` varchar(30) DEFAULT NULL, `Cuenta` varchar(10) DEFAULT NULL, PRIMARY KEY (`Id_Serie`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `Split_lines` +-- Temporary table structure for view `Split_lines` -- DROP TABLE IF EXISTS `Split_lines`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Split_lines` ( - `Id_Split_lines` int(11) NOT NULL AUTO_INCREMENT, - `Id_Split` int(11) NOT NULL, - `Id_Article` int(11) DEFAULT NULL, - `Id_Compra` int(11) DEFAULT NULL, - PRIMARY KEY (`Id_Split_lines`), - KEY `Id_Split` (`Id_Split`), - KEY `Id_Compra` (`Id_Compra`), - CONSTRAINT `Id_Compra` FOREIGN KEY (`Id_Compra`) REFERENCES `vn`.`buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `Split_lines_ibfk_1` FOREIGN KEY (`Id_Split`) REFERENCES `Splits` (`Id_Split`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Split_lines`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Split_lines` AS SELECT + 1 AS `Id_Split_lines`, + 1 AS `Id_Split`, + 1 AS `Id_Article`, + 1 AS `Id_Compra` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `Splits` +-- Temporary table structure for view `Splits` -- DROP TABLE IF EXISTS `Splits`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Splits` ( - `Id_Split` int(11) NOT NULL AUTO_INCREMENT, - `Id_Ticket` int(11) DEFAULT NULL, - `Id_Entrada` int(11) DEFAULT NULL, - `Fecha` datetime DEFAULT NULL, - `Notas` varchar(255) DEFAULT NULL, - PRIMARY KEY (`Id_Split`), - KEY `Id_Entrada` (`Id_Entrada`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `Splits`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `Splits` AS SELECT + 1 AS `Id_Split`, + 1 AS `Id_Ticket`, + 1 AS `Id_Entrada`, + 1 AS `Fecha`, + 1 AS `Notas` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `Tickets` @@ -79653,19 +80359,19 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Tickets_stack` +-- Table structure for table `Tickets_stack__` -- -DROP TABLE IF EXISTS `Tickets_stack`; +DROP TABLE IF EXISTS `Tickets_stack__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tickets_stack` ( +CREATE TABLE `Tickets_stack__` ( `Id_Ticket` int(11) NOT NULL, `orden` smallint(5) unsigned NOT NULL, `label_number` smallint(6) DEFAULT 0, `preparado` tinyint(4) DEFAULT 0, PRIMARY KEY (`Id_Ticket`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Orden para imprimir los F5.Se borra autom. lo de 2 meses'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79743,17 +80449,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Tipos_f11` +-- Table structure for table `Tipos_f11__` -- -DROP TABLE IF EXISTS `Tipos_f11`; +DROP TABLE IF EXISTS `Tipos_f11__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tipos_f11` ( +CREATE TABLE `Tipos_f11__` ( `f11_id` tinyint(4) NOT NULL AUTO_INCREMENT, `description` varchar(15) NOT NULL, PRIMARY KEY (`f11_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79780,18 +80486,18 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `Tramos` +-- Table structure for table `Tramos__` -- -DROP TABLE IF EXISTS `Tramos`; +DROP TABLE IF EXISTS `Tramos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Tramos` ( +CREATE TABLE `Tramos__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Tramo` time NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Tramo` (`Tramo`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -79821,205 +80527,103 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `Vehiculos` --- - -DROP TABLE IF EXISTS `Vehiculos`; -/*!50001 DROP VIEW IF EXISTS `Vehiculos`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `Vehiculos` AS SELECT - 1 AS `Id_Vehiculo`, - 1 AS `Matricula`, - 1 AS `Marca`, - 1 AS `Modelo`, - 1 AS `empresa_id`, - 1 AS `warehouseFk`, - 1 AS `description`, - 1 AS `m3`, - 1 AS `active`, - 1 AS `deliveryPointFk` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `Vehiculos_consumo` +-- Temporary table structure for view `Vehiculos_consumo` -- DROP TABLE IF EXISTS `Vehiculos_consumo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `Vehiculos_consumo` ( - `Vehiculos_consumo_id` int(11) NOT NULL AUTO_INCREMENT, - `Id_Vehiculo` int(10) unsigned NOT NULL, - `fecha` date NOT NULL, - `km` int(20) unsigned NOT NULL, - `litros` double unsigned NOT NULL, - `precio` double unsigned NOT NULL, - `adblue` decimal(10,2) NOT NULL DEFAULT 0.00, - `peajes` double DEFAULT NULL, - `descuento` double DEFAULT NULL, - `silla` int(11) NOT NULL DEFAULT 0 COMMENT 'indica si han repostado en la gasolinera de la rotonda', - `odbc_date` timestamp NULL DEFAULT current_timestamp(), - `otros` double DEFAULT NULL, - `fuelTypeFk` varchar(45) DEFAULT NULL, - `proveedoresFk` int(10) unsigned DEFAULT NULL, - `liters100km` decimal(10,2) DEFAULT NULL COMMENT 'se rellena en Vehiculos_consumo_beforeInsert y son los litros consumidos a los 100 kilometros', - `gasoline` decimal(10,2) NOT NULL DEFAULT 0.00, - PRIMARY KEY (`Vehiculos_consumo_id`,`Id_Vehiculo`), - KEY `fk_Vehiculos_consumo_Vehiculos_idx` (`Id_Vehiculo`), - KEY `fuelTypeFk_idx` (`fuelTypeFk`), - KEY `proveedoresFk_idx` (`proveedoresFk`), - CONSTRAINT `Vehiculos_consumo_supplierFk` FOREIGN KEY (`proveedoresFk`) REFERENCES `vn`.`supplier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `fk_Vehiculos_consumo_Vehiculos` FOREIGN KEY (`Id_Vehiculo`) REFERENCES `vn`.`vehicle` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fuelTypeFk` FOREIGN KEY (`fuelTypeFk`) REFERENCES `vn`.`fuelType` (`code`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='En esta tabla apuntan el importe de los tickets de la gasolinera solred, con quien tenemos un contrato y nos facturan mensualmente'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `XDiario` --- - -DROP TABLE IF EXISTS `XDiario`; -/*!50001 DROP VIEW IF EXISTS `XDiario`*/; +/*!50001 DROP VIEW IF EXISTS `Vehiculos_consumo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `XDiario` AS SELECT - 1 AS `id`, - 1 AS `ASIEN`, - 1 AS `FECHA`, - 1 AS `SUBCTA`, - 1 AS `CONTRA`, - 1 AS `CONCEPTO`, - 1 AS `EURODEBE`, - 1 AS `EUROHABER`, - 1 AS `BASEEURO`, - 1 AS `SERIE`, - 1 AS `FACTURA`, - 1 AS `IVA`, - 1 AS `RECEQUIV`, - 1 AS `CLAVE`, - 1 AS `CAMBIO`, - 1 AS `DEBEME`, - 1 AS `HABERME`, - 1 AS `AUXILIAR`, - 1 AS `MONEDAUSO`, - 1 AS `TIPOOPE`, - 1 AS `NFACTICK`, - 1 AS `TERIDNIF`, - 1 AS `TERNIF`, - 1 AS `TERNOM`, - 1 AS `OPBIENES`, - 1 AS `L340`, - 1 AS `enlazado`, - 1 AS `FECHA_EX`, - 1 AS `LRECT349`, - 1 AS `empresa_id`, - 1 AS `LDIFADUAN`, - 1 AS `METAL`, - 1 AS `METALIMP`, - 1 AS `CLIENTE`, - 1 AS `METALEJE`, - 1 AS `FECHA_OP`, - 1 AS `FACTURAEX`, - 1 AS `TIPOCLAVE`, - 1 AS `TIPOEXENCI`, - 1 AS `TIPONOSUJE`, - 1 AS `TIPOFACT`, - 1 AS `TIPORECTIF`, - 1 AS `SERIE_RT`, - 1 AS `FACTU_RT`, - 1 AS `BASEIMP_RT`, - 1 AS `BASEIMP_RF`, - 1 AS `RECTIFICA`, - 1 AS `FECHA_RT`, - 1 AS `created`, - 1 AS `updated`, - 1 AS `FECREGCON`, - 1 AS `enlazadoSage` */; +/*!50001 CREATE VIEW `Vehiculos_consumo` AS SELECT + 1 AS `Vehiculos_consumo_id`, + 1 AS `Id_Vehiculo`, + 1 AS `fecha`, + 1 AS `km`, + 1 AS `litros`, + 1 AS `precio`, + 1 AS `adblue`, + 1 AS `peajes`, + 1 AS `descuento`, + 1 AS `silla`, + 1 AS `odbc_date`, + 1 AS `otros`, + 1 AS `fuelTypeFk`, + 1 AS `proveedoresFk`, + 1 AS `liters100km`, + 1 AS `gasoline` */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `accion_dits` +-- Table structure for table `accion_dits__` -- -DROP TABLE IF EXISTS `accion_dits`; +DROP TABLE IF EXISTS `accion_dits__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `accion_dits` ( +CREATE TABLE `accion_dits__` ( `idaccion_dits` int(11) NOT NULL AUTO_INCREMENT, `accion` varchar(255) DEFAULT NULL, PRIMARY KEY (`idaccion_dits`), UNIQUE KEY `accion_UNIQUE` (`accion`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `account_conciliacion` +-- Temporary table structure for view `account_conciliacion` -- DROP TABLE IF EXISTS `account_conciliacion`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_conciliacion` ( - `idaccount_conciliacion` int(11) NOT NULL AUTO_INCREMENT, - `Id_Proveedores_account` mediumint(8) unsigned NOT NULL, - `Fechaoperacion` datetime NOT NULL, - `FechaValor` datetime NOT NULL, - `importe` double NOT NULL, - `Concepto` varchar(255) DEFAULT NULL, - `DebeHaber` smallint(6) NOT NULL, - `id_calculated` varchar(255) DEFAULT NULL, - `odbc_date` timestamp NULL DEFAULT current_timestamp(), - PRIMARY KEY (`idaccount_conciliacion`), - UNIQUE KEY `idaccount_conciliacion_UNIQUE` (`idaccount_conciliacion`), - KEY `fg_accconciliacion_key1_idx` (`Id_Proveedores_account`), - KEY `index_id_calculated` (`id_calculated`), - CONSTRAINT `fg_key1_accountconc` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `vn`.`supplierAccount` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `account_conciliacion`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `account_conciliacion` AS SELECT + 1 AS `idaccount_conciliacion`, + 1 AS `Id_Proveedores_account`, + 1 AS `Fechaoperacion`, + 1 AS `FechaValor`, + 1 AS `importe`, + 1 AS `Concepto`, + 1 AS `DebeHaber`, + 1 AS `id_calculated`, + 1 AS `odbc_date` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `account_detail` +-- Temporary table structure for view `account_detail` -- DROP TABLE IF EXISTS `account_detail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_detail` ( - `account_detail_id` int(11) NOT NULL AUTO_INCREMENT, - `value` varchar(50) NOT NULL, - `account_detail_type_id` int(11) NOT NULL, - `Id_Proveedores_account` mediumint(8) unsigned NOT NULL, - PRIMARY KEY (`account_detail_id`), - KEY `fk_account_detail_account_detail_type1_idx` (`account_detail_type_id`), - KEY `fk_account_detail_Proveedores_account1_idx` (`Id_Proveedores_account`), - CONSTRAINT `fk_account_detail_account_detail_type1` FOREIGN KEY (`account_detail_type_id`) REFERENCES `account_detail_type` (`account_detail_type_id`) ON UPDATE CASCADE, - CONSTRAINT `fk_account_detail_account_id_proveedores_account` FOREIGN KEY (`Id_Proveedores_account`) REFERENCES `vn`.`supplierAccount` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `account_detail`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `account_detail` AS SELECT + 1 AS `account_detail_id`, + 1 AS `value`, + 1 AS `account_detail_type_id`, + 1 AS `Id_Proveedores_account` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `account_detail_type` +-- Temporary table structure for view `account_detail_type` -- DROP TABLE IF EXISTS `account_detail_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `account_detail_type` ( - `account_detail_type_id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(255) DEFAULT NULL, - PRIMARY KEY (`account_detail_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `account_detail_type`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `account_detail_type` AS SELECT + 1 AS `account_detail_type_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `agencia_descuadre` +-- Table structure for table `agencia_descuadre__` -- -DROP TABLE IF EXISTS `agencia_descuadre`; +DROP TABLE IF EXISTS `agencia_descuadre__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agencia_descuadre` ( +CREATE TABLE `agencia_descuadre__` ( `agencia_descuadre_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Id_Ticket` int(11) NOT NULL, `date` date NOT NULL, @@ -80027,7 +80631,7 @@ CREATE TABLE `agencia_descuadre` ( `Consignatario` varchar(50) NOT NULL, `Tipo` varchar(30) NOT NULL, PRIMARY KEY (`agencia_descuadre_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80042,19 +80646,18 @@ SET character_set_client = utf8; 1 AS `agency_id`, 1 AS `name`, 1 AS `warehouse_id`, - 1 AS `warehouse_alias_id`, 1 AS `propios`, 1 AS `workCenterFk` */; SET character_set_client = @saved_cs_client; -- --- Table structure for table `agency_hour` +-- Table structure for table `agency_hour__` -- -DROP TABLE IF EXISTS `agency_hour`; +DROP TABLE IF EXISTS `agency_hour__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agency_hour` ( +CREATE TABLE `agency_hour__` ( `agency_hour_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `week_day` tinyint(3) unsigned DEFAULT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6', `agency_id` smallint(5) unsigned DEFAULT NULL, @@ -80067,133 +80670,107 @@ CREATE TABLE `agency_hour` ( KEY `agency_id` (`agency_id`), KEY `warehouse_id` (`warehouse_id`), KEY `province_id` (`province_id`), - CONSTRAINT `agency_hour_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agency_hour_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agency_hour_ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `agency_hour___ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agency_hour___ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agency_hour___ibfk_3` FOREIGN KEY (`province_id`) REFERENCES `vn`.`province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `agency_warehouse` +-- Table structure for table `agency_warehouse__` -- -DROP TABLE IF EXISTS `agency_warehouse`; +DROP TABLE IF EXISTS `agency_warehouse__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agency_warehouse` ( +CREATE TABLE `agency_warehouse__` ( `agency_id` smallint(5) unsigned NOT NULL, `warehouse_id` smallint(5) unsigned NOT NULL DEFAULT 1, `Vista` tinyint(3) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`agency_id`,`warehouse_id`), KEY `warehouse_id` (`warehouse_id`), - CONSTRAINT `agency_warehouse_ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agency_warehouse_ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Indica la vista para cada agencia'; + CONSTRAINT `agency_warehouse___ibfk_1` FOREIGN KEY (`agency_id`) REFERENCES `vn`.`agency` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agency_warehouse___ibfk_2` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `airline` +-- Temporary table structure for view `airline` -- DROP TABLE IF EXISTS `airline`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `airline` ( - `airline_id` smallint(2) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(20) NOT NULL, - PRIMARY KEY (`airline_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `airline`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `airline` AS SELECT + 1 AS `airline_id`, + 1 AS `name` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `airport` +-- Temporary table structure for view `airport` -- DROP TABLE IF EXISTS `airport`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `airport` ( - `airport_id` varchar(3) NOT NULL, - `name` varchar(30) DEFAULT NULL, - PRIMARY KEY (`airport_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `airport`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `airport` AS SELECT + 1 AS `airport_id`, + 1 AS `name` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `albaran` +-- Temporary table structure for view `albaran` -- DROP TABLE IF EXISTS `albaran`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `albaran` ( - `albaran_id` int(11) NOT NULL AUTO_INCREMENT, - `ref` varchar(45) DEFAULT NULL, - `note` varchar(150) DEFAULT NULL, - `fecha` date NOT NULL, - `fecha_entrega` date DEFAULT NULL, - `valor` double DEFAULT NULL, - `Id_Proveedor` int(10) unsigned NOT NULL, - `empresa_id` int(10) unsigned NOT NULL, - `warehouse_id` smallint(6) unsigned NOT NULL, - `albaran_state_id` int(11) NOT NULL, - `Id_Trabajador` int(10) unsigned NOT NULL COMMENT 'Id_Trabajador hace referencia a la persona que ha introducido el albarán', - `Id_Responsable` int(10) unsigned NOT NULL, - `department_id` int(11) NOT NULL, - `recibida_id` mediumint(8) unsigned DEFAULT NULL, - `farmingFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`albaran_id`), - KEY `fk_albaran_Proveedores_idx` (`Id_Proveedor`), - KEY `fk_albaran_empresa1_idx` (`empresa_id`), - KEY `fk_albaran_warehouse1_idx` (`warehouse_id`), - KEY `fk_albaran_albaran_state1_idx` (`albaran_state_id`), - KEY `fk_albaran_Trabajadores1_idx` (`Id_Trabajador`), - KEY `fk_albaran_Trabajadores2_idx` (`Id_Responsable`), - KEY `fk_albaran_department1_idx` (`department_id`), - KEY `fk_albaran_recibida_idx` (`recibida_id`), - KEY `albaran_FK` (`farmingFk`), - CONSTRAINT `albaranCompany_Fk` FOREIGN KEY (`empresa_id`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `albaran_FK` FOREIGN KEY (`farmingFk`) REFERENCES `vn`.`farming` (`id`), - CONSTRAINT `albaran_supplierFk` FOREIGN KEY (`Id_Proveedor`) REFERENCES `vn`.`supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_Trabajadores1` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_Trabajadores2` FOREIGN KEY (`Id_Responsable`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_albaran_state1` FOREIGN KEY (`albaran_state_id`) REFERENCES `albaran_state` (`albaran_state_id`) ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_recibida` FOREIGN KEY (`recibida_id`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_warehouse1` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `albaran`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `albaran` AS SELECT + 1 AS `albaran_id`, + 1 AS `ref`, + 1 AS `note`, + 1 AS `fecha`, + 1 AS `fecha_entrega`, + 1 AS `valor`, + 1 AS `Id_Proveedor`, + 1 AS `empresa_id`, + 1 AS `warehouse_id`, + 1 AS `albaran_state_id`, + 1 AS `Id_Trabajador`, + 1 AS `Id_Responsable`, + 1 AS `department_id`, + 1 AS `recibida_id`, + 1 AS `farmingFk` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `albaran_gestdoc` +-- Temporary table structure for view `albaran_gestdoc` -- DROP TABLE IF EXISTS `albaran_gestdoc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `albaran_gestdoc` ( - `gestdoc_id` int(11) NOT NULL, - `albaran_id` int(11) NOT NULL, - PRIMARY KEY (`gestdoc_id`,`albaran_id`), - KEY `fk_albaran_gestdoc_gestdoc1_idx` (`gestdoc_id`), - KEY `fk_albaran_gestdoc_albaran1_idx` (`albaran_id`), - CONSTRAINT `albaran_gestdoc_FK` FOREIGN KEY (`gestdoc_id`) REFERENCES `vn`.`dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fk_albaran_gestdoc_albaran1` FOREIGN KEY (`albaran_id`) REFERENCES `albaran` (`albaran_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `albaran_gestdoc`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `albaran_gestdoc` AS SELECT + 1 AS `gestdoc_id`, + 1 AS `albaran_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `albaran_state` +-- Temporary table structure for view `albaran_state` -- DROP TABLE IF EXISTS `albaran_state`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `albaran_state` ( - `albaran_state_id` int(11) NOT NULL AUTO_INCREMENT, - `state` varchar(45) NOT NULL, - PRIMARY KEY (`albaran_state_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `albaran_state`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `albaran_state` AS SELECT + 1 AS `albaran_state_id`, + 1 AS `state` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `awb` @@ -80236,170 +80813,134 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_component` +-- Temporary table structure for view `awb_component` -- DROP TABLE IF EXISTS `awb_component`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_component` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `awb_id` smallint(11) unsigned DEFAULT NULL, - `Id_Proveedor` int(11) NOT NULL, - `Fecha` date DEFAULT NULL, - `awb_component_type_id` mediumint(3) unsigned DEFAULT NULL, - `awb_role_id` tinyint(1) unsigned NOT NULL DEFAULT 1, - `awb_unit_id` varchar(10) DEFAULT NULL, - `value` decimal(10,2) DEFAULT NULL, - `Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2, - `recibida_id` mediumint(8) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `unique_idx` (`awb_id`,`Id_Proveedor`,`awb_component_type_id`), - KEY `Id_Moneda` (`Id_Moneda`), - KEY `awb_component_fk` (`awb_component_type_id`), - KEY `awb_role_fk` (`awb_role_id`), - KEY `awb_unit_fk` (`awb_unit_id`), - CONSTRAINT `Id_Monedafk` FOREIGN KEY (`Id_Moneda`) REFERENCES `vn`.`currency` (`id`) ON DELETE CASCADE, - CONSTRAINT `awb_component_` FOREIGN KEY (`awb_component_type_id`) REFERENCES `awb_component_type` (`awb_component_type_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_unit_fk` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_component`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_component` AS SELECT + 1 AS `id`, + 1 AS `awb_id`, + 1 AS `Id_Proveedor`, + 1 AS `awb_component_type_id`, + 1 AS `awb_role_id`, + 1 AS `awb_unit_id`, + 1 AS `value`, + 1 AS `Id_Moneda`, + 1 AS `recibida_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_component_template` +-- Temporary table structure for view `awb_component_template` -- DROP TABLE IF EXISTS `awb_component_template`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_component_template` ( - `awb_component_template_id` int(11) NOT NULL AUTO_INCREMENT, - `carguera_id` int(11) DEFAULT NULL, - `airport_in` varchar(3) DEFAULT NULL, - `airport_out` varchar(3) DEFAULT NULL, - `airline_id` smallint(2) unsigned DEFAULT NULL, - `awb_component_type_id` mediumint(3) unsigned NOT NULL, - `Fecha` date NOT NULL, - `awb_role_id` tinyint(1) unsigned NOT NULL, - `awb_unit_id` varchar(10) DEFAULT NULL, - `value` decimal(10,3) DEFAULT NULL, - `max_value` decimal(10,2) unsigned DEFAULT NULL, - `min_value` decimal(10,2) unsigned DEFAULT NULL, - `Id_Moneda` tinyint(3) unsigned NOT NULL DEFAULT 2, - `days` varchar(7) DEFAULT NULL, - PRIMARY KEY (`awb_component_template_id`), - UNIQUE KEY `carguera_id_UNIQUE` (`carguera_id`,`airport_in`,`airport_out`,`airline_id`,`awb_component_type_id`,`Fecha`,`days`), - KEY `Id_Moneda` (`Id_Moneda`), - KEY `airline_idx` (`airline_id`), - KEY `role_idx` (`awb_role_id`), - KEY `awb_unit_fk1` (`awb_unit_id`), - KEY `awb_component_template_FK` (`awb_component_type_id`), - CONSTRAINT `Id_Moneda` FOREIGN KEY (`Id_Moneda`) REFERENCES `vn`.`currency` (`id`) ON UPDATE CASCADE, - CONSTRAINT `awb_component_template_FK` FOREIGN KEY (`awb_component_type_id`) REFERENCES `awb_component_type` (`awb_component_type_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_component_template_FK_1` FOREIGN KEY (`airline_id`) REFERENCES `airline` (`airline_id`) ON UPDATE CASCADE, - CONSTRAINT `awb_unit_fk1` FOREIGN KEY (`awb_unit_id`) REFERENCES `awb_unit` (`awb_unit_id`) ON UPDATE CASCADE, - CONSTRAINT `role_fk` FOREIGN KEY (`awb_role_id`) REFERENCES `awb_role` (`awb_role_id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_component_template`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_component_template` AS SELECT + 1 AS `awb_component_template_id`, + 1 AS `carguera_id`, + 1 AS `airport_in`, + 1 AS `airport_out`, + 1 AS `airline_id`, + 1 AS `awb_component_type_id`, + 1 AS `Fecha`, + 1 AS `awb_role_id`, + 1 AS `awb_unit_id`, + 1 AS `value`, + 1 AS `max_value`, + 1 AS `min_value`, + 1 AS `Id_Moneda`, + 1 AS `days` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_component_type` +-- Temporary table structure for view `awb_component_type` -- DROP TABLE IF EXISTS `awb_component_type`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_component_type` ( - `awb_component_type_id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(45) DEFAULT NULL, - `hasStems` tinyint(1) NOT NULL DEFAULT 1, - PRIMARY KEY (`awb_component_type_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_component_type`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_component_type` AS SELECT + 1 AS `awb_component_type_id`, + 1 AS `description`, + 1 AS `hasStems` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_gestdoc` +-- Temporary table structure for view `awb_gestdoc` -- DROP TABLE IF EXISTS `awb_gestdoc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_gestdoc` ( - `awb_gestdoc_id` int(11) NOT NULL AUTO_INCREMENT, - `awb_id` smallint(11) unsigned NOT NULL, - `gestdoc_id` int(11) NOT NULL, - PRIMARY KEY (`awb_gestdoc_id`), - KEY `awb_gestdoc_awb_fk` (`awb_id`), - KEY `awb_gestdoc_gestdoc_fk` (`gestdoc_id`), - CONSTRAINT `awb_gestdoc_awb_fk` FOREIGN KEY (`awb_id`) REFERENCES `vn`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `awb_gestdoc_gestdoc_fk` FOREIGN KEY (`gestdoc_id`) REFERENCES `vn`.`dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_gestdoc`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_gestdoc` AS SELECT + 1 AS `awb_gestdoc_id`, + 1 AS `awb_id`, + 1 AS `gestdoc_id` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_recibida` +-- Temporary table structure for view `awb_recibida` -- DROP TABLE IF EXISTS `awb_recibida`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_recibida` ( - `awb_id` smallint(5) unsigned NOT NULL, - `recibida_id` mediumint(8) unsigned NOT NULL, - `dua` varchar(18) DEFAULT NULL, - PRIMARY KEY (`recibida_id`), - KEY `awb_id` (`awb_id`), - CONSTRAINT `awb_recibida_ibfk_1` FOREIGN KEY (`awb_id`) REFERENCES `vn`.`awb` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `awb_recibida_ibfk_2` FOREIGN KEY (`recibida_id`) REFERENCES `vn`.`invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_recibida`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_recibida` AS SELECT + 1 AS `awb_id`, + 1 AS `recibida_id`, + 1 AS `dua` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_role` +-- Temporary table structure for view `awb_role` -- DROP TABLE IF EXISTS `awb_role`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_role` ( - `awb_role_id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(45) DEFAULT NULL, - PRIMARY KEY (`awb_role_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT=' '; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_role`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_role` AS SELECT + 1 AS `awb_role_id`, + 1 AS `name` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `awb_unit` +-- Temporary table structure for view `awb_unit` -- DROP TABLE IF EXISTS `awb_unit`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `awb_unit` ( - `awb_unit_id` varchar(10) NOT NULL DEFAULT '', - `operation` varchar(45) DEFAULT NULL, - PRIMARY KEY (`awb_unit_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='tipos de unidades'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `awb_unit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `awb_unit` AS SELECT + 1 AS `awb_unit_id`, + 1 AS `operation` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `balance_nest_tree` +-- Temporary table structure for view `balance_nest_tree` -- DROP TABLE IF EXISTS `balance_nest_tree`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `balance_nest_tree` ( - `lft` int(11) DEFAULT NULL, - `rgt` int(11) DEFAULT NULL, - `name` text DEFAULT NULL, - `id` int(11) NOT NULL AUTO_INCREMENT, - `Id_Gasto` varchar(10) DEFAULT NULL, - `isSelected` tinyint(1) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `balance_nest_tree`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `balance_nest_tree` AS SELECT + 1 AS `lft`, + 1 AS `rgt`, + 1 AS `name`, + 1 AS `id`, + 1 AS `Id_Gasto`, + 1 AS `isSelected` */; +SET character_set_client = @saved_cs_client; -- -- Temporary table structure for view `barcodes` @@ -80415,32 +80956,6 @@ SET character_set_client = utf8; 1 AS `code` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `bionic_updating_options` --- - -DROP TABLE IF EXISTS `bionic_updating_options`; -/*!50001 DROP VIEW IF EXISTS `bionic_updating_options`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `bionic_updating_options` AS SELECT - 1 AS `buo_id`, - 1 AS `description` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `businessReasonEnd` --- - -DROP TABLE IF EXISTS `businessReasonEnd`; -/*!50001 DROP VIEW IF EXISTS `businessReasonEnd`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `businessReasonEnd` AS SELECT - 1 AS `id`, - 1 AS `reason` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `buySource` -- @@ -80556,76 +81071,73 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `buy_edi_k012` +-- Temporary table structure for view `buy_edi_k012` -- DROP TABLE IF EXISTS `buy_edi_k012`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `buy_edi_k012` ( - `buy_edi_k012_id` smallint(6) unsigned NOT NULL, - `description` varchar(50) NOT NULL, - PRIMARY KEY (`buy_edi_k012_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características negativas de los articulos de subasta'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `buy_edi_k012`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `buy_edi_k012` AS SELECT + 1 AS `buy_edi_k012_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `buy_edi_k03` +-- Temporary table structure for view `buy_edi_k03` -- DROP TABLE IF EXISTS `buy_edi_k03`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `buy_edi_k03` ( - `buy_edi_k03_id` tinyint(3) unsigned NOT NULL, - `description` varchar(50) NOT NULL, - PRIMARY KEY (`buy_edi_k03_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características fitosanitarias de los articulos de subasta'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `buy_edi_k03`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `buy_edi_k03` AS SELECT + 1 AS `buy_edi_k03_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `buy_edi_k04` +-- Temporary table structure for view `buy_edi_k04` -- DROP TABLE IF EXISTS `buy_edi_k04`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `buy_edi_k04` ( - `buy_edi_k04_id` tinyint(3) unsigned NOT NULL, - `description` varchar(50) NOT NULL, - PRIMARY KEY (`buy_edi_k04_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Características calidad de los articulos de subasta'; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `buy_edi_k04`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `buy_edi_k04` AS SELECT + 1 AS `buy_edi_k04_id`, + 1 AS `description` */; +SET character_set_client = @saved_cs_client; -- --- Table structure for table `call_information` +-- Table structure for table `call_information__` -- -DROP TABLE IF EXISTS `call_information`; +DROP TABLE IF EXISTS `call_information__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `call_information` ( +CREATE TABLE `call_information__` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Descripcio` text NOT NULL, `Conclusio` tinyint(3) unsigned NOT NULL, `Id_Cliente` int(11) NOT NULL, `fecha` date NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `call_option` +-- Table structure for table `call_option__` -- -DROP TABLE IF EXISTS `call_option`; +DROP TABLE IF EXISTS `call_option__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `call_option` ( +CREATE TABLE `call_option__` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `descripcion` varchar(20) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80718,17 +81230,17 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `cl_dep` +-- Table structure for table `cl_dep__` -- -DROP TABLE IF EXISTS `cl_dep`; +DROP TABLE IF EXISTS `cl_dep__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cl_dep` ( +CREATE TABLE `cl_dep__` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `departamento` varchar(20) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='ELIMINAR Departamentos para las quejas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80746,33 +81258,6 @@ SET character_set_client = utf8; 1 AS `numero` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `cl_dev` --- - -DROP TABLE IF EXISTS `cl_dev`; -/*!50001 DROP VIEW IF EXISTS `cl_dev`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cl_dev` AS SELECT - 1 AS `id`, - 1 AS `devolucion` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `cl_est` --- - -DROP TABLE IF EXISTS `cl_est`; -/*!50001 DROP VIEW IF EXISTS `cl_est`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `cl_est` AS SELECT - 1 AS `id`, - 1 AS `estado`, - 1 AS `roleFk` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `cl_main` -- @@ -80808,31 +81293,31 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `cl_pet` +-- Table structure for table `cl_pet__` -- -DROP TABLE IF EXISTS `cl_pet`; +DROP TABLE IF EXISTS `cl_pet__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cl_pet` ( +CREATE TABLE `cl_pet__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `peticion` varchar(15) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='ELIMINAR Peticiones de los cliente en relacion a las quejas'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cl_que` +-- Table structure for table `cl_que__` -- -DROP TABLE IF EXISTS `cl_que`; +DROP TABLE IF EXISTS `cl_que__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cl_que` ( +CREATE TABLE `cl_que__` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `queja` varchar(25) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='ELIMINAR Queja por linea de las reclamaciones'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80864,28 +81349,28 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `commission` +-- Table structure for table `commission__` -- -DROP TABLE IF EXISTS `commission`; +DROP TABLE IF EXISTS `commission__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `commission` ( +CREATE TABLE `commission__` ( `commisision_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `percentage` tinyint(3) unsigned NOT NULL, `value` float unsigned NOT NULL, PRIMARY KEY (`commisision_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `config` +-- Table structure for table `config__` -- -DROP TABLE IF EXISTS `config`; +DROP TABLE IF EXISTS `config__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `config` ( +CREATE TABLE `config__` ( `id` int(11) NOT NULL, `generic_item` int(11) NOT NULL COMMENT 'Id del artículo genérico', `edi_entry` int(11) NOT NULL COMMENT 'Entrada usada para los EKTs', @@ -80893,7 +81378,7 @@ CREATE TABLE `config` ( `lastNicho` varchar(10) DEFAULT NULL, `lastReserve` varchar(10) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80915,13 +81400,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `config_host_forms` +-- Table structure for table `config_host_forms__` -- -DROP TABLE IF EXISTS `config_host_forms`; +DROP TABLE IF EXISTS `config_host_forms__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `config_host_forms` ( +CREATE TABLE `config_host_forms__` ( `config_host_id` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `formname` varchar(56) NOT NULL, `x` int(8) NOT NULL, @@ -80931,7 +81416,7 @@ CREATE TABLE `config_host_forms` ( `odbc_date` timestamp NULL DEFAULT current_timestamp(), PRIMARY KEY (`config_host_id`,`formname`), CONSTRAINT `config_host_forms_FK` FOREIGN KEY (`config_host_id`) REFERENCES `vn`.`host` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registra las posiciones de los formularios'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -80950,58 +81435,74 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `container` +-- Table structure for table `container__` -- -DROP TABLE IF EXISTS `container`; +DROP TABLE IF EXISTS `container__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `container` ( +CREATE TABLE `container__` ( `container_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, `Continente` varchar(10) DEFAULT NULL, PRIMARY KEY (`container_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cooler_path` +-- Table structure for table `cooler_path__` -- -DROP TABLE IF EXISTS `cooler_path`; +DROP TABLE IF EXISTS `cooler_path__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cooler_path` ( +CREATE TABLE `cooler_path__` ( `cooler_path_id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) DEFAULT NULL, PRIMARY KEY (`cooler_path_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Define el orden en que se imprimen los F5'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cp` +-- Table structure for table `cp__` -- -DROP TABLE IF EXISTS `cp`; +DROP TABLE IF EXISTS `cp__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cp` ( +CREATE TABLE `cp__` ( `cp_id` int(11) NOT NULL AUTO_INCREMENT, `cpd` int(11) NOT NULL, `cph` int(11) NOT NULL, `zone_id` smallint(6) DEFAULT NULL, `town` varchar(45) NOT NULL, PRIMARY KEY (`cp_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Relacio de codis postals i el municipi al qual se asigna'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `credit_card` +-- Temporary table structure for view `credit` -- -DROP TABLE IF EXISTS `credit_card`; +DROP TABLE IF EXISTS `credit`; +/*!50001 DROP VIEW IF EXISTS `credit`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE VIEW `credit` AS SELECT + 1 AS `id`, + 1 AS `Id_Cliente`, + 1 AS `Id_Trabajador`, + 1 AS `amount`, + 1 AS `odbc_date` */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `credit_card__` +-- + +DROP TABLE IF EXISTS `credit_card__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `credit_card` ( +CREATE TABLE `credit_card__` ( `credit_card_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `Id_Cliente` int(10) NOT NULL, `number` varchar(20) NOT NULL, @@ -81011,18 +81512,18 @@ CREATE TABLE `credit_card` ( `obs` varchar(45) DEFAULT NULL, PRIMARY KEY (`credit_card_id`), KEY `Id_Cliente` (`Id_Cliente`), - CONSTRAINT `credit_card_ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; + CONSTRAINT `credit_card___ibfk_1` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cyc` +-- Table structure for table `cyc__` -- -DROP TABLE IF EXISTS `cyc`; +DROP TABLE IF EXISTS `cyc__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cyc` ( +CREATE TABLE `cyc__` ( `Id_Cliente` int(11) NOT NULL, `Riesgo` double DEFAULT NULL, `Fecha` timestamp NOT NULL DEFAULT current_timestamp(), @@ -81030,99 +81531,71 @@ CREATE TABLE `cyc` ( PRIMARY KEY (`cyc_id`), KEY `Cliente` (`Id_Cliente`), CONSTRAINT `Cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `vn`.`client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Detalla los clientes que estan clasificados en Credito y Cau'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `cyc_declaration` +-- Table structure for table `cyc_declaration__` -- -DROP TABLE IF EXISTS `cyc_declaration`; +DROP TABLE IF EXISTS `cyc_declaration__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `cyc_declaration` ( +CREATE TABLE `cyc_declaration__` ( `factura_id` int(10) unsigned NOT NULL, `Riesgo` double DEFAULT NULL, `Fecha` date NOT NULL, `Vencimiento` int(10) NOT NULL DEFAULT 0, PRIMARY KEY (`factura_id`), CONSTRAINT `Factura` FOREIGN KEY (`factura_id`) REFERENCES `vn`.`invoiceOut` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registro de las facturas declaradas a cyc'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `definitivo` +-- Temporary table structure for view `definitivo` -- DROP TABLE IF EXISTS `definitivo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `definitivo` ( - `definitivo_id` int(11) NOT NULL, - `empresa_id` int(11) NOT NULL, - `desde` bigint(20) NOT NULL, - `hasta` bigint(20) NOT NULL, - `fecha` timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (`definitivo_id`,`empresa_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `deliveryPoint` --- - -DROP TABLE IF EXISTS `deliveryPoint`; -/*!50001 DROP VIEW IF EXISTS `deliveryPoint`*/; +/*!50001 DROP VIEW IF EXISTS `definitivo`*/; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; -/*!50001 CREATE VIEW `deliveryPoint` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `ubication` */; +/*!50001 CREATE VIEW `definitivo` AS SELECT + 1 AS `definitivo_id`, + 1 AS `empresa_id`, + 1 AS `desde`, + 1 AS `hasta`, + 1 AS `fecha` */; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `device_user` +-- Table structure for table `dock__` -- -DROP TABLE IF EXISTS `device_user`; -/*!50001 DROP VIEW IF EXISTS `device_user`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `device_user` AS SELECT - 1 AS `device_id`, - 1 AS `user_id` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `dock` --- - -DROP TABLE IF EXISTS `dock`; +DROP TABLE IF EXISTS `dock__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `dock` ( +CREATE TABLE `dock__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(5) NOT NULL, `xPos` int(11) DEFAULT NULL, `yPos` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Soporta la estructura de muelles de paletizacion'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `duaDismissed` +-- Table structure for table `duaDismissed__` -- -DROP TABLE IF EXISTS `duaDismissed`; +DROP TABLE IF EXISTS `duaDismissed__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `duaDismissed` ( +CREATE TABLE `duaDismissed__` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ticketFk` varchar(45) NOT NULL, PRIMARY KEY (`id`,`ticketFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -81180,74 +81653,6 @@ SET character_set_client = utf8; 1 AS `change_date_time` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `edi_feature` --- - -DROP TABLE IF EXISTS `edi_feature`; -/*!50001 DROP VIEW IF EXISTS `edi_feature`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_feature` AS SELECT - 1 AS `item_id`, - 1 AS `feature_type_id`, - 1 AS `feature_value`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_genus` --- - -DROP TABLE IF EXISTS `edi_genus`; -/*!50001 DROP VIEW IF EXISTS `edi_genus`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_genus` AS SELECT - 1 AS `genus_id`, - 1 AS `latin_genus_name`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_item_feature` --- - -DROP TABLE IF EXISTS `edi_item_feature`; -/*!50001 DROP VIEW IF EXISTS `edi_item_feature`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_item_feature` AS SELECT - 1 AS `item_id`, - 1 AS `presentation_order`, - 1 AS `feature`, - 1 AS `regulation_type`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_plant` --- - -DROP TABLE IF EXISTS `edi_plant`; -/*!50001 DROP VIEW IF EXISTS `edi_plant`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_plant` AS SELECT - 1 AS `plant_id`, - 1 AS `genus_id`, - 1 AS `specie_id`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `edi_specie` -- @@ -81279,67 +81684,33 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `edi_testigos` +-- Table structure for table `edi_testigos__` -- -DROP TABLE IF EXISTS `edi_testigos`; +DROP TABLE IF EXISTS `edi_testigos__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `edi_testigos` ( +CREATE TABLE `edi_testigos__` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `table` varchar(25) NOT NULL, `field` varchar(32) NOT NULL, `testigo` varchar(5) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `edi_type` +-- Table structure for table `emp_day_pay__` -- -DROP TABLE IF EXISTS `edi_type`; -/*!50001 DROP VIEW IF EXISTS `edi_type`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_type` AS SELECT - 1 AS `type_id`, - 1 AS `type_group_id`, - 1 AS `description`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `edi_value` --- - -DROP TABLE IF EXISTS `edi_value`; -/*!50001 DROP VIEW IF EXISTS `edi_value`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `edi_value` AS SELECT - 1 AS `type_id`, - 1 AS `type_value`, - 1 AS `type_description`, - 1 AS `entry_date`, - 1 AS `expiry_date`, - 1 AS `change_date_time` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `emp_day_pay` --- - -DROP TABLE IF EXISTS `emp_day_pay`; +DROP TABLE IF EXISTS `emp_day_pay__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `emp_day_pay` ( +CREATE TABLE `emp_day_pay__` ( `id` smallint(5) unsigned NOT NULL, `emp_day_pay` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`,`emp_day_pay`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -81428,49 +81799,13 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Temporary table structure for view `escritos` +-- Table structure for table `expeditions_deleted__` -- -DROP TABLE IF EXISTS `escritos`; -/*!50001 DROP VIEW IF EXISTS `escritos`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `escritos` AS SELECT - 1 AS `id`, - 1 AS `abrev`, - 1 AS `descripcion`, - 1 AS `visible`, - 1 AS `hasCompany` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `expeditions` --- - -DROP TABLE IF EXISTS `expeditions`; -/*!50001 DROP VIEW IF EXISTS `expeditions`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `expeditions` AS SELECT - 1 AS `expeditions_id`, - 1 AS `agency_id`, - 1 AS `ticket_id`, - 1 AS `EsBulto`, - 1 AS `odbc_date`, - 1 AS `counter`, - 1 AS `workerFk`, - 1 AS `externalId`, - 1 AS `Id_article` */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `expeditions_deleted` --- - -DROP TABLE IF EXISTS `expeditions_deleted`; +DROP TABLE IF EXISTS `expeditions_deleted__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `expeditions_deleted` ( +CREATE TABLE `expeditions_deleted__` ( `expeditions_id` int(11) NOT NULL AUTO_INCREMENT, `agency_id` int(11) NOT NULL, `ticket_id` int(10) NOT NULL, @@ -81489,21 +81824,21 @@ CREATE TABLE `expeditions_deleted` ( KEY `index2` (`EsBulto`), KEY `index3` (`odbc_date`), KEY `index4` (`ticket_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Table structure for table `expeditions_pictures` +-- Table structure for table `expeditions_pictures__` -- -DROP TABLE IF EXISTS `expeditions_pictures`; +DROP TABLE IF EXISTS `expeditions_pictures__`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `expeditions_pictures` ( +CREATE TABLE `expeditions_pictures__` ( `Id_Article` int(11) NOT NULL, `NoImprimirEtiqueta` bit(1) DEFAULT b'0', PRIMARY KEY (`Id_Article`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #6371 deprecated 2024-01-11'; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -81591,45 +81926,6 @@ CREATE TABLE `gastos_resumen` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Sirve para resumir los gastos que se ponen a mano en el contaplus'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `gestdoc` --- - -DROP TABLE IF EXISTS `gestdoc`; -/*!50001 DROP VIEW IF EXISTS `gestdoc`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `gestdoc` AS SELECT - 1 AS `id`, - 1 AS `gesttip_id`, - 1 AS `file`, - 1 AS `contentType`, - 1 AS `trabajador_id`, - 1 AS `warehouse_id`, - 1 AS `emp_id`, - 1 AS `orden`, - 1 AS `original`, - 1 AS `sref`, - 1 AS `brief`, - 1 AS `odbc_date` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `gesttip` --- - -DROP TABLE IF EXISTS `gesttip`; -/*!50001 DROP VIEW IF EXISTS `gesttip`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `gesttip` AS SELECT - 1 AS `id`, - 1 AS `tipo`, - 1 AS `readRoleFk`, - 1 AS `writeRoleFk`, - 1 AS `code` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `guillen` -- @@ -81725,42 +82021,6 @@ CREATE TABLE `intervalos__` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Deprecated 27-02-2023'; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `intrastat_data` --- - -DROP TABLE IF EXISTS `intrastat_data`; -/*!50001 DROP VIEW IF EXISTS `intrastat_data`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `intrastat_data` AS SELECT - 1 AS `id`, - 1 AS `recibida_id`, - 1 AS `neto`, - 1 AS `intrastat_id`, - 1 AS `importe`, - 1 AS `unidades`, - 1 AS `Paises_Id`, - 1 AS `odbc_date`, - 1 AS `valorestadistico` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `invoiceCorrection` --- - -DROP TABLE IF EXISTS `invoiceCorrection`; -/*!50001 DROP VIEW IF EXISTS `invoiceCorrection`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `invoiceCorrection` AS SELECT - 1 AS `correctingFk`, - 1 AS `correctedFk`, - 1 AS `cplusRectificationTypeFk`, - 1 AS `siiTypeInvoiceOutFk`, - 1 AS `invoiceCorrectionTypeFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `invoice_observation` -- @@ -81779,78 +82039,6 @@ CREATE TABLE `invoice_observation` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `itemTag` --- - -DROP TABLE IF EXISTS `itemTag`; -/*!50001 DROP VIEW IF EXISTS `itemTag`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `itemTag` AS SELECT - 1 AS `id`, - 1 AS `itemFk`, - 1 AS `tagFk`, - 1 AS `value`, - 1 AS `priority` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `item_entry_in` --- - -DROP TABLE IF EXISTS `item_entry_in`; -/*!50001 DROP VIEW IF EXISTS `item_entry_in`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `item_entry_in` AS SELECT - 1 AS `warehouse_id`, - 1 AS `warehouse_id_out`, - 1 AS `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `received`, - 1 AS `isVirtualStock`, - 1 AS `entryFk` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `item_entry_out` --- - -DROP TABLE IF EXISTS `item_entry_out`; -/*!50001 DROP VIEW IF EXISTS `item_entry_out`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `item_entry_out` AS SELECT - 1 AS `warehouse_id`, - 1 AS `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `delivered`, - 1 AS `entryFk` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `item_out` --- - -DROP TABLE IF EXISTS `item_out`; -/*!50001 DROP VIEW IF EXISTS `item_out`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `item_out` AS SELECT - 1 AS `warehouse_id`, - 1 AS `dat`, - 1 AS `item_id`, - 1 AS `amount`, - 1 AS `ok`, - 1 AS `Reservado`, - 1 AS `invoice`, - 1 AS `saleFk`, - 1 AS `ticketFk` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `jerarquia` -- @@ -82294,35 +82482,6 @@ CREATE TABLE `payrroll_apEmpresarial` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `person_user` --- - -DROP TABLE IF EXISTS `person_user`; -/*!50001 DROP VIEW IF EXISTS `person_user`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `person_user` AS SELECT - 1 AS `id`, - 1 AS `mysql_user_id`, - 1 AS `name`, - 1 AS `password`, - 1 AS `active`, - 1 AS `last_pass_change` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `person_user_idtrabajador` --- - -DROP TABLE IF EXISTS `person_user_idtrabajador`; -/*!50001 DROP VIEW IF EXISTS `person_user_idtrabajador`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `person_user_idtrabajador` AS SELECT - 1 AS `Id_Trabajador` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `plantpassport` -- @@ -82572,20 +82731,6 @@ SET character_set_client = utf8; 1 AS `period` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `reference_min` --- - -DROP TABLE IF EXISTS `reference_min`; -/*!50001 DROP VIEW IF EXISTS `reference_min`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `reference_min` AS SELECT - 1 AS `date`, - 1 AS `rate`, - 1 AS `moneda_id` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `reference_rate` -- @@ -83420,72 +83565,6 @@ SET character_set_client = utf8; 1 AS `boss_id` */; SET character_set_client = @saved_cs_client; --- --- Temporary table structure for view `v_ventes` --- - -DROP TABLE IF EXISTS `v_ventes`; -/*!50001 DROP VIEW IF EXISTS `v_ventes`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_ventes` AS SELECT - 1 AS `Agencia`, - 1 AS `Categoria`, - 1 AS `tipo_id`, - 1 AS `Medida`, - 1 AS `Article`, - 1 AS `Color`, - 1 AS `Id_Cliente`, - 1 AS `Tipo`, - 1 AS `Factura`, - 1 AS `warehouse_id`, - 1 AS `Id_Movimiento`, - 1 AS `Id_Article`, - 1 AS `Familia`, - 1 AS `Id_Ticket`, - 1 AS `Concepte`, - 1 AS `Cantidad`, - 1 AS `quantity`, - 1 AS `Preu`, - 1 AS `Descuento`, - 1 AS `CostFixat`, - 1 AS `Reservado`, - 1 AS `OK`, - 1 AS `PrecioFijado`, - 1 AS `odbc_date`, - 1 AS `Fecha`, - 1 AS `FechaCompleta`, - 1 AS `Alias`, - 1 AS `Id_Consigna`, - 1 AS `Importe`, - 1 AS `Origen`, - 1 AS `reino_id`, - 1 AS `invoice`, - 1 AS `producer_id` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `v_xsubcuentas` --- - -DROP TABLE IF EXISTS `v_xsubcuentas`; -/*!50001 DROP VIEW IF EXISTS `v_xsubcuentas`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `v_xsubcuentas` AS SELECT - 1 AS `COD`, - 1 AS `TITULO`, - 1 AS `NIF`, - 1 AS `DOMICILIO`, - 1 AS `POBLACION`, - 1 AS `PROVINCIA`, - 1 AS `CODPOSTAL`, - 1 AS `country_code`, - 1 AS `empresa_id`, - 1 AS `EMAIL`, - 1 AS `IDNIF` */; -SET character_set_client = @saved_cs_client; - -- -- Temporary table structure for view `versiones` -- @@ -83517,34 +83596,6 @@ CREATE TABLE `viaxpress` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `warehouse` --- - -DROP TABLE IF EXISTS `warehouse`; -/*!50001 DROP VIEW IF EXISTS `warehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `warehouse` AS SELECT - 1 AS `id`, - 1 AS `name`, - 1 AS `inventario`, - 1 AS `fuente`, - 1 AS `is_comparative`, - 1 AS `comisionantes`, - 1 AS `reserve`, - 1 AS `isManaged`, - 1 AS `tpv`, - 1 AS `hasStowaway`, - 1 AS `hasDms`, - 1 AS `address_name`, - 1 AS `delay`, - 1 AS `Id_Paises`, - 1 AS `zone_label`, - 1 AS `valuatedInventory`, - 1 AS `hasConfectionTeam` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `warehouse_filtro` -- @@ -83574,7 +83625,7 @@ CREATE TABLE `warehouse_group` ( PRIMARY KEY (`warehouse_alias_id`,`warehouse_id`), KEY `warehosue_group_ware_idx` (`warehouse_id`), CONSTRAINT `warehosue_group_ware` FOREIGN KEY (`warehouse_id`) REFERENCES `vn`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `warehouse_group_alias` FOREIGN KEY (`warehouse_alias_id`) REFERENCES `vn`.`warehouseAlias` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `warehouse_group_alias` FOREIGN KEY (`warehouse_alias_id`) REFERENCES `vn`.`warehouseAlias__` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Agrupa warehouses '; /*!40101 SET character_set_client = @saved_cs_client */; @@ -83679,35 +83730,6 @@ CREATE TABLE `wks` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Temporary table structure for view `workerDocument` --- - -DROP TABLE IF EXISTS `workerDocument`; -/*!50001 DROP VIEW IF EXISTS `workerDocument`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerDocument` AS SELECT - 1 AS `id`, - 1 AS `worker`, - 1 AS `document`, - 1 AS `isReadableByWorker` */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerTeam` --- - -DROP TABLE IF EXISTS `workerTeam`; -/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE VIEW `workerTeam` AS SELECT - 1 AS `team`, - 1 AS `id`, - 1 AS `user` */; -SET character_set_client = @saved_cs_client; - -- -- Table structure for table `zones` -- @@ -83753,151 +83775,6 @@ DELIMITER ; -- /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `cc_to_iban` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `cc_to_iban`(cc VARCHAR(20)) RETURNS varchar(4) CHARSET utf8mb3 COLLATE utf8mb3_general_ci - DETERMINISTIC -BEGIN - DECLARE iban VARCHAR(4); - select - CONCAT('ES', - RIGHT( - concat(0, - 98- - mod( - concat( - mod( - concat( - mod( - concat( - mod( - substring(cc,1,8), - 97), - substring(cc,9,8) - ), - 97), - substring( - concat( - cc, - 142800 - ), - 17, - 8 - ) - ), - 97), - substring( - concat( - cc, - 142800 - ), - 25, - 2 - ) - ), - 97) - ) - ,2) - )into iban; -RETURN iban; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `intrastat_neto` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `intrastat_neto`(intINSTRASTAT INTEGER,intUNIDADES INTEGER) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE n DOUBLE; - - SELECT ROUND(intUNIDADES / (SUM(MEDIA) / COUNT(media)), 2) INTO n FROM - (SELECT *, unidades / neto MEDIA - FROM intrastat_data - WHERE intrastat_id = intINSTRASTAT AND neto - AND unidades > 0 - ORDER BY odbc_date DESC - LIMIT 20) t; - -- JGF 01/06 per a evitar Kg en negatiu - RETURN n/2; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(dblCANTIDAD DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE dblRESULT DOUBLE; - - SET dblRESULT = IFNULL(dblCANTIDAD,0); - - RETURN dblRESULT; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP FUNCTION IF EXISTS `red` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `red`(intCANTIDAD DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE n DOUBLE; - - SET n = SIGN(intCANTIDAD) * TRUNCATE( (ABS(intCANTIDAD) * 100) + 0.5001 ,0) /100 ; - - RETURN n; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `account_conciliacion_add` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -84283,12 +84160,12 @@ proc: BEGIN CREATE TEMPORARY TABLE tmp.itemCalc (INDEX (itemFk,warehouseFk)) ENGINE = MEMORY - SELECT i.item_id itemFk, vWarehouseLanding warehouseFk, i.dat dated, i.amount quantity - FROM item_out i - JOIN itemRangeLive ir ON ir.itemFK = i.item_id - WHERE i.dat >= vDatedFrom - AND (ir.dated IS NULL OR i.dat <= ir.dated) - AND i.warehouse_id = vWarehouseLanding + SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity + FROM vn.itemTicketOut i + JOIN itemRangeLive ir ON ir.itemFK = i.itemFk + WHERE i.shipped >= vDatedFrom + AND (ir.dated IS NULL OR i.shipped <= ir.dated) + AND i.warehouseFk = vWarehouseLanding UNION ALL SELECT b.itemFk, vWarehouseLanding, t.landed, b.quantity FROM vn.buy b @@ -84302,12 +84179,12 @@ proc: BEGIN AND t.landed >= vDatedFrom AND (ir.dated IS NULL OR t.landed <= ir.dated) UNION ALL - SELECT i.item_id, vWarehouseLanding, i.dat, i.amount - FROM item_entry_out i - JOIN itemRangeLive ir ON ir.itemFk = i.item_id - WHERE i.dat >= vDatedFrom - AND (ir.dated IS NULL OR i.dat <= ir.dated) - AND i.warehouse_id = vWarehouseLanding + SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity + FROM vn.itemEntryOut i + JOIN itemRangeLive ir ON ir.itemFk = i.itemFk + WHERE i.shipped >= vDatedFrom + AND (ir.dated IS NULL OR i.shipped <= ir.dated) + AND i.warehouseOutFk = vWarehouseLanding UNION ALL SELECT r.item_id, vWarehouseLanding, r.shipment, -r.amount FROM hedera.order_row r @@ -84477,9 +84354,9 @@ BEGIN -- Añadimos los gastos, para facilitar el formulario UPDATE tmp.balance b JOIN vn2008.balance_nest_tree bnt on bnt.id = b.id - JOIN (SELECT Id_Gasto, Gasto - FROM vn2008.Gastos - GROUP BY Id_Gasto) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci + JOIN (SELECT id Id_Gasto, name Gasto + FROM vn.expense + GROUP BY id) g ON g.Id_Gasto = bnt.Id_Gasto COLLATE utf8_general_ci SET b.Id_Gasto = g.Id_Gasto COLLATE utf8_general_ci , b.Gasto = g.Gasto COLLATE utf8_general_ci ; @@ -84689,13 +84566,13 @@ BEGIN UNION ALL - SELECT empresa_id, Id_Cliente, - Importe - FROM Facturas f - JOIN Clientes c using(Id_Cliente) + SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount + FROM vn.invoiceOut io + JOIN Clientes c ON c.Id_Cliente = io.clientFk JOIN pay_met pm on pm.id = pay_met_id - WHERE f.Vencimiento > vFechaRemesa + WHERE io.dued > vFechaRemesa AND pay_met_id = 4 AND pm.deudaviva - AND Importe > 0 + AND io.amount > 0 ) risk ON c.Id_Cliente = risk.clientFk GROUP BY risk.companyFk, Id_Cliente @@ -84778,19 +84655,10 @@ proc: BEGIN SET vRangeDeleteTicket = 60; DELETE FROM cdr WHERE calldate < vDate18; - DELETE FROM Monitoring WHERE ODBC_TIME < vDate; - DELETE FROM Conteo WHERE Fecha < vDate; - DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < vDate; - DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE ts - FROM Tickets_stack ts - JOIN Tickets t ON ts.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; - DELETE tobs FROM ticket_observation tobs JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket @@ -84822,13 +84690,6 @@ proc: BEGIN JOIN travel t ON t.id = e.travel_id WHERE t.landing <= vDate; - DELETE co - FROM Compres_ok co JOIN Compres c ON c.Id_Compra = co.Id_Compra - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE t.landing <= vDate; - DELETE FROM scan WHERE odbc_date < vDate6 AND id <> 1; - IF v_full THEN CREATE OR REPLACE TEMPORARY TABLE tTicketDelete SELECT DISTINCT tl.originFk ticketFk @@ -84915,7 +84776,7 @@ BEGIN FROM Clientes WHERE Id_Cliente = idCLI; CALL vn.ledger_next(max_asien); - INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) + INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER UNION ALL @@ -85013,7 +84874,7 @@ BEGIN stock.available FROM vn2008.Tickets t JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn2008.warehouse wh ON wh.id = t.warehouse_id + JOIN vn.warehouse wh ON wh.id = t.warehouse_id JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id @@ -85070,8 +84931,8 @@ BEGIN FROM vn2008.Compres c JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada JOIN vn2008.travel tr ON tr.id = e.travel_id - JOIN vn2008.warehouse whi ON whi.id = tr.warehouse_id - JOIN vn2008.warehouse who ON who.id = tr.warehouse_id_out + JOIN vn.warehouse whi ON whi.id = tr.warehouse_id + JOIN vn.warehouse who ON who.id = tr.warehouse_id_out JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id JOIN vn.confectionType ct ON ct.id = tp.confeccion @@ -85118,11 +84979,11 @@ SELECT * FROM WHERE Id_Cliente = vCustomer AND Fechacobro >= '2017-01-01' UNION ALL - SELECT vn.getDueDate(f.Fecha,c.Vencimiento), - Importe - FROM Facturas f - JOIN Clientes c ON f.Id_Cliente = c.Id_Cliente - WHERE f.Id_Cliente = vCustomer - AND Fecha >= '2017-01-01' + SELECT vn.getDueDate(io.issued,c.Vencimiento), - io.amount + FROM vn.invoiceOut io + JOIN Clientes c ON io.clientFk = c.Id_Cliente + WHERE io.clientFk = vCustomer + AND io.issued >= '2017-01-01' UNION ALL SELECT '2016-12-31', Debt FROM bi.customerDebtInventory @@ -85145,101 +85006,6 @@ SELECT * FROM ; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `desglose_volume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `desglose_volume`(IN vAgencyFk INT) -BEGIN - - DECLARE vStarted DATETIME DEFAULT TIMESTAMP(util.VN_CURDATE()); - DECLARE vEnded DATETIME DEFAULT TIMESTAMP(util.VN_CURDATE(), '23:59:59'); - DECLARE vIsHolland BOOL; - - SELECT (wa.name = 'Holanda') INTO vIsHolland - FROM vn.agency a - JOIN vn.warehouseAlias wa ON wa.id = a.warehouseAliasFk - WHERE a.id = vAgencyFk; - - IF vIsHolland THEN - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_PackagingEstimated; - CREATE TEMPORARY TABLE tmp.ticket_PackagingEstimated - ( - ticketFk INT PRIMARY KEY - ,carros DECIMAL(5,1) DEFAULT 0 - ); - - INSERT INTO tmp.ticket_PackagingEstimated(ticketFk, carros) - SELECT sv.ticketFk, ROUND(vc.dutchCompressionRate * sum(sv.volume) / vc.trolleyM3,0) - FROM vn.ticket t - JOIN vn.saleVolume sv ON sv.ticketFk = t.id - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.volumeConfig vc - WHERE t.shipped BETWEEN vStarted AND vEnded - AND am.agencyFk = vAgencyFk - GROUP BY t.id; - - SELECT a.nickname Provincia, - count(*) expediciones, - 0 Bultos, - sum(tpe.carros) Prevision - FROM vn.ticket t - JOIN vn.address a ON a.id = t.addressFk - JOIN tmp.ticket_PackagingEstimated tpe ON tpe.ticketFk = t.id - GROUP BY a.nickname; - - ELSE - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_PackagingEstimated; - CREATE TEMPORARY TABLE tmp.ticket_PackagingEstimated - ( - ticketFk INT PRIMARY KEY - ,boxes INT DEFAULT 0 - ); - - INSERT INTO tmp.ticket_PackagingEstimated(ticketFk, boxes) - SELECT sv.ticketFk, CEIL(1000 * sum(sv.volume) / vc.standardFlowerBox) - FROM vn.ticket t - JOIN vn.saleVolume sv ON sv.ticketFk = t.id - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.volumeConfig vc - WHERE t.shipped BETWEEN vStarted AND vEnded - AND IFNULL(t.packages,0) = 0 - AND am.agencyFk = vAgencyFk - GROUP BY t.id; - - - SELECT p.name Provincia, - count(*) expediciones, - sum(t.packages) Bultos, - sum(tpe.boxes) Prevision - FROM vn.ticket t - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON a.provinceFk = p.id - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN tmp.ticket_PackagingEstimated tpe ON tpe.ticketFk = t.id - WHERE t.warehouseFk = 60 - AND t.shipped BETWEEN vStarted AND vEnded - AND am.agencyFk = vAgencyFk - GROUP BY p.name; - - END IF; - SELECT * FROM tmp.ticket_PackagingEstimated; - DROP TEMPORARY TABLE tmp.ticket_PackagingEstimated; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -85901,9 +85667,9 @@ SELECT Agencia, FROM Tickets ti INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia - LEFT JOIN (SELECT Ticket_Id,count(*) AS ncajas FROM expeditions WHERE Id_Article=94 GROUP BY ticket_id) sub1 ON ti.Id_Ticket=sub1.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS nbultos FROM expeditions WHERE Id_Article IS NULL GROUP BY ticket_id) sub2 ON ti.Id_Ticket=sub2.Ticket_Id - LEFT JOIN (SELECT Ticket_Id,count(*) AS notros FROM expeditions WHERE Id_Article >0 GROUP BY ticket_id) sub3 ON ti.Id_Ticket=sub3.Ticket_Id + LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE packagingFk=94 GROUP BY ticketFk) sub1 ON ti.Id_Ticket=sub1.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE packagingFk IS NULL GROUP BY ticketFk) sub2 ON ti.Id_Ticket=sub2.ticketFk + LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE packagingFk >0 GROUP BY ticketFk) sub3 ON ti.Id_Ticket=sub3.ticketFk INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk WHERE ti.Fecha=util.VN_CURDATE() AND ts.userFk=intId_Trabajador @@ -86473,16 +86239,10 @@ BEGIN END; START TRANSACTION; - INSERT INTO vn.clientCredit(clientFk, amount) - SELECT c.id, 0 - FROM vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk - WHERE c.credit <> 0 AND pm.`code` = 'card'; - UPDATE vn.`client` c - JOIN vn.payMethod pm ON pm.id = c.payMethodFk + JOIN vn.payMethod pm ON pm.id = c.payMethodFk SET credit = 0 - WHERE pm.`code` = 'card'; + WHERE pm.`code` = 'card'; DROP TEMPORARY TABLE IF EXISTS clientes_credit; CREATE TEMPORARY TABLE clientes_credit @@ -86509,10 +86269,6 @@ BEGIN UPDATE Clientes JOIN clientes_credit USING(Id_Cliente) SET Clientes.Credito = newCredit; - - INSERT INTO credit(Id_Cliente, amount, Id_Trabajador) - SELECT Id_Cliente, newCredit, NULL - FROM clientes_credit; DROP TEMPORARY TABLE clientes_credit; COMMIT; @@ -86621,463 +86377,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `supplierStatement` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierStatement`(vSupplierFk INT, vCurrencyFk INT, vCompanyFk INT, vOrderBy VARCHAR(15), vOnlyConciliated BIT) -BEGIN - SET @saldo_eur:= 0; - SET @saldo_div:= 0; -select vOnlyConciliated; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierStatement; - - CREATE TEMPORARY TABLE tmp.supplierStatement ENGINE = MEMORY - SELECT - *, - @saldo_eur:= round(@saldo_eur + IFNULL(Pago_Euros, 0) - IFNULL(Fac_Euros, 0) ,2 ) AS saldo_eur, - @saldo_div:= round(@saldo_div + IFNULL(Pago_Divisas, 0) - IFNULL(Fac_Divisas, 0) ,2 ) AS saldo_div - FROM - (SELECT * FROM - (SELECT - NULL as banco_id, - r.empresa_id, - r.serie, - r.id, - CASE - WHEN vOrderBy = 'issued' THEN r.fecha - WHEN vOrderBy = 'bookEntried' THEN r.bookEntried - WHEN vOrderBy = 'booked' THEN r.dateBooking - WHEN vOrderBy = 'dueDate' THEN rv.fecha - END AS fecha, - CONCAT('S/Fra ', r.sref) sref, - if(r.moneda_id > 1,round(sum(divisa) / sum(cantidad),3),NULL) val_cambio, - CAST(sum(cantidad) as DECIMAL(10,2)) as Fac_Euros, - CAST(sum(divisa) as DECIMAL(10,2)) as Fac_Divisas, - NULL AS Pago_Euros, - NULL AS Pago_Divisas, - r.moneda_id, - r.contabilizada, - Moneda, - NULL as pago_sdc_id, - 'invoiceIn' statementType - FROM - recibida r - JOIN recibida_vencimiento rv on rv.recibida_id = r.id - JOIN Monedas m on m.Id_Moneda = r.moneda_id - WHERE - r.fecha > '2014-12-31' - AND r.proveedor_id = vSupplierFk - AND vCurrencyFk IN (r.moneda_id, 0) - AND vCompanyFk IN (r.empresa_id,0) - AND (vOnlyConciliated = r.contabilizada OR NOT vOnlyConciliated) - GROUP BY rv.id - - UNION ALL - SELECT - p.id_banco, - p.empresa_id, - NULL, - p.id, - CASE - WHEN vOrderBy = 'issued' THEN p.Fecha - WHEN vOrderBy = 'bookEntried' THEN p.Fecha - WHEN vOrderBy = 'booked' THEN p.Fecha - WHEN vOrderBy = 'dueDate' THEN p.dueDated - END AS fecha, - CONCAT(IFNULL(name, ''), IF(pre.concepto <> '', CONCAT(' : ', pre.concepto), '')), - if(p.id_moneda > 1, p.divisa / importe, NULL) tip_cambio, - NULL, - NULL, - p.importe, - p.divisa, - p.id_moneda, - p.conciliado, - Moneda, - NULL as pago_sdc_id, - 'payment' statementType - FROM - pago p - LEFT JOIN Monedas ON Monedas.Id_Moneda = p.id_moneda - LEFT JOIN Bancos ON p.id_banco = Bancos.Id_banco - LEFT JOIN pay_met pm ON p.pay_met_id = pm.id - LEFT JOIN Pagares pre ON pre.pago_id = p.id - WHERE - Fecha > '2014-12-31' - AND p.Id_Proveedor = vSupplierFk - AND vCurrencyFk IN (p.id_moneda,0) - AND vCompanyFk IN (p.empresa_id,0) - AND (vOnlyConciliated = p.conciliado OR NOT vOnlyConciliated) - UNION ALL - SELECT - NULL, - companyFk, - NULL, - se.id, - CASE - WHEN vOrderBy = 'issued' THEN se.dated - WHEN vOrderBy = 'bookEntried' THEN se.dated - WHEN vOrderBy = 'booked' THEN se.dated - WHEN vOrderBy = 'dueDate' THEN se.dueDated - END AS fecha, - se.description, - 1 tip_cambio, - amount, - NULL, - NULL, - NULL, - currencyFk, - isConciliated, - c.`code`, - NULL, - 'expense' statementType - FROM vn.supplierExpense se - JOIN vn.currency c on c.id= se.currencyFk - WHERE se.supplierFk = vSupplierFk - AND vCurrencyFk IN (se.currencyFk,0) - AND vCompanyFk IN (se.companyFk,0) - AND (vOnlyConciliated = se.isConciliated OR NOT vOnlyConciliated) - ) AS SUB - ORDER BY (fecha is null and NOT contabilizada),fecha, IF(vOrderBy = 'dueDate', id, NULL) LIMIT 10000000000000000000) t; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `traslado` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `traslado`(IN i_entrada INTEGER) -BEGIN - DECLARE dateShipment DATE; - DECLARE dateLanding DATE; - DECLARE warehouseShipment INTEGER; - DECLARE warehouseLanding INTEGER; - DECLARE v_calc_visible INTEGER; - DECLARE vInventoryDate DATE; - - SET vInventoryDate := vn.getInventoryDate(); - SELECT shipment, landing, warehouse_id_out, warehouse_id - INTO dateShipment, dateLanding, warehouseShipment, warehouseLanding - FROM travel t JOIN Entradas e ON t.id = e.travel_id - WHERE Id_Entrada = i_entrada; - - CALL vn.rate_getPrices(dateShipment, warehouseLanding); - - -- Traslado en almacen origen - - DROP TEMPORARY TABLE IF EXISTS buy_edi_temp; - CREATE TEMPORARY TABLE buy_edi_temp - (KEY (Id_Article), INDEX(Id_Compra)) ENGINE = MEMORY - SELECT * - FROM (SELECT c.Id_Article, c.Id_Compra - FROM Compres c INNER JOIN Entradas e USING(Id_Entrada) - INNER JOIN travel t ON t.id = e.travel_id - WHERE t.landing BETWEEN vInventoryDate AND dateShipment - AND c.Novincular = FALSE - AND c.Tarifa2 >= 0 - ORDER BY (warehouseShipment = t.warehouse_id) DESC, t.landing DESC - LIMIT 10000000000000000000) t - GROUP BY Id_Article; - - IF dateShipment >= util.VN_CURDATE() THEN - CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseShipment); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item ( - `itemFk` int(10) unsigned NOT NULL, - `visible` int(11) NOT NULL DEFAULT 0, - `available` int(11) NOT NULL DEFAULT 0, - `visibleLanding` int(11) NOT NULL DEFAULT 0, - `availableLanding` int(11) NOT NULL DEFAULT 0, - UNIQUE INDEX i USING HASH (itemFk) - ) ENGINE = MEMORY; - - INSERT INTO tmp.item(itemFk, visible) - SELECT item_id itemFk, visible - FROM `cache`.visible - WHERE calc_id = v_calc_visible - AND visible; - - CALL `cache`.visible_refresh(v_calc_visible, TRUE, warehouseLanding); - - INSERT INTO tmp.item(itemFk, visibleLanding) - SELECT item_id, `visible` - FROM `cache`.`visible` v - WHERE v.calc_id = v_calc_visible - AND v.`visible` - ON DUPLICATE KEY UPDATE visibleLanding = v.`visible`; - - CALL availableTraslate(warehouseShipment, dateShipment, NULL); - - INSERT INTO tmp.item(itemFk, available) - SELECT a.item_id, a.available - FROM availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE available = a.available; - - CALL availableTraslate(warehouseLanding, dateLanding, warehouseShipment); - - INSERT INTO tmp.item(itemFk, availableLanding) - SELECT a.item_id, a.available - FROM availableTraslate a - WHERE a.available - ON DUPLICATE KEY UPDATE availableLanding = a.available; - ELSE - CALL vn.item_getStock(warehouseShipment, dateShipment, NULL); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item (UNIQUE INDEX i USING HASH (itemFk)) ENGINE = MEMORY - SELECT itemFk, `visible`, available , 0 visibleLanding, 0 availableLanding - FROM tmp.itemList; - - DROP TEMPORARY TABLE tmp.itemList; - END IF; - - CALL vn.buyUltimateFromInterval(warehouseLanding,vInventoryDate, dateLanding); - - DROP TEMPORARY TABLE IF EXISTS Traslados; - CREATE TEMPORARY TABLE Traslados ENGINE = MEMORY - SELECT tp.Id_Tipo AS Tipo, - tp.reino_id, - ar.tipo_id, - ar.Id_Article AS article_id, - ar.Article, - ar.Medida, - ar.Categoria, - ar.Color, - Origen.abreviatura as Origen, - CE.Cantidad, - ar.Tallos, - CAST(AIM.visible AS DECIMAL(10,0)) as vis1, - CAST(AIM.available AS DECIMAL(10,0)) as dis1, - CAST(AIM.visibleLanding AS DECIMAL(10,0)) as vis2, - CAST(AIM.availableLanding AS DECIMAL(10,0)) as dis2, - COALESCE(CE.`grouping`, C.`grouping`) as `grouping`, - COALESCE(CE.Packing, C.Packing) as Packing, - COALESCE(cl.caja, CE.caja, C.caja) as caja, - IFNULL(p.name, P2.Alias) AS Productor, - C.Id_Cubo, - 1 Tinta, - CE.Id_Compra, - CE.Etiquetas, - C.buy_edi_id, - tp.Id_Trabajador, - CB.Volumen, - IFNULL(CB.x,0) x, - IFNULL(CB.y,0) y, - IFNULL(CB.z,0) z, - IFNULL(C.Costefijo,0) Costefijo, - IFNULL(C.Comisionfija,0) Comisionfija, - IFNULL(C.Portefijo,0) Portefijo, - A.m3, - E.comision, - CB.Retornable, - IFNULL(CEB.Valor,CB.Valor) Valor, - r.rate3 t3, r.rate2 t2, tp.promo, - C.`grouping` groupingOrigin, - C.Packing PackingOrigin, - C.Id_Compra CompraOrigin, - CB.costeRetorno, - C.weight - FROM Articles ar - JOIN tmp.item AIM ON AIM.itemFk = ar.Id_Article - LEFT JOIN producer p ON p.producer_id = ar.producer_id - LEFT JOIN Tipos tp ON tp.tipo_id = ar.tipo_id - JOIN vn.itemCategory ic ON ic.id = tp.reino_id - LEFT JOIN Origen ON Origen.id = ar.id_origen - LEFT JOIN buy_edi_temp lb ON lb.Id_Article = ar.Id_Article - LEFT JOIN Compres C ON C.Id_Compra = lb.Id_Compra - LEFT JOIN Cubos CB ON CB.Id_Cubo = C.Id_Cubo - LEFT JOIN Entradas E2 ON E2.Id_Entrada = C.Id_Entrada - LEFT JOIN Proveedores P2 ON P2.Id_Proveedor = E2.Id_Proveedor - LEFT JOIN Entradas E ON E.Id_Entrada = i_entrada - LEFT JOIN travel TR ON TR.id = E.travel_id - LEFT JOIN Agencias A ON A.Id_Agencia = TR.agency_id - LEFT JOIN Compres CE ON CE.Id_Article = ar.Id_Article AND CE.Id_Entrada = i_entrada - LEFT JOIN Cubos CEB ON CEB.Id_Cubo = CE.Id_Cubo - LEFT JOIN tmp.rate r ON TRUE - LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = ar.Id_Article - LEFT JOIN Compres cl ON cl.Id_Compra = bufi.buyFk - WHERE ic.display - AND E.Redada = FALSE - AND (AIM.visible != 0 OR AIM.available != 0) - ORDER BY tipo_id, Article, article_id, Medida, Categoria, Origen; - - CREATE INDEX tindex USING HASH ON Traslados (article_id); - - SELECT t.*, - Cantidad - MOD(Cantidad , `grouping`) as Subcantidad, - MOD(Cantidad , `grouping`) as Soll, - ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) / Packing,0) as cm3, - Costefijo + Comisionfija + Portefijo AS Cost, - @porte := ROUND((IF(Volumen > 0,Volumen,x * y * IF(z = 0, Medida + 10, z))) * m3 / 1000000 / Packing ,3) AS Porte, - @comision := ROUND((Costefijo + Comisionfija + Portefijo) * comision / 100 ,3) AS Comision, - ROUND(@embalaje := (costeRetorno + IF(Retornable != 0, 0, Valor)) / packing ,3) AS Embalaje, - @coste := IFNULL((Costefijo + Comisionfija + Portefijo),0) + IFNULL(@embalaje,0) + IFNULL(@porte,0) + IFNULL(@comision,0) AS Coste, - @t3 := ROUND(@coste / ( (100 - t3 - t.promo)/100),2) AS Tarifa3, - ROUND(@t3 * (1 + ((t2 - t3)/100)),2) AS Tarifa2, - 0 selected - FROM Traslados t; - - DROP TEMPORARY TABLE Traslados; - DROP TEMPORARY TABLE tmp.item; - DROP TEMPORARY TABLE buy_edi_temp; - DROP TEMPORARY TABLE tmp.buyUltimateFromInterval; - DROP TEMPORARY TABLE tmp.rate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `travelDetail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travelDetail`() -BEGIN -/** - * Returns the details of the travels that have a departure warehouse in Ecuador or Colombia. - */ - DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL 12 WEEK; - SELECT IFNULL(CONCAT(" ",Entrada),travel) travelAndEntry, - travel, - Entrada, - IsTravel, - Agencia, - ref, - shipment, - OrigenCajas, - landing, - Destino, - Etiquetas, - Notas_Eva, - kg, - loadedKg, - volumeKg, - loadPriority, - invoiceAmount, - Carguera, - reference - FROM - (SELECT TRUE IsTravel, - tr.id travel, - NULL Entrada, - ag.Agencia, - tr.ref, - tr.shipment, - wo.name OrigenCajas, - tr.landing, - w.name Destino, - SUM(c.Etiquetas) Etiquetas, - NULL Notas_Eva, - tr.kg, - CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - c.Etiquetas * - IF(cb.Volumen, - cb.Volumen, - cb.X * cb.Y * cb.Z - ) / 1000000 - ) AS INT - ) volumeKg, - NULL loadPriority, - NULL invoiceAmount, - pc.Alias Carguera, - NULL reference - FROM travel tr - LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk - LEFT JOIN Entradas e ON e.travel_id = tr.id - LEFT JOIN Compres c ON c.Id_Entrada = e.Id_Entrada - LEFT JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo - LEFT JOIN Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN warehouse w ON w.id = tr.warehouse_id - JOIN warehouse wo ON wo.id = tr.warehouse_id_out - JOIN Agencias ag ON ag.Id_Agencia = tr.agency_id - JOIN vn.volumeConfig vc - WHERE tr.landing >= vDateFrom - AND (wo.name="Colombia" OR wo.name="Ecuador") - GROUP BY tr.id - UNION ALL - SELECT 0 IsTravel, - e.travel_id travel, - e.Id_Entrada, - p.Proveedor, - e.Referencia, - tr.shipment, - wo.name OrigenCajas, - tr.landing, - w.name Destino, - SUM(Etiquetas) Etiquetas, - e.Notas_Eva, - NULL kg, - CAST(SUM(c.weight * c.Etiquetas) AS INT) loadedkg, - CAST( - SUM(vc.aerealVolumetricDensity * - c.Etiquetas * - IF(cb.Volumen, - cb.Volumen, - cb.X * cb.Y * cb.Z - ) / 1000000 - ) AS INT - ) volumeKg, - loadPriority, - e.invoiceAmount, - pc.Alias carguera, - e.reference - FROM Entradas e - JOIN Compres c ON c.Id_Entrada = e.Id_Entrada - JOIN Cubos cb ON cb.Id_Cubo = c.Id_Cubo - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Tipos tp ON tp.tipo_id = a.tipo_id - JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor - JOIN travel tr ON tr.id = e.travel_id - LEFT JOIN Proveedores pc ON pc.Id_Proveedor = tr.cargoSupplierFk - JOIN warehouse w ON w.id = tr.warehouse_id - JOIN warehouse wo ON wo.id = tr.warehouse_id_out - JOIN vn.volumeConfig vc - WHERE tr.landing >= vDateFrom - AND (wo.name="Colombia" OR wo.name="Ecuador") - GROUP BY e.Id_Entrada - ) sub - ORDER BY landing ASC, - shipment ASC, - travel, - IsTravel DESC, - (loadPriority > 0) DESC, - loadPriority, - Agencia, - Notas_Eva; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `unary_leaves` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -87173,53 +86472,6 @@ BEGIN INNER JOIN `unary` u ON s.unary_id = u.id WHERE u.parent IS NULL; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `XDiario_Quadrator` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `XDiario_Quadrator`() -BEGIN - INSERT INTO vn.mail (receiver, subject, body) - SELECT 'cau@verdnatura.es', - 'asientos descuadrados', - group_concat(CONCAT(' Asiento: ', ASIEN, '- importe:', quadre) SEPARATOR ' \r\n ') - FROM ( - SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) quadre - FROM XDiario - WHERE enlazado = FALSE - GROUP BY ASIEN - HAVING ABS(SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0))) > 0.01 - ) t - HAVING count(*) > 0; - - UPDATE XDiario XD - INNER JOIN( - SELECT XD.id, SUBCTA, Quadre FROM XDiario XD - INNER JOIN ( - SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) as Quadre - FROM XDiario - WHERE enlazado = FALSE - GROUP BY ASIEN - HAVING Quadre != 0 - ) sub USING(ASIEN) - WHERE SUBCTA > '5999999999' - GROUP BY ASIEN - ) sub2 USING(id) - SET Eurohaber = IF(IFNULL(Eurohaber,0) = 0, Eurohaber, Eurohaber + Quadre), - Eurodebe = IF(IFNULL(Eurodebe,0) = 0, Eurodebe, Eurodebe - Quadre); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -87714,6 +86966,24 @@ USE `dipole`; USE `edi`; +-- +-- Final view structure for view `ektK2` +-- + +/*!50001 DROP VIEW IF EXISTS `ektK2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ektK2` AS select `eek`.`id` AS `id`,`eek`.`description` AS `description` from `ektK1` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `ektRecent` -- @@ -88614,24 +87884,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `agencyWarehouse` --- - -/*!50001 DROP VIEW IF EXISTS `agencyWarehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `agencyWarehouse` AS select `a`.`agency_id` AS `agencyFk`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`Vista` AS `agencyType` from `vn2008`.`agency_warehouse` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `annualAverageInvoiced` -- @@ -88686,24 +87938,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `bankPolicy` --- - -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bankPolicy` AS select `bp`.`poliza_id` AS `id`,`bp`.`referencia` AS `ref`,`bp`.`importe` AS `amount`,`bp`.`com_dispuesto` AS `balanceInterestDrawn`,`bp`.`com_no_dispuesto` AS `commissionAvailableBalances`,`bp`.`com_anual` AS `openingCommission`,`bp`.`apertura` AS `started`,`bp`.`cierre` AS `ended`,`bp`.`Id_Banco` AS `bankFk`,`bp`.`empresa_id` AS `companyFk`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn2008`.`Bancos_poliza` `bp` order by `bp`.`poliza_id` desc */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `businessCalendar` -- @@ -88758,24 +87992,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `clientDefaultCompany` --- - -/*!50001 DROP VIEW IF EXISTS `clientDefaultCompany`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientDefaultCompany` AS select `t`.`Id_Clientes_empresa` AS `id`,`t`.`Id_Cliente` AS `clientFk`,`t`.`empresa_id` AS `companyFk`,`t`.`fecha_ini` AS `started`,`t`.`fecha_fin` AS `finished` from `vn2008`.`Clientes_empresa` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `clientLost` -- @@ -88830,24 +88046,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `coolerPath` --- - -/*!50001 DROP VIEW IF EXISTS `coolerPath`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `coolerPath` AS select `c`.`cooler_path_id` AS `id`,`c`.`description` AS `description` from `vn2008`.`cooler_path` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `defaulter` -- @@ -88884,24 +88082,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `doc` --- - -/*!50001 DROP VIEW IF EXISTS `doc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `doc` AS select `g`.`id` AS `id`,`g`.`sref` AS `sref`,`g`.`brief` AS `brief`,`g`.`emp_id` AS `companyFk`,`g`.`orden` AS `order`,`g`.`file` AS `file`,`g`.`original` AS `original`,`g`.`trabajador_id` AS `workerFk`,`g`.`odbc_date` AS `created`,`g`.`warehouse_id` AS `warehouseFk` from `vn2008`.`gestdoc` `g` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `ediGenus` -- @@ -89334,24 +88514,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `grantGroup` --- - -/*!50001 DROP VIEW IF EXISTS `grantGroup`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `grantGroup` AS select `vn2008`.`Grupos`.`id` AS `id`,`vn2008`.`Grupos`.`Grupo` AS `description`,`vn2008`.`Grupos`.`observation_type_id` AS `observationTypeFk` from `vn2008`.`Grupos` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `inkL10n` -- @@ -89635,7 +88797,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`st`.`description` = 'previousPrepared' AS `isPreviousPrepared` from ((((`itemShelving` `ish` left join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) left join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `sectorType` `st` on(`st`.`id` = `s`.`typeFk`)) where `ish`.`visible` <> 0 and `p`.`sectorFk` <> 0 group by `ish`.`itemFk`,`p`.`sectorFk` */; +/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`st`.`code` = 'previousPrepared' AS `isPreviousPrepared` from ((((`itemShelving` `ish` left join `shelving` `sh` on(`sh`.`code` = `ish`.`shelvingFk`)) left join `parking` `p` on(`p`.`id` = `sh`.`parkingFk`)) left join `sector` `s` on(`s`.`id` = `p`.`sectorFk`)) left join `sectorType` `st` on(`st`.`id` = `s`.`typeFk`)) where `ish`.`visible` <> 0 and `p`.`sectorFk` <> 0 group by `ish`.`itemFk`,`p`.`sectorFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90072,24 +89234,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `promissoryNote` --- - -/*!50001 DROP VIEW IF EXISTS `promissoryNote`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `promissoryNote` AS select `p`.`Id_Pagare` AS `id`,`p`.`Concepto` AS `Concept`,`p`.`pago_id` AS `paymentFk` from `vn2008`.`Pagares` `p` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `role` -- @@ -90720,24 +89864,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `warehouseJoined` --- - -/*!50001 DROP VIEW IF EXISTS `warehouseJoined`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouseJoined` AS select `wj`.`warehouse_id` AS `warehouseFk`,`wj`.`warehouse_alias_id` AS `warehouseAliasFk` from `vn2008`.`warehouse_joined` `wj` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `workerBusinessDated` -- @@ -90931,7 +90057,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from ((((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) join `vn`.`warehouseAlias` `wa` on(`wa`.`id` = `w`.`aliasFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,`zc`.`hour` AS `zoneClosureHour`,`z`.`hour` AS `zoneHour`,`sv`.`volume` AS `volume`,`al`.`hasToRecalcPrice` AS `hasToRecalcPrice`,`lhp`.`m3` AS `m3`,`dl`.`minSpeed` AS `minSpeed` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on(`tst`.`ticketFk` = `t`.`id`)) join `vn`.`state` `s` on(`s`.`id` = `tst`.`state`)) join `vn`.`saleVolume` `sv` on(`sv`.`ticketFk` = `t`.`id`)) left join `vn`.`lastHourProduction` `lhp` on(`lhp`.`warehouseFk` = `t`.`warehouseFk`)) join `vn`.`warehouse` `w` on(`w`.`id` = `t`.`warehouseFk`)) straight_join `vn`.`zone` `z` on(`z`.`id` = `t`.`zoneFk`)) left join `vn`.`zoneClosure` `zc` on(`zc`.`zoneFk` = `t`.`zoneFk` and `zc`.`dated` = `util`.`VN_CURDATE`())) left join `cache`.`departure_limit` `dl` on(`dl`.`warehouse_id` = `t`.`warehouseFk` and `dl`.`fecha` = `util`.`VN_CURDATE`())) join `vn`.`alertLevel` `al` on(`al`.`id` = `s`.`alertLevel`)) where `w`.`hasProduction` <> 0 and cast(`t`.`shipped` as date) = `util`.`VN_CURDATE`() */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90978,24 +90104,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Articles_botanical` --- - -/*!50001 DROP VIEW IF EXISTS `Articles_botanical`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Articles_botanical` AS select `ab`.`itemFk` AS `Id_Article`,`ab`.`genusFk` AS `genus_id`,`ab`.`specieFk` AS `specie_id` from `vn`.`itemBotanical` `ab` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Bancos` -- @@ -91014,6 +90122,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Bancos_poliza` +-- + +/*!50001 DROP VIEW IF EXISTS `Bancos_poliza`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Bancos_poliza` AS select `bp`.`id` AS `poliza_id`,`bp`.`ref` AS `referencia`,`bp`.`amount` AS `importe`,`bp`.`committedFee` AS `com_dispuesto`,`bp`.`nonCommittedFee` AS `com_no_dispuesto`,`bp`.`annualFee` AS `com_anual`,`bp`.`started` AS `apertura`,`bp`.`ended` AS `cierre`,`bp`.`accountingFk` AS `Id_Banco`,`bp`.`companyFk` AS `empresa_id`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn`.`bankPolicy` `bp` order by `bp`.`id` desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Cajas` -- @@ -91195,10 +90321,10 @@ USE `vn2008`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `Equipos` +-- Final view structure for view `Entradas_orden` -- -/*!50001 DROP VIEW IF EXISTS `Equipos`*/; +/*!50001 DROP VIEW IF EXISTS `Entradas_orden`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -91207,79 +90333,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Equipos` AS select `h`.`code` AS `alias`,`h`.`description` AS `descripcion`,`h`.`workerFk` AS `trabajador_id`,`h`.`windowsSerial` AS `windowsSerial` from `vn`.`host` `h` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Facturas` --- - -/*!50001 DROP VIEW IF EXISTS `Facturas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Facturas` AS select `io`.`id` AS `factura_id`,`io`.`ref` AS `Id_Factura`,`io`.`serial` AS `Serie`,`io`.`issued` AS `Fecha`,`io`.`amount` AS `Importe`,`io`.`clientFk` AS `Id_Cliente`,`io`.`created` AS `odbc_date`,`io`.`companyFk` AS `empresa_id`,`io`.`dued` AS `Vencimiento`,`io`.`booked` AS `booked`,`io`.`bankFk` AS `Id_Banco`,`io`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`,`io`.`cplusTaxBreakFk` AS `cplusTaxBreakFk`,`io`.`cplusSubjectOpFk` AS `cplusSubjectOpFk`,`io`.`siiTrascendencyInvoiceOutFk` AS `siiTrascendencyInvoiceOutFk`,`io`.`hasPdf` AS `pdf` from `vn`.`invoiceOut` `io` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Gastos` --- - -/*!50001 DROP VIEW IF EXISTS `Gastos`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Gastos` AS select `e`.`id` AS `Id_Gasto`,`e`.`name` AS `Gasto`,`e`.`isWithheld` AS `isWithheld` from `vn`.`expense` `e` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Greuges` --- - -/*!50001 DROP VIEW IF EXISTS `Greuges`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Greuges` AS select `g`.`Id` AS `Id`,`g`.`clientFk` AS `Id_Cliente`,`g`.`description` AS `Comentario`,`g`.`amount` AS `Importe`,`g`.`shipped` AS `Fecha`,`g`.`created` AS `odbc_date`,`g`.`greugeTypeFk` AS `Greuges_type_id`,`g`.`ticketFk` AS `Id_Ticket` from `vn`.`greuge` `g` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `Greuges_type` --- - -/*!50001 DROP VIEW IF EXISTS `Greuges_type`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Greuges_type` AS select `gt`.`id` AS `Greuges_type_id`,`gt`.`name` AS `name` from `vn`.`greugeType` `gt` */; +/*!50001 VIEW `Entradas_orden` AS select `eo`.`entryFk` AS `Id_Entrada`,`eo`.`order` AS `orden` from `vn`.`entryOrder` `eo` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91302,24 +90356,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Intrastat` --- - -/*!50001 DROP VIEW IF EXISTS `Intrastat`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Intrastat` AS select `i`.`id` AS `Codintrastat`,`i`.`description` AS `Definicion`,`i`.`taxClassFk` AS `iva_group_id`,`i`.`taxCodeFk` AS `iva_codigo_id` from `vn`.`intrastat` `i` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Monedas` -- @@ -91428,6 +90464,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Pagares` +-- + +/*!50001 DROP VIEW IF EXISTS `Pagares`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Pagares` AS select `p`.`id` AS `Id_Pagare`,`p`.`issued` AS `Fechaemision`,`p`.`Concept` AS `Concepto`,`p`.`paymentFk` AS `pago_id` from `vn`.`promissoryNote` `p` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Paises` -- @@ -91464,24 +90518,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `Prioridades` --- - -/*!50001 DROP VIEW IF EXISTS `Prioridades`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Prioridades` AS select `qp`.`id` AS `Id_Prioridad`,`qp`.`priority` AS `Prioridad` from `vn`.`queuePriority` `qp` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `Proveedores` -- @@ -91500,6 +90536,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Proveedores_gestdoc` +-- + +/*!50001 DROP VIEW IF EXISTS `Proveedores_gestdoc`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Proveedores_gestdoc` AS select `sd`.`supplierFk` AS `Id_Proveedor`,`sd`.`dmsFk` AS `gestdoc_id` from `vn`.`supplierDms` `sd` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Recibos` -- @@ -91518,6 +90572,24 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Remesas` +-- + +/*!50001 DROP VIEW IF EXISTS `Remesas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Remesas` AS select `r`.`id` AS `Id_Remesa`,`r`.`dated` AS `Fecha Remesa`,`r`.`accountingFk` AS `Banco`,`r`.`companyFk` AS `empresa_id` from `vn`.`remittance` `r` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Rutas` -- @@ -91536,6 +90608,60 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `Saldos_Prevision` +-- + +/*!50001 DROP VIEW IF EXISTS `Saldos_Prevision`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Saldos_Prevision` AS select `fb`.`id` AS `Saldos_Prevision_id`,`fb`.`description` AS `Descripcion`,`fb`.`amount` AS `Importe`,`fb`.`dated` AS `Fecha`,`fb`.`accountingFk` AS `Id_Banco`,`fb`.`companyFk` AS `empresa_id` from `vn`.`forecastedBalance` `fb` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `Split_lines` +-- + +/*!50001 DROP VIEW IF EXISTS `Split_lines`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Split_lines` AS select `sl`.`id` AS `Id_Split_lines`,`sl`.`splitFk` AS `Id_Split`,`sl`.`itemFk` AS `Id_Article`,`sl`.`buyFk` AS `Id_Compra` from `vn`.`splitLine` `sl` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `Splits` +-- + +/*!50001 DROP VIEW IF EXISTS `Splits`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Splits` AS select `s`.`id` AS `Id_Split`,`s`.`ticketFk` AS `Id_Ticket`,`s`.`entryFk` AS `Id_Entrada`,`s`.`dated` AS `Fecha`,`s`.`note` AS `Notas` from `vn`.`split` `s` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `Tickets` -- @@ -91663,10 +90789,10 @@ USE `vn2008`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `Vehiculos` +-- Final view structure for view `Vehiculos_consumo` -- -/*!50001 DROP VIEW IF EXISTS `Vehiculos`*/; +/*!50001 DROP VIEW IF EXISTS `Vehiculos_consumo`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -91675,16 +90801,16 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Vehiculos` AS select `v`.`id` AS `Id_Vehiculo`,`v`.`numberPlate` AS `Matricula`,`v`.`tradeMark` AS `Marca`,`v`.`model` AS `Modelo`,`v`.`companyFk` AS `empresa_id`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`isActive` AS `active`,`v`.`deliveryPointFk` AS `deliveryPointFk` from `vn`.`vehicle` `v` */; +/*!50001 VIEW `Vehiculos_consumo` AS select `vc`.`id` AS `Vehiculos_consumo_id`,`vc`.`vehicleFk` AS `Id_Vehiculo`,`vc`.`dated` AS `fecha`,`vc`.`km` AS `km`,`vc`.`liters` AS `litros`,`vc`.`price` AS `precio`,`vc`.`adblue` AS `adblue`,`vc`.`tolls` AS `peajes`,`vc`.`discount` AS `descuento`,`vc`.`silla` AS `silla`,`vc`.`created` AS `odbc_date`,`vc`.`others` AS `otros`,`vc`.`fuelTypeFk` AS `fuelTypeFk`,`vc`.`supplierFk` AS `proveedoresFk`,`vc`.`liters100km` AS `liters100km`,`vc`.`gasoline` AS `gasoline` from `vn`.`vehicleConsumption` `vc` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `XDiario` +-- Final view structure for view `account_conciliacion` -- -/*!50001 DROP VIEW IF EXISTS `XDiario`*/; +/*!50001 DROP VIEW IF EXISTS `account_conciliacion`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -91693,7 +90819,43 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `XDiario` AS select `d`.`id` AS `id`,`d`.`ASIEN` AS `ASIEN`,`d`.`FECHA` AS `FECHA`,`d`.`SUBCTA` AS `SUBCTA`,`d`.`CONTRA` AS `CONTRA`,`d`.`CONCEPTO` AS `CONCEPTO`,`d`.`EURODEBE` AS `EURODEBE`,`d`.`EUROHABER` AS `EUROHABER`,`d`.`BASEEURO` AS `BASEEURO`,`d`.`SERIE` AS `SERIE`,`d`.`FACTURA` AS `FACTURA`,`d`.`IVA` AS `IVA`,`d`.`RECEQUIV` AS `RECEQUIV`,`d`.`CLAVE` AS `CLAVE`,`d`.`CAMBIO` AS `CAMBIO`,`d`.`DEBEME` AS `DEBEME`,`d`.`HABERME` AS `HABERME`,`d`.`AUXILIAR` AS `AUXILIAR`,`d`.`MONEDAUSO` AS `MONEDAUSO`,`d`.`TIPOOPE` AS `TIPOOPE`,`d`.`NFACTICK` AS `NFACTICK`,`d`.`TERIDNIF` AS `TERIDNIF`,`d`.`TERNIF` AS `TERNIF`,`d`.`TERNOM` AS `TERNOM`,`d`.`OPBIENES` AS `OPBIENES`,`d`.`L340` AS `L340`,`d`.`enlazado` AS `enlazado`,`d`.`FECHA_EX` AS `FECHA_EX`,`d`.`LRECT349` AS `LRECT349`,`d`.`empresa_id` AS `empresa_id`,`d`.`LDIFADUAN` AS `LDIFADUAN`,`d`.`METAL` AS `METAL`,`d`.`METALIMP` AS `METALIMP`,`d`.`CLIENTE` AS `CLIENTE`,`d`.`METALEJE` AS `METALEJE`,`d`.`FECHA_OP` AS `FECHA_OP`,`d`.`FACTURAEX` AS `FACTURAEX`,`d`.`TIPOCLAVE` AS `TIPOCLAVE`,`d`.`TIPOEXENCI` AS `TIPOEXENCI`,`d`.`TIPONOSUJE` AS `TIPONOSUJE`,`d`.`TIPOFACT` AS `TIPOFACT`,`d`.`TIPORECTIF` AS `TIPORECTIF`,`d`.`SERIE_RT` AS `SERIE_RT`,`d`.`FACTU_RT` AS `FACTU_RT`,`d`.`BASEIMP_RT` AS `BASEIMP_RT`,`d`.`BASEIMP_RF` AS `BASEIMP_RF`,`d`.`RECTIFICA` AS `RECTIFICA`,`d`.`FECHA_RT` AS `FECHA_RT`,`d`.`created` AS `created`,`d`.`updated` AS `updated`,`d`.`FECREGCON` AS `FECREGCON`,`d`.`enlazadoSage` AS `enlazadoSage` from `vn`.`XDiario` `d` */; +/*!50001 VIEW `account_conciliacion` AS select `ar`.`id` AS `idaccount_conciliacion`,`ar`.`supplierAccountFk` AS `Id_Proveedores_account`,`ar`.`operationDated` AS `Fechaoperacion`,`ar`.`valueDated` AS `FechaValor`,`ar`.`amount` AS `importe`,`ar`.`concept` AS `Concepto`,`ar`.`debitCredit` AS `DebeHaber`,`ar`.`calculatedCode` AS `id_calculated`,`ar`.`created` AS `odbc_date` from `vn`.`accountReconciliation` `ar` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `account_detail` +-- + +/*!50001 DROP VIEW IF EXISTS `account_detail`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `account_detail` AS select `ac`.`id` AS `account_detail_id`,`ac`.`value` AS `value`,`ac`.`accountDetailTypeFk` AS `account_detail_type_id`,`ac`.`supplierAccountFk` AS `Id_Proveedores_account` from `vn`.`accountDetail` `ac` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `account_detail_type` +-- + +/*!50001 DROP VIEW IF EXISTS `account_detail_type`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `account_detail_type` AS select `adt`.`id` AS `account_detail_type_id`,`adt`.`description` AS `description` from `vn`.`accountDetailType` `adt` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91711,7 +90873,97 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `agency` AS select `a`.`id` AS `agency_id`,`a`.`name` AS `name`,`a`.`warehouseFk` AS `warehouse_id`,`a`.`warehouseAliasFk` AS `warehouse_alias_id`,`a`.`isOwn` AS `propios`,`a`.`workCenterFk` AS `workCenterFk` from `vn`.`agency` `a` */; +/*!50001 VIEW `agency` AS select `a`.`id` AS `agency_id`,`a`.`name` AS `name`,`a`.`warehouseFk` AS `warehouse_id`,`a`.`isOwn` AS `propios`,`a`.`workCenterFk` AS `workCenterFk` from `vn`.`agency` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `airline` +-- + +/*!50001 DROP VIEW IF EXISTS `airline`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `airline` AS select `a`.`id` AS `airline_id`,`a`.`name` AS `name` from `vn`.`airline` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `airport` +-- + +/*!50001 DROP VIEW IF EXISTS `airport`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `airport` AS select `a`.`id` AS `airport_id`,`a`.`name` AS `name` from `vn`.`airport` `a` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `albaran` +-- + +/*!50001 DROP VIEW IF EXISTS `albaran`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `albaran` AS select `dn`.`id` AS `albaran_id`,`dn`.`ref` AS `ref`,`dn`.`note` AS `note`,`dn`.`shipped` AS `fecha`,`dn`.`landed` AS `fecha_entrega`,`dn`.`amount` AS `valor`,`dn`.`supplierFk` AS `Id_Proveedor`,`dn`.`companyFk` AS `empresa_id`,`dn`.`warehouseFk` AS `warehouse_id`,`dn`.`stateFk` AS `albaran_state_id`,`dn`.`workerFk` AS `Id_Trabajador`,`dn`.`supervisorFk` AS `Id_Responsable`,`dn`.`departmentFk` AS `department_id`,`dn`.`invoiceInFk` AS `recibida_id`,`dn`.`farmingFk` AS `farmingFk` from `vn`.`deliveryNote` `dn` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `albaran_gestdoc` +-- + +/*!50001 DROP VIEW IF EXISTS `albaran_gestdoc`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `albaran_gestdoc` AS select `dnd`.`dmsFk` AS `gestdoc_id`,`dnd`.`deliveryNoteFk` AS `albaran_id` from `vn`.`deliveryNoteDms` `dnd` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `albaran_state` +-- + +/*!50001 DROP VIEW IF EXISTS `albaran_state`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `albaran_state` AS select `dn`.`id` AS `albaran_state_id`,`dn`.`state` AS `state` from `vn`.`deliveryNoteState` `dn` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91734,6 +90986,150 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `awb_component` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_component`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_component` AS select `ac`.`id` AS `id`,`ac`.`awbFk` AS `awb_id`,`ac`.`supplierFk` AS `Id_Proveedor`,`ac`.`typeFk` AS `awb_component_type_id`,`ac`.`awbRoleFk` AS `awb_role_id`,`ac`.`awbUnitFk` AS `awb_unit_id`,`ac`.`value` AS `value`,`ac`.`currencyFk` AS `Id_Moneda`,`ac`.`invoiceInFk` AS `recibida_id` from `vn`.`awbComponent` `ac` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_component_template` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_component_template`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_component_template` AS select `act`.`id` AS `awb_component_template_id`,`act`.`freightFk` AS `carguera_id`,`act`.`airportIn` AS `airport_in`,`act`.`airportOut` AS `airport_out`,`act`.`airlineFk` AS `airline_id`,`act`.`typeFk` AS `awb_component_type_id`,`act`.`dated` AS `Fecha`,`act`.`awbRoleFk` AS `awb_role_id`,`act`.`awbUnit` AS `awb_unit_id`,`act`.`value` AS `value`,`act`.`maxValue` AS `max_value`,`act`.`minValue` AS `min_value`,`act`.`currencyFk` AS `Id_Moneda`,`act`.`days` AS `days` from `vn`.`awbComponentTemplate` `act` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_component_type` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_component_type`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_component_type` AS select `act`.`id` AS `awb_component_type_id`,`act`.`description` AS `description`,`act`.`hasStems` AS `hasStems` from `vn`.`awbComponentType` `act` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_gestdoc` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_gestdoc`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_gestdoc` AS select `ad`.`id` AS `awb_gestdoc_id`,`ad`.`awbFk` AS `awb_id`,`ad`.`dmsFk` AS `gestdoc_id` from `vn`.`awbDms` `ad` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_recibida` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_recibida`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_recibida` AS select `aii`.`awbFk` AS `awb_id`,`aii`.`invoiceInFk` AS `recibida_id`,`aii`.`sad` AS `dua` from `vn`.`awbInvoiceIn` `aii` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_role` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_role`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_role` AS select `ar`.`id` AS `awb_role_id`,`ar`.`name` AS `name` from `vn`.`awbRole` `ar` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `awb_unit` +-- + +/*!50001 DROP VIEW IF EXISTS `awb_unit`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb_unit` AS select `au`.`id` AS `awb_unit_id`,`au`.`operation` AS `operation` from `vn`.`awbUnit` `au` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `balance_nest_tree` +-- + +/*!50001 DROP VIEW IF EXISTS `balance_nest_tree`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `balance_nest_tree` AS select `bnt`.`lft` AS `lft`,`bnt`.`rgt` AS `rgt`,`bnt`.`name` AS `name`,`bnt`.`id` AS `id`,`bnt`.`expenseFk` AS `Id_Gasto`,`bnt`.`isSelected` AS `isSelected` from `vn`.`balanceNestTree` `bnt` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `barcodes` -- @@ -91752,42 +91148,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `bionic_updating_options` --- - -/*!50001 DROP VIEW IF EXISTS `bionic_updating_options`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bionic_updating_options` AS select `t`.`id` AS `buo_id`,`t`.`description` AS `description` from `vn`.`ticketUpdateAction` `t` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `businessReasonEnd` --- - -/*!50001 DROP VIEW IF EXISTS `businessReasonEnd`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `businessReasonEnd` AS select `b`.`id` AS `id`,`b`.`reason` AS `reason` from `vn`.`businessReasonEnd` `b` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `buySource` -- @@ -91824,6 +91184,60 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Final view structure for view `buy_edi_k012` +-- + +/*!50001 DROP VIEW IF EXISTS `buy_edi_k012`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy_edi_k012` AS select `eek`.`id` AS `buy_edi_k012_id`,`eek`.`description` AS `description` from `edi`.`ektK1` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `buy_edi_k03` +-- + +/*!50001 DROP VIEW IF EXISTS `buy_edi_k03`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy_edi_k03` AS select `eek`.`id` AS `buy_edi_k03_id`,`eek`.`description` AS `description` from `edi`.`ektK3` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `buy_edi_k04` +-- + +/*!50001 DROP VIEW IF EXISTS `buy_edi_k04`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buy_edi_k04` AS select `eek`.`id` AS `buy_edi_k04_id`,`eek`.`description` AS `description` from `edi`.`ektK4` `eek` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + -- -- Final view structure for view `cdr` -- @@ -91932,42 +91346,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `cl_dev` --- - -/*!50001 DROP VIEW IF EXISTS `cl_dev`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cl_dev` AS select `c`.`id` AS `id`,`c`.`description` AS `devolucion` from `vn`.`claimRedelivery` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `cl_est` --- - -/*!50001 DROP VIEW IF EXISTS `cl_est`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cl_est` AS select `c`.`id` AS `id`,`c`.`description` AS `estado`,`c`.`roleFk` AS `roleFk` from `vn`.`claimState` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `cl_main` -- @@ -92077,10 +91455,10 @@ USE `vn2008`; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `deliveryPoint` +-- Final view structure for view `credit` -- -/*!50001 DROP VIEW IF EXISTS `deliveryPoint`*/; +/*!50001 DROP VIEW IF EXISTS `credit`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -92089,16 +91467,16 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `deliveryPoint` AS select `dp`.`id` AS `id`,`dp`.`name` AS `name`,`dp`.`ubication` AS `ubication` from `vn`.`deliveryPoint` `dp` */; +/*!50001 VIEW `credit` AS select `c`.`id` AS `id`,`c`.`clientFk` AS `Id_Cliente`,`c`.`workerFk` AS `Id_Trabajador`,`c`.`amount` AS `amount`,`c`.`created` AS `odbc_date` from `vn`.`clientCredit` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; -- --- Final view structure for view `device_user` +-- Final view structure for view `definitivo` -- -/*!50001 DROP VIEW IF EXISTS `device_user`*/; +/*!50001 DROP VIEW IF EXISTS `definitivo`*/; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; @@ -92107,7 +91485,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `device_user` AS select `dpu`.`deviceProductionFk` AS `device_id`,`dpu`.`userFk` AS `user_id` from `vn`.`deviceProductionUser` `dpu` */; +/*!50001 VIEW `definitivo` AS select `d`.`id` AS `definitivo_id`,`d`.`companyFk` AS `empresa_id`,`d`.`started` AS `desde`,`d`.`ended` AS `hasta`,`d`.`created` AS `fecha` from `vn`.`dmsStorageBox` `d` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -92166,78 +91544,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `edi_feature` --- - -/*!50001 DROP VIEW IF EXISTS `edi_feature`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_feature` AS select `edi`.`feature`.`item_id` AS `item_id`,`edi`.`feature`.`feature_type_id` AS `feature_type_id`,`edi`.`feature`.`feature_value` AS `feature_value`,`edi`.`feature`.`entry_date` AS `entry_date`,`edi`.`feature`.`expiry_date` AS `expiry_date`,`edi`.`feature`.`change_date_time` AS `change_date_time` from `edi`.`feature` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_genus` --- - -/*!50001 DROP VIEW IF EXISTS `edi_genus`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_genus` AS select `edi`.`genus`.`genus_id` AS `genus_id`,`edi`.`genus`.`latin_genus_name` AS `latin_genus_name`,`edi`.`genus`.`entry_date` AS `entry_date`,`edi`.`genus`.`expiry_date` AS `expiry_date`,`edi`.`genus`.`change_date_time` AS `change_date_time` from `edi`.`genus` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_item_feature` --- - -/*!50001 DROP VIEW IF EXISTS `edi_item_feature`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_item_feature` AS select `edi`.`item_feature`.`item_id` AS `item_id`,`edi`.`item_feature`.`presentation_order` AS `presentation_order`,`edi`.`item_feature`.`feature` AS `feature`,`edi`.`item_feature`.`regulation_type` AS `regulation_type`,`edi`.`item_feature`.`entry_date` AS `entry_date`,`edi`.`item_feature`.`expiry_date` AS `expiry_date`,`edi`.`item_feature`.`change_date_time` AS `change_date_time` from `edi`.`item_feature` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_plant` --- - -/*!50001 DROP VIEW IF EXISTS `edi_plant`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_plant` AS select `edi`.`plant`.`plant_id` AS `plant_id`,`edi`.`plant`.`genus_id` AS `genus_id`,`edi`.`plant`.`specie_id` AS `specie_id`,`edi`.`plant`.`entry_date` AS `entry_date`,`edi`.`plant`.`expiry_date` AS `expiry_date`,`edi`.`plant`.`change_date_time` AS `change_date_time` from `edi`.`plant` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `edi_specie` -- @@ -92274,42 +91580,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `edi_type` --- - -/*!50001 DROP VIEW IF EXISTS `edi_type`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_type` AS select `edi`.`type`.`type_id` AS `type_id`,`edi`.`type`.`type_group_id` AS `type_group_id`,`edi`.`type`.`description` AS `description`,`edi`.`type`.`entry_date` AS `entry_date`,`edi`.`type`.`expiry_date` AS `expiry_date`,`edi`.`type`.`change_date_time` AS `change_date_time` from `edi`.`type` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `edi_value` --- - -/*!50001 DROP VIEW IF EXISTS `edi_value`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `edi_value` AS select `edi`.`value`.`type_id` AS `type_id`,`edi`.`value`.`type_value` AS `type_value`,`edi`.`value`.`type_description` AS `type_description`,`edi`.`value`.`entry_date` AS `entry_date`,`edi`.`value`.`expiry_date` AS `expiry_date`,`edi`.`value`.`change_date_time` AS `change_date_time` from `edi`.`value` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `empresa` -- @@ -92364,186 +91634,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `escritos` --- - -/*!50001 DROP VIEW IF EXISTS `escritos`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `escritos` AS select `s`.`id` AS `id`,`s`.`code` AS `abrev`,`s`.`description` AS `descripcion`,`s`.`isVisible` AS `visible`,`s`.`hasCompany` AS `hasCompany` from `vn`.`sample` `s` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditions` --- - -/*!50001 DROP VIEW IF EXISTS `expeditions`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditions` AS select `e`.`id` AS `expeditions_id`,`e`.`agencyModeFk` AS `agency_id`,`e`.`ticketFk` AS `ticket_id`,`e`.`freightItemFk` AS `EsBulto`,`e`.`created` AS `odbc_date`,`e`.`counter` AS `counter`,`e`.`workerFk` AS `workerFk`,`e`.`externalId` AS `externalId`,`p`.`itemFk` AS `Id_article` from (`vn`.`expedition` `e` left join `vn`.`packaging` `p` on(`p`.`id` = `e`.`packagingFk`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `gestdoc` --- - -/*!50001 DROP VIEW IF EXISTS `gestdoc`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `gestdoc` AS select `d`.`id` AS `id`,`d`.`dmsTypeFk` AS `gesttip_id`,`d`.`file` AS `file`,`d`.`contentType` AS `contentType`,`d`.`workerFk` AS `trabajador_id`,`d`.`warehouseFk` AS `warehouse_id`,`d`.`companyFk` AS `emp_id`,`d`.`hardCopyNumber` AS `orden`,`d`.`hasFile` AS `original`,`d`.`reference` AS `sref`,`d`.`description` AS `brief`,`d`.`created` AS `odbc_date` from `vn`.`dms` `d` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `gesttip` --- - -/*!50001 DROP VIEW IF EXISTS `gesttip`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `gesttip` AS select `g`.`id` AS `id`,`g`.`name` AS `tipo`,`g`.`readRoleFk` AS `readRoleFk`,`g`.`writeRoleFk` AS `writeRoleFk`,`g`.`code` AS `code` from `vn`.`dmsType` `g` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `intrastat_data` --- - -/*!50001 DROP VIEW IF EXISTS `intrastat_data`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `intrastat_data` AS select `ii`.`id` AS `id`,`ii`.`invoiceInFk` AS `recibida_id`,`ii`.`net` AS `neto`,`ii`.`intrastatFk` AS `intrastat_id`,`ii`.`amount` AS `importe`,`ii`.`stems` AS `unidades`,`ii`.`countryFk` AS `Paises_Id`,`ii`.`dated` AS `odbc_date`,`ii`.`statisticalValue` AS `valorestadistico` from `vn`.`invoiceInIntrastat` `ii` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `invoiceCorrection` --- - -/*!50001 DROP VIEW IF EXISTS `invoiceCorrection`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceCorrection` AS select `ic`.`correctingFk` AS `correctingFk`,`ic`.`correctedFk` AS `correctedFk`,`ic`.`cplusRectificationTypeFk` AS `cplusRectificationTypeFk`,`ic`.`siiTypeInvoiceOutFk` AS `siiTypeInvoiceOutFk`,`ic`.`invoiceCorrectionTypeFk` AS `invoiceCorrectionTypeFk` from `vn`.`invoiceCorrection` `ic` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemTag` --- - -/*!50001 DROP VIEW IF EXISTS `itemTag`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTag` AS select `i`.`id` AS `id`,`i`.`itemFk` AS `itemFk`,`i`.`tagFk` AS `tagFk`,`i`.`value` AS `value`,`i`.`priority` AS `priority` from `vn`.`itemTag` `i` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `item_entry_in` --- - -/*!50001 DROP VIEW IF EXISTS `item_entry_in`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_entry_in` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`warehouse_id_out` AS `warehouse_id_out`,`t`.`landing` AS `dat`,`m`.`Id_Article` AS `item_id`,`m`.`Cantidad` AS `amount`,`t`.`received` AS `received`,`e`.`Redada` AS `isVirtualStock`,`e`.`Id_Entrada` AS `entryFk` from ((`vn2008`.`Compres` `m` join `vn2008`.`Entradas` `e` on(`m`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `t` on(`e`.`travel_id` = `t`.`id`)) where `e`.`Inventario` = 0 and `m`.`Cantidad` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `item_entry_out` --- - -/*!50001 DROP VIEW IF EXISTS `item_entry_out`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_entry_out` AS select `t`.`warehouse_id_out` AS `warehouse_id`,`t`.`shipment` AS `dat`,`m`.`Id_Article` AS `item_id`,-`m`.`Cantidad` AS `amount`,`t`.`delivered` <> 0 or ifnull(`co`.`valor`,0) AS `delivered`,`e`.`Id_Entrada` AS `entryFk` from (((`vn2008`.`Compres` `m` join `vn2008`.`Entradas` `e` on(`m`.`Id_Entrada` = `e`.`Id_Entrada`)) join `vn2008`.`travel` `t` on(`e`.`travel_id` = `t`.`id`)) left join `vn2008`.`Compres_ok` `co` on(`co`.`Id_Compra` = `m`.`Id_Compra` and `co`.`Id_Accion` = 3 and `co`.`valor` <> 0)) where `e`.`Inventario` = 0 and `e`.`Redada` = 0 and `m`.`Cantidad` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `item_out` --- - -/*!50001 DROP VIEW IF EXISTS `item_out`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_out` AS select `t`.`warehouse_id` AS `warehouse_id`,`t`.`Fecha` AS `dat`,`m`.`Id_Article` AS `item_id`,-`m`.`Cantidad` AS `amount`,`m`.`OK` AS `ok`,`m`.`Reservado` AS `Reservado`,`t`.`Factura` AS `invoice`,`m`.`Id_Movimiento` AS `saleFk`,`m`.`Id_Ticket` AS `ticketFk` from (`vn2008`.`Movimientos` `m` join `vn2008`.`Tickets` `t` on(`m`.`Id_Ticket` = `t`.`Id_Ticket`)) where `m`.`Cantidad` <> 0 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `mail` -- @@ -92688,42 +91778,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `person_user` --- - -/*!50001 DROP VIEW IF EXISTS `person_user`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `person_user` AS select `u`.`id` AS `id`,`u`.`role` AS `mysql_user_id`,`u`.`name` AS `name`,`u`.`password` AS `password`,`u`.`active` AS `active`,`u`.`lastPassChange` AS `last_pass_change` from `account`.`user` `u` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `person_user_idtrabajador` --- - -/*!50001 DROP VIEW IF EXISTS `person_user_idtrabajador`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `person_user_idtrabajador` AS select `t`.`Id_Trabajador` AS `Id_Trabajador` from (`vn2008`.`person_user` `p` join `vn2008`.`Trabajadores` `t` on(`p`.`id` = `t`.`user_id`)) where `t`.`user_id` = `account`.`myUser_getId`() */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `plantpassport` -- @@ -92922,24 +91976,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `reference_min` --- - -/*!50001 DROP VIEW IF EXISTS `reference_min`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `reference_min` AS select `rc`.`dated` AS `date`,`rc`.`value` AS `rate`,`rc`.`currencyFk` AS `moneda_id` from `vn`.`referenceCurrent` `rc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `reference_rate` -- @@ -93187,7 +92223,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_compres` AS select `TP`.`Id_Tipo` AS `Familia`,`RN`.`id` AS `reino_id`,`C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Entrada` AS `Id_Entrada`,`C`.`Id_Article` AS `Id_Article`,`C`.`Cantidad` AS `Cantidad`,`C`.`Costefijo` AS `Costefijo`,`C`.`Portefijo` AS `Portefijo`,`C`.`Novincular` AS `Novincular`,`C`.`Etiquetas` AS `Etiquetas`,`C`.`Packing` AS `Packing`,`C`.`grouping` AS `grouping`,`C`.`Comisionfija` AS `Comisionfija`,`C`.`Embalajefijo` AS `Embalajefijo`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Tarifa1` AS `Tarifa1`,`C`.`Tarifa2` AS `Tarifa2`,`C`.`Tarifa3` AS `Tarifa3`,`C`.`PVP` AS `PVP`,`C`.`Vida` AS `Vida`,`C`.`Id_Trabajador` AS `Id_Trabajador`,`C`.`punteo` AS `punteo`,`C`.`odbc_date` AS `odbc_date`,`E`.`Inventario` AS `Inventario`,`E`.`Id_Proveedor` AS `Id_Proveedor`,`E`.`Fecha` AS `Fecha`,`E`.`Confirmada` AS `Confirmada`,`E`.`Redada` AS `Redada`,`E`.`empresa_id` AS `empresa_id`,`E`.`travel_id` AS `travel_id`,`E`.`Pedida` AS `Pedida`,`E`.`recibida_id` AS `recibida_id`,`TR`.`id` AS `id`,`TR`.`shipment` AS `shipment`,`TR`.`landing` AS `landing`,`TR`.`warehouse_id` AS `warehouse_id`,`TR`.`warehouse_id_out` AS `warehouse_id_out`,`TR`.`agency_id` AS `agency_id`,`TR`.`ref` AS `ref`,`TR`.`delivered` AS `delivered`,`TR`.`received` AS `received`,`A`.`Article` AS `Article`,`A`.`Medida` AS `Medida`,`A`.`Tallos` AS `Tallos`,`C`.`caja` AS `caja`,`A`.`Categoria` AS `Categoria`,`A`.`id_origen` AS `id_origen`,`TP`.`Id_Tipo` AS `Tipo`,`A`.`tipo_id` AS `tipo_id`,`A`.`Color` AS `Color`,`A`.`Min` AS `Min`,`C`.`Costefijo` + `C`.`Embalajefijo` + `C`.`Comisionfija` + `C`.`Portefijo` AS `Coste`,`W_OUT`.`fuente` AS `fuente`,if(`cb`.`Volumen` > 0,`cb`.`Volumen`,`cb`.`X` * `cb`.`Y` * if(`cb`.`Z` = 0,`A`.`Medida` + 10,`cb`.`Z`)) * `C`.`Etiquetas` AS `cm3`,`A`.`producer_id` AS `producer_id` from ((((((((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on(`C`.`Id_Entrada` = `E`.`Id_Entrada`)) join `vn2008`.`travel` `TR` on(`TR`.`id` = `E`.`travel_id`)) join `vn2008`.`warehouse` `W_IN` on(`W_IN`.`id` = `TR`.`warehouse_id`)) join `vn2008`.`warehouse` `W_OUT` on(`W_OUT`.`id` = `TR`.`warehouse_id_out`)) join `vn2008`.`Articles` `A` on(`C`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) join `vn2008`.`reinos` `RN` on(`RN`.`id` = `TP`.`reino_id`)) join `vn2008`.`Cubos` `cb` on(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)) where `W_IN`.`fuente` = 0 and `E`.`Inventario` = 0 and `E`.`Redada` = 0 */; +/*!50001 VIEW `v_compres` AS select `TP`.`Id_Tipo` AS `Familia`,`RN`.`id` AS `reino_id`,`C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Entrada` AS `Id_Entrada`,`C`.`Id_Article` AS `Id_Article`,`C`.`Cantidad` AS `Cantidad`,`C`.`Costefijo` AS `Costefijo`,`C`.`Portefijo` AS `Portefijo`,`C`.`Novincular` AS `Novincular`,`C`.`Etiquetas` AS `Etiquetas`,`C`.`Packing` AS `Packing`,`C`.`grouping` AS `grouping`,`C`.`Comisionfija` AS `Comisionfija`,`C`.`Embalajefijo` AS `Embalajefijo`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Tarifa1` AS `Tarifa1`,`C`.`Tarifa2` AS `Tarifa2`,`C`.`Tarifa3` AS `Tarifa3`,`C`.`PVP` AS `PVP`,`C`.`Vida` AS `Vida`,`C`.`Id_Trabajador` AS `Id_Trabajador`,`C`.`punteo` AS `punteo`,`C`.`odbc_date` AS `odbc_date`,`E`.`Inventario` AS `Inventario`,`E`.`Id_Proveedor` AS `Id_Proveedor`,`E`.`Fecha` AS `Fecha`,`E`.`Confirmada` AS `Confirmada`,`E`.`Redada` AS `Redada`,`E`.`empresa_id` AS `empresa_id`,`E`.`travel_id` AS `travel_id`,`E`.`Pedida` AS `Pedida`,`E`.`recibida_id` AS `recibida_id`,`TR`.`id` AS `id`,`TR`.`shipment` AS `shipment`,`TR`.`landing` AS `landing`,`TR`.`warehouse_id` AS `warehouse_id`,`TR`.`warehouse_id_out` AS `warehouse_id_out`,`TR`.`agency_id` AS `agency_id`,`TR`.`ref` AS `ref`,`TR`.`delivered` AS `delivered`,`TR`.`received` AS `received`,`A`.`Article` AS `Article`,`A`.`Medida` AS `Medida`,`A`.`Tallos` AS `Tallos`,`C`.`caja` AS `caja`,`A`.`Categoria` AS `Categoria`,`A`.`id_origen` AS `id_origen`,`TP`.`Id_Tipo` AS `Tipo`,`A`.`tipo_id` AS `tipo_id`,`A`.`Color` AS `Color`,`A`.`Min` AS `Min`,`C`.`Costefijo` + `C`.`Embalajefijo` + `C`.`Comisionfija` + `C`.`Portefijo` AS `Coste`,`W_OUT`.`isFeedStock` AS `fuente`,if(`cb`.`Volumen` > 0,`cb`.`Volumen`,`cb`.`X` * `cb`.`Y` * if(`cb`.`Z` = 0,`A`.`Medida` + 10,`cb`.`Z`)) * `C`.`Etiquetas` AS `cm3`,`A`.`producer_id` AS `producer_id` from ((((((((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on(`C`.`Id_Entrada` = `E`.`Id_Entrada`)) join `vn2008`.`travel` `TR` on(`TR`.`id` = `E`.`travel_id`)) join `vn`.`warehouse` `W_IN` on(`W_IN`.`id` = `TR`.`warehouse_id`)) join `vn`.`warehouse` `W_OUT` on(`W_OUT`.`id` = `TR`.`warehouse_id_out`)) join `vn2008`.`Articles` `A` on(`C`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) join `vn2008`.`reinos` `RN` on(`RN`.`id` = `TP`.`reino_id`)) join `vn2008`.`Cubos` `cb` on(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)) where `W_IN`.`isFeedStock` = 0 and `E`.`Inventario` = 0 and `E`.`Redada` = 0 */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -93228,42 +92264,6 @@ USE `vn2008`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `v_ventes` --- - -/*!50001 DROP VIEW IF EXISTS `v_ventes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ventes` AS select `Agencias`.`Agencia` AS `Agencia`,`A`.`Categoria` AS `Categoria`,`A`.`tipo_id` AS `tipo_id`,`A`.`Medida` AS `Medida`,`A`.`Article` AS `Article`,`A`.`Color` AS `Color`,`CS`.`Id_cliente` AS `Id_Cliente`,`TP`.`Id_Tipo` AS `Tipo`,`T`.`Factura` AS `Factura`,`T`.`warehouse_id` AS `warehouse_id`,`M`.`Id_Movimiento` AS `Id_Movimiento`,`M`.`Id_Article` AS `Id_Article`,`TP`.`Id_Tipo` AS `Familia`,`M`.`Id_Ticket` AS `Id_Ticket`,`M`.`Concepte` AS `Concepte`,`M`.`Cantidad` AS `Cantidad`,`M`.`quantity` AS `quantity`,`M`.`Preu` AS `Preu`,`M`.`Descuento` AS `Descuento`,if(`T`.`Fecha` >= '2015-10-01',`M`.`CostFixat`,`M`.`Preu` * (100 - `M`.`Descuento`) / 100) AS `CostFixat`,`M`.`Reservado` AS `Reservado`,`M`.`OK` AS `OK`,`M`.`PrecioFijado` AS `PrecioFijado`,`M`.`odbc_date` AS `odbc_date`,cast(`T`.`Fecha` as date) AS `Fecha`,`T`.`Fecha` AS `FechaCompleta`,`CS`.`consignatario` AS `Alias`,`T`.`Id_Consigna` AS `Id_Consigna`,`M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe`,`O`.`Origen` AS `Origen`,`TP`.`reino_id` AS `reino_id`,`C`.`invoice` AS `invoice`,`A`.`producer_id` AS `producer_id` from ((((((((`vn2008`.`Movimientos` `M` join `vn2008`.`Tickets` `T` on(`M`.`Id_Ticket` = `T`.`Id_Ticket`)) join `vn2008`.`Consignatarios` `CS` on(`CS`.`id_consigna` = `T`.`Id_Consigna`)) join `vn2008`.`Clientes` `C` on(`CS`.`Id_cliente` = `C`.`id_cliente`)) join `vn2008`.`Articles` `A` on(`M`.`Id_Article` = `A`.`Id_Article`)) join `vn2008`.`Origen` `O` on(`O`.`id` = `A`.`id_origen`)) join `vn2008`.`Tipos` `TP` on(`A`.`tipo_id` = `TP`.`tipo_id`)) join `vn2008`.`reinos` `r` on(`TP`.`reino_id` = `r`.`id`)) join `vn2008`.`Agencias` on(`Agencias`.`Id_Agencia` = `T`.`Id_Agencia`)) where `T`.`Fecha` >= '2013-01-01' and `C`.`real` > 0 and `r`.`id` <> 6 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `v_xsubcuentas` --- - -/*!50001 DROP VIEW IF EXISTS `v_xsubcuentas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_xsubcuentas` AS select `Clientes`.`Cuenta` AS `COD`,`Clientes`.`razonSocial` AS `TITULO`,concat(if(`p`.`CEE` = 1 and ascii(left(`Clientes`.`if`,1)) < 58,`p`.`Codigo`,''),`Clientes`.`if`) AS `NIF`,`Clientes`.`domicilio` AS `DOMICILIO`,`Clientes`.`poblacion` AS `POBLACION`,`province`.`name` AS `PROVINCIA`,`Clientes`.`codPostal` AS `CODPOSTAL`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`Clientes`.`e-mail`,1,coalesce(nullif(locate(',',`Clientes`.`e-mail`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0 or `p`.`CEE` = 1 and `Clientes`.`vies` = 0,1,if(`p`.`CEE` = 1 and `Clientes`.`vies` <> 0,2,4)) AS `IDNIF` from (((`vn2008`.`Clientes` join (select distinct `Facturas`.`Id_Cliente` AS `Id_Cliente`,`Facturas`.`empresa_id` AS `empresa_id` from `vn2008`.`Facturas` where `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + interval -2 month union select `Recibos`.`Id_Cliente` AS `Id_Cliente`,`Recibos`.`empresa_id` AS `empresa_id` from `vn2008`.`Recibos` where `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + interval -2 month) `sub` on(`Clientes`.`id_cliente` = `sub`.`Id_Cliente`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Clientes`.`Id_Pais`)) join `vn2008`.`province` on(`Clientes`.`province_id` = `province`.`province_id`)) group by `Clientes`.`id_cliente`,`sub`.`empresa_id` union all select `Proveedores`.`cuenta` AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,concat(if(`p`.`CEE` = 1 and ascii(left(`Proveedores`.`NIF`,1)) < 58,`p`.`Codigo`,''),`Proveedores`.`NIF`) AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where `Proveedores`.`oficial` <> 0 group by `sub`.`proveedor_id`,`sub`.`empresa_id` union all select `Gastos`.`Id_Gasto` collate utf8mb3_unicode_ci AS `Id_Gasto`,`Gastos`.`Gasto` collate utf8mb3_unicode_ci AS `Gasto`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Gastos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select `Bancos`.`Cuenta` AS `Cuenta`,`Bancos`.`Banco` AS `Banco`,NULL AS `NULL`,NULL AS `My_exp_NULL`,NULL AS `My_exp_1_NULL`,NULL AS `My_exp_2_NULL`,NULL AS `My_exp_3_NULL`,NULL AS `country_code`,`e`.`id` AS `id`,NULL AS `EMAIL`,1 AS `IDNIF` from (`vn2008`.`Bancos` join `vn2008`.`empresa` `e` on(`e`.`id` = 442)) union all select lpad(right(`Proveedores`.`cuenta`,5),10,'47510000') AS `Cuenta`,`Proveedores`.`Proveedor` AS `Proveedor`,`Proveedores`.`NIF` AS `NIF`,`Proveedores`.`Domicilio` AS `Domicilio`,`Proveedores`.`Localidad` AS `Localidad`,`prov`.`name` AS `Provincia`,`Proveedores`.`codpos` AS `CP`,`p`.`Codigo` AS `country_code`,`sub`.`empresa_id` AS `empresa_id`,substr(`c`.`email`,1,coalesce(nullif(locate(',',`c`.`email`),0),99) - 1) AS `EMAIL`,if(`p`.`CEE` = 0,1,if(`p`.`CEE` = 1,2,4)) AS `IDNIF` from ((((`vn2008`.`Proveedores` join (select `recibida`.`proveedor_id` AS `proveedor_id`,`recibida`.`empresa_id` AS `empresa_id` from `vn2008`.`recibida` where `recibida`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `recibida`.`proveedor_id`,`recibida`.`empresa_id` union all select `pago`.`id_proveedor` AS `id_proveedor`,`pago`.`empresa_id` AS `empresa_id` from `vn2008`.`pago` where `pago`.`fecha` > `util`.`VN_CURDATE`() + interval -3 month group by `pago`.`id_proveedor`,`pago`.`empresa_id`) `sub` on(`Proveedores`.`Id_Proveedor` = `sub`.`proveedor_id`)) left join `vn2008`.`Paises` `p` on(`p`.`Id` = `Proveedores`.`pais_id`)) left join `vn2008`.`province` `prov` on(`prov`.`province_id` = `Proveedores`.`province_id`)) left join `vn`.`supplierContact` `c` on(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`)) where (`Proveedores`.`cuenta` like '_____3____' or `Proveedores`.`cuenta` like '_____2____') and `Proveedores`.`oficial` = 1 group by `sub`.`proveedor_id`,`sub`.`empresa_id` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `versiones` -- @@ -93281,60 +92281,6 @@ USE `vn2008`; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `warehouse` --- - -/*!50001 DROP VIEW IF EXISTS `warehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `warehouse` AS select `w`.`id` AS `id`,`w`.`name` AS `name`,`w`.`isInventory` AS `inventario`,`w`.`isFeedStock` AS `fuente`,`w`.`isComparative` AS `is_comparative`,`w`.`hasComission` AS `comisionantes`,`w`.`hasAvailable` AS `reserve`,`w`.`isManaged` AS `isManaged`,`w`.`isForTicket` AS `tpv`,`w`.`hasStowaway` AS `hasStowaway`,`w`.`hasDms` AS `hasDms`,`w`.`addressName` AS `address_name`,`w`.`delay` AS `delay`,`w`.`countryFk` AS `Id_Paises`,`w`.`labelZone` AS `zone_label`,`w`.`valuatedInventory` AS `valuatedInventory`,`w`.`hasConfectionTeam` AS `hasConfectionTeam` from `vn`.`warehouse` `w` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerDocument` --- - -/*!50001 DROP VIEW IF EXISTS `workerDocument`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDocument` AS select `vn`.`workerDocument`.`id` AS `id`,`vn`.`workerDocument`.`worker` AS `worker`,`vn`.`workerDocument`.`document` AS `document`,`vn`.`workerDocument`.`isReadableByWorker` AS `isReadableByWorker` from `vn`.`workerDocument` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerTeam` --- - -/*!50001 DROP VIEW IF EXISTS `workerTeam`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeam` AS select `wt`.`team` AS `team`,`wt`.`id` AS `id`,`wt`.`workerFk` AS `user` from `vn`.`workerTeam` `wt` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -93345,4 +92291,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-15 10:21:18 +-- Dump completed on 2024-02-23 11:43:22 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index 2da83db43..9da5f32fc 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -1735,6 +1735,33 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`accountReconciliation_beforeInsert` + BEFORE INSERT ON `accountReconciliation` + FOR EACH ROW + + SET NEW.calculatedCode = REPLACE( + REPLACE( + REPLACE( + REPLACE( + CONCAT(NEW.supplierAccountFk,NEW.operationDated,NEW.amount,NEW.concept,NEW.debitCredit) + ,' ','') + ,":",'') + ,'-','') + ,'.','') */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`address_beforeInsert` BEFORE INSERT ON `address` FOR EACH ROW @@ -2002,6 +2029,33 @@ BEGIN SET NEW.year= year(util.VN_CURDATE()); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`awbInvoiceIn_afterDelete` + AFTER DELETE ON `awbInvoiceIn` + FOR EACH ROW +BEGIN + IF (NOT(SELECT COUNT(*) FROM invoiceInTax where invoiceInFk = OLD.invoiceInFk)) + AND + (NOT(SELECT COUNT(*) FROM invoiceInDueDay where invoiceInFk = OLD.invoiceInFk)) + AND + (NOT(SELECT isBooked FROM invoiceIn WHERE id = OLD.invoiceInFk) ) + THEN + DELETE FROM invoiceIn WHERE id = OLD.invoiceInFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -2389,8 +2443,8 @@ trig:BEGIN FROM genericAllocation ga JOIN entry e ON e.id = NEW.entryFk JOIN travel tr on tr.id = e.travelFk - WHERE ga.itemFk = vGenericFk - AND tr.landed BETWEEN ga.startDated AND ga.endDated; + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; IF vGenericInDate THEN SET NEW.itemOriginalFk = NEW.itemFk; SET NEW.itemFk = vGenericFk; @@ -2412,6 +2466,13 @@ trig:BEGIN IF NEW.quantity < 0 THEN SET NEW.isIgnored = TRUE; END IF; + + IF NOT (NEW.itemFk <=> OLD.itemFk) OR + NOT (OLD.entryFk <=> NEW.entryFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT NEW.id; + CALL buy_checkItem(); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4681,6 +4742,16 @@ BEGIN CALL travel_requestRecalc(OLD.travelFk); CALL travel_requestRecalc(NEW.travelFk); END IF; + + + IF NOT (NEW.travelFk <=> OLD.travelFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT b.id + FROM buy b + WHERE b.entryFk = NEW.id; + + CALL buy_checkItem(); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4800,33 +4871,33 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`expedition_beforeInsert` BEFORE INSERT ON `expedition` FOR EACH ROW BEGIN DECLARE intcounter INT; - DECLARE vShipFk INT; + DECLARE vShipFk INT; SET NEW.editorFk = account.myUser_getId(); IF NEW.freightItemFk IS NOT NULL THEN - UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk; + UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk; SELECT IFNULL(MAX(counter),0) +1 INTO intcounter - FROM expedition e + FROM expedition e INNER JOIN ticket t1 ON e.ticketFk = t1.id - LEFT JOIN ticketState ts ON ts.ticketFk = t1.id + LEFT JOIN ticketState ts ON ts.ticketFk = t1.id INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) - AND t1.warehouseFk = t2.warehouseFk + AND t1.warehouseFk = t2.warehouseFk WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk - AND t1.agencyModeFk = t2.agencyModeFk; + AND t1.agencyModeFk = t2.agencyModeFk; SET NEW.`counter` = intcounter; END IF; @@ -9807,15 +9878,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); -/* - IF ((NOT NEW.shipped <=> OLD.shipped ) - OR (NOT NEW.landed <=> OLD.landed ) - OR (NOT NEW.warehouseInFk <=> OLD.warehouseInFk ) - OR (NOT NEW.warehouseOutFk <=> OLD.warehouseOutFk )) - AND (OLD.totalEntries AND OLD.landed < CURDATE()) THEN - CALL util.throw("Cannot past travels with entries"); - END IF; -*/ + IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); @@ -9854,6 +9917,19 @@ BEGIN SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; + + IF NOT (NEW.agencyModeFk <=> OLD.agencyModeFk) THEN + IF (SELECT hasWeightVolumetric FROM agencyMode WHERE id = NEW.agencyModeFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT b.id + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + WHERE e.travelFk = NEW.id; + + CALL buy_checkItem(); + END IF; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10019,30 +10095,6 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterUpdate` - AFTER UPDATE ON `warehouse` - FOR EACH ROW -BEGIN - IF NEW.isFeedStock IS TRUE AND OLD.isFeedStock IS FALSE THEN - INSERT IGNORE INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT IGNORE INTO warehouseJoined(warehouseFk, warehouseAliasFk) - VALUES(NEW.id,LAST_INSERT_ID()); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`worker_beforeInsert` BEFORE INSERT ON `worker` FOR EACH ROW @@ -10713,146 +10765,6 @@ USE `vn2008`; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`Conteo_afterInsert` - AFTER INSERT ON `Conteo` - FOR EACH ROW -BEGIN - DECLARE intTravel INTEGER; - SELECT t.id INTO intTravel FROM Compres c JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE landing = util.VN_CURDATE() AND c.Id_Article = NEW.Id_Article AND warehouse_id = NEW.warehouse_id AND received <> TRUE LIMIT 1; - IF (intTravel) then - UPDATE travel SET received = TRUE WHERE id = intTravel; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`account_conciliacion_beforeInsert` - BEFORE INSERT ON `account_conciliacion` - FOR EACH ROW -set new.id_calculated = replace( - replace( - replace( - replace( - concat(new.Id_Proveedores_account,new.Fechaoperacion,new.importe,new.Concepto,new.DebeHaber) - ,' ','') - ,":",'') - ,'-','') - ,'.','') */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_beforeInsert` - BEFORE INSERT ON `agency_hour` - FOR EACH ROW -BEGIN - DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; - IF NEW.week_day IS NULL AND NEW.province_id IS NULL AND NEW.subtract_day = 0 AND NEW.max_hour = 0 THEN - CALL util.throw ('FILL_MORE_FIELDS'); - END IF; - - SELECT COUNT(*) INTO vAlreadyExists - FROM vn2008.agency_hour - WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id - AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour - AND NEW.agency_id <=> agency_id; - - IF vAlreadyExists > 1 THEN - CALL util.throw('ALREADY_EXISTS'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`agency_hour_afterUpdate` - AFTER UPDATE ON `agency_hour` - FOR EACH ROW -BEGIN -DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; - - SELECT COUNT(*) INTO vAlreadyExists - FROM vn2008.agency_hour - WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id - AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour - AND NEW.agency_id <=> agency_id; - - IF vAlreadyExists > 1 THEN - CALL util.throw('ALREADY_EXISTS'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`awb_recibida_afterDelete` - AFTER DELETE ON `awb_recibida` - FOR EACH ROW -IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0 - AND - (SELECT COUNT(*) FROM recibida_vencimiento where recibida_id = OLD.recibida_id) = 0 - AND - (SELECT contabilizada FROM recibida WHERE id = OLD.recibida_id) = 0 -THEN - DELETE FROM recibida WHERE id = OLD.recibida_id; -END IF */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn2008`.`movement_label_afterUpdate` AFTER UPDATE ON `movement_label` FOR EACH ROW @@ -10870,4 +10782,4 @@ DELIMITER ; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-02-15 10:21:45 +-- Dump completed on 2024-02-23 11:43:46 From 9f8e44856245e3208a847174a06c05eda46097aa Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 26 Feb 2024 07:22:51 +0100 Subject: [PATCH 175/250] refs #5509 fix(EntryDms): some issues --- modules/entry/back/methods/entry-dms/removeFile.js | 4 ++-- modules/entry/back/methods/entry-dms/uploadFile.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/entry/back/methods/entry-dms/removeFile.js b/modules/entry/back/methods/entry-dms/removeFile.js index 677e627a6..89a87755c 100644 --- a/modules/entry/back/methods/entry-dms/removeFile.js +++ b/modules/entry/back/methods/entry-dms/removeFile.js @@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('removeFile', { - description: 'Removes a claim document', + description: 'Removes a entry document', accessType: 'WRITE', accepts: { arg: 'id', @@ -36,7 +36,7 @@ module.exports = Self => { const targetEntryDms = await Self.findById(id, null, myOptions); const targetDms = await Self.app.models.Dms.removeFile(ctx, targetEntryDms.dmsFk, myOptions); - if (!targetDms || ! targetEntryDms) + if (!targetDms) throw new UserError('Try again'); const entryDmsDestroyed = await targetEntryDms.destroy(myOptions); diff --git a/modules/entry/back/methods/entry-dms/uploadFile.js b/modules/entry/back/methods/entry-dms/uploadFile.js index fe0cfab5f..54b56fed4 100644 --- a/modules/entry/back/methods/entry-dms/uploadFile.js +++ b/modules/entry/back/methods/entry-dms/uploadFile.js @@ -6,7 +6,7 @@ module.exports = Self => { accepts: [{ arg: 'id', type: 'number', - description: 'The claim id', + description: 'The entry id', http: {source: 'path'} }, { From 910cc41beb65b17bb96839e7a016698c892548bd Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 26 Feb 2024 09:35:06 +0100 Subject: [PATCH 176/250] fix: refs #6513 trigger & alter table --- .../vn/triggers/supplierDms_beforeInsert.sql | 4 ++-- .../vn/triggers/supplierDms_beforeUpdate.sql | 4 ++-- .../00-createSupplierDms.sql | 22 ++++++------------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/db/routines/vn/triggers/supplierDms_beforeInsert.sql b/db/routines/vn/triggers/supplierDms_beforeInsert.sql index adef31c2b..130428d1e 100644 --- a/db/routines/vn/triggers/supplierDms_beforeInsert.sql +++ b/db/routines/vn/triggers/supplierDms_beforeInsert.sql @@ -1,6 +1,6 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=root@localhost TRIGGER vn.supplierDms_beforeInsert - BEFORE INSERT ON supplierDms +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert` + BEFORE INSERT ON `supplierDms` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); diff --git a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql index 228c5e5ea..54dcef049 100644 --- a/db/routines/vn/triggers/supplierDms_beforeUpdate.sql +++ b/db/routines/vn/triggers/supplierDms_beforeUpdate.sql @@ -1,6 +1,6 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=root@localhost TRIGGER vn.supplierDms_beforeUpdate - BEFORE UPDATE ON supplierDms +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate` + BEFORE UPDATE ON `supplierDms` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql index 23c45cc7b..fbdc7ed58 100644 --- a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -1,17 +1,9 @@ -CREATE TABLE IF NOT EXISTS vn.supplierDms( - id int(11) NOT NULL AUTO_INCREMENT, - supplierFk int(11) NOT NULL, - dmsFk int(11) NOT NULL, - editorFk int(10) unsigned DEFAULT NULL, - PRIMARY KEY (id), - CONSTRAINT supplierDms_fk_editor FOREIGN KEY (editorFk) REFERENCES account.user(id), - CONSTRAINT dmsFk FOREIGN KEY (dmsFk) REFERENCES dms(id) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT supplierFk FOREIGN KEY (supplierFk) REFERENCES supplier(id) ON UPDATE CASCADE -); +ALTER TABLE `vn`.`supplierDms` + MODIFY COLUMN supplierFk int(10) unsigned NOT NULL, + ADD editorFk INT UNSIGNED NULL, + ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id), + ADD CONSTRAINT dms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE; ALTER TABLE `supplierLog` - MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier'; - -ALTER TABLE `vn`.`supplierDms` - ADD IF NOT EXISTS editorFk INT UNSIGNED NULL, - ADD CONSTRAINT supplierDms_fk_editor FOREIGN KEY IF NOT EXISTS (editorFk) REFERENCES account.`user`(id); \ No newline at end of file + MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier'; \ No newline at end of file From 89a9cc26d30910a2da832ad15fa685e5db99945f Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 09:50:03 +0100 Subject: [PATCH 177/250] fix: ticket #158883 --- db/routines/vn/procedures/clean.sql | 3 ++- db/routines/vn2008/procedures/clean.sql | 5 ----- db/versions/10909-crimsonLaurel/00-firstScript.sql | 5 +++++ 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 db/versions/10909-crimsonLaurel/00-firstScript.sql diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 7b561cfe0..1b3c8b3a2 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -37,7 +37,8 @@ BEGIN DELETE FROM saleTracking WHERE created < vOneYearAgo; DELETE FROM ticketTracking WHERE created < v18Month; DELETE tobs FROM ticketObservation tobs - JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE()); + JOIN ticket t ON tobs.ticketFk = t.id + WHERE t.shipped < v5Years; DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; DELETE FROM sharingCart where ended < vDateShort; DELETE FROM sharingClient where ended < vDateShort; diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index 0ff185c46..631cec7b8 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -25,11 +25,6 @@ proc: BEGIN DELETE FROM Movimientos_mark WHERE odbc_date < vDate; DELETE FROM Splits WHERE Fecha < vDate18; - DELETE tobs - FROM ticket_observation tobs - JOIN Tickets t ON tobs.Id_Ticket = t.Id_Ticket - WHERE t.Fecha < vDate; - DELETE tobs FROM movement_label tobs JOIN Movimientos m ON tobs.Id_Movimiento = m.Id_Movimiento diff --git a/db/versions/10909-crimsonLaurel/00-firstScript.sql b/db/versions/10909-crimsonLaurel/00-firstScript.sql new file mode 100644 index 000000000..58e679dff --- /dev/null +++ b/db/versions/10909-crimsonLaurel/00-firstScript.sql @@ -0,0 +1,5 @@ +DELETE FROM vn.entryObservation + WHERE observationTypeFk IS NULL; + +ALTER TABLE vn.entryObservation + MODIFY COLUMN observationTypeFk tinyint(3) unsigned NOT NULL; From a19ce04a408e0ca8bc0029b66917529b78d921e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 12:18:02 +0100 Subject: [PATCH 178/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/travel_beforeUpdate.sql | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index dbac6459b..db835be85 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -3,12 +3,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate` BEFORE UPDATE ON `travel` FOR EACH ROW BEGIN - DECLARE vHasAnyInvoiceBooked BOOL; SET NEW.editorFk = account.myUser_getId(); - IF NOT (NEW.landed <=> OLD.landed) - OR NOT (NEW.shipped <=> OLD.shipped) THEN + IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); END IF; @@ -19,18 +17,5 @@ BEGIN IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END IF; - - IF NOT (NEW.awbFk <=> OLD.awbFk) THEN - SELECT COUNT(*) INTO vHasAnyInvoiceBooked - FROM travel t - JOIN entry e ON e.travelFk = t.id - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE t.id = NEW.id - AND ii.isBooked; - - IF vHasAnyInvoiceBooked THEN - CALL util.throw('The travel has entries with booked invoices'); - END IF; - END IF; END$$ DELIMITER ; From bfd86c8972638928368f3d1e712ab93bf6a12761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 12:18:57 +0100 Subject: [PATCH 179/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/travel_beforeUpdate.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index db835be85..30e0445a5 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -3,10 +3,10 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate` BEFORE UPDATE ON `travel` FOR EACH ROW BEGIN - SET NEW.editorFk = account.myUser_getId(); - IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN + IF NOT (NEW.landed <=> OLD.landed) + OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); END IF; From 413f7eb8c8f2c6a6f960b37a05c889ccaaaab287 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 12:45:38 +0100 Subject: [PATCH 180/250] fix: refs #6184 saveSign --- modules/route/back/methods/route/cmrEmail.js | 25 ++-- modules/ticket/back/methods/ticket/saveCmr.js | 19 ++- .../ticket/back/methods/ticket/saveSign.js | 129 +++++++++--------- 3 files changed, 86 insertions(+), 87 deletions(-) diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index 11c4d3dc8..d05d72100 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -48,23 +48,18 @@ module.exports = Self => { if (!recipient) throw new UserError('There is no assigned email for this client'); - const dms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: [{ - relation: 'dms', - fields: ['id'], - scope: { - relation: 'dmsType', - scope: { - where: {code: 'cmr'} - } - } - }] - }, myOptions); + const dms = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + JOIN dmsType dt ON dt.id = d.dmsTypeFk + WHERE td.ticketFk = ? + AND dt.code = 'cmr' + `, [ticketId]); - if (!dms) throw new UserError('Cmr file does not exist'); + if (!dms.lenght) throw new UserError('Cmr file does not exist'); - const response = await models.Dms.downloadFile(ctx, dms.id); + const response = await models.Dms.downloadFile(ctx, dms[0].id); const email = new Email('cmr', { ticketId, diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 17760bacc..691af796c 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -42,18 +42,15 @@ module.exports = Self => { const ticket = await models.Ticket.findById(ticketId, myOptions); if (ticket.cmrFk) { - const hasDmsCmr = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: { - relation: 'dms', - fields: ['dmsFk'], - scope: { - where: {dmsTypeFk: dmsTypeCmr.id} - } - } - }, myOptions); + const hasDmsCmr = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + WHERE td.ticketFk = ? + AND d.dmsTypeFk = ? + `, [ticketId, dmsTypeCmr.id]); - if (hasDmsCmr?.dms()) + if (hasDmsCmr.length) throw new UserError('This ticket already has a cmr saved'); ctx.args.id = ticket.cmrFk; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index fd40c1c22..14968c203 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -33,8 +33,8 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; - let dms; - let gestDocCreated = false; + let ticket; + let externalTickets = []; if (typeof options == 'object') Object.assign(myOptions, options); @@ -44,6 +44,11 @@ module.exports = Self => { myOptions.transaction = tx; } + const dmsTypeTicket = await models.DmsType.findOne({ + where: {code: 'ticket'}, + fields: ['id'] + }); + async function setLocation(ticketId) { await models.Delivery.create({ ticketFk: ticketId, @@ -53,102 +58,104 @@ module.exports = Self => { }, myOptions); } - async function gestDocExists(ticketId) { + async function hasSignDms(ticketId) { const ticketDms = await models.TicketDms.findOne({ where: {ticketFk: ticketId}, - fields: ['dmsFk'] - }, myOptions); - - if (!ticketDms) return false; - - const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions); - if (ticket.isSigned == true) - return true; - else - await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions); - - return false; + include: [ + { + relation: 'dms', + fields: ['id'], + scope: { + where: {dmsTypeFk: dmsTypeTicket.id} + } + } + ] + }); + if (ticketDms?.dms()?.id) return true; } - async function createGestDoc(id) { - const ticket = await models.Ticket.findById(id, - { - include: [ - { - relation: 'warehouse', - scope: { - fields: ['id'] - } - }, { - relation: 'client', - scope: { - fields: ['name'] - } - }, { - relation: 'route', - scope: { - fields: ['id'] - } - } - ] - }, myOptions); - const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); + async function createGestDoc() { const ctxUploadFile = Object.assign({}, ctx); - if (ticket.route() === null) - throw new UserError('Ticket without route'); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk, - dmsTypeId: dmsType.id, - reference: '', + dmsTypeId: dmsTypeTicket.id, + reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, - hasFile: false + hasFile: true }; - dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - gestDocCreated = true; + const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); } try { for (const ticketId of tickets) { - const ticketState = await models.TicketState.findOne( - {where: {ticketFk: ticketId}, - fields: ['alertLevel'] - }, myOptions); + ticket = await models.Ticket.findById(ticketId, { + include: [{ + relation: 'address', + scope: { + include: { + relation: 'province', + scope: { + include: { + relation: 'country', + scope: { + fields: ['code'] + } + } + } + } + } + }, { + relation: 'route', + scope: { + fields: ['id'] + } + }] + }); - const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'}, + const ticketState = await models.TicketState.findOne({ + where: {ticketFk: ticketId}, + fields: ['alertLevel'] + }); + + const packedAlertLevel = await models.AlertLevel.findOne({ + where: {code: 'PACKED'}, fields: ['id'] - }, myOptions); + }); if (!ticketState) throw new UserError('Ticket does not exist'); + if (!ticket.route()) + throw new UserError('Ticket without route'); if (ticketState.alertLevel < packedAlertLevel.id) throw new UserError('This ticket cannot be signed because it has not been boxed'); - if (await gestDocExists(ticketId)) + if (await ticket.isSigned) throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); - if (!gestDocCreated) await createGestDoc(ticketId); - await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); - const ticket = await models.Ticket.findById(ticketId, null, myOptions); + if (!await hasSignDms(ticketId)) await createGestDoc(ticketId); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ - where: { - code: 'DELIVERED' - } - }, myOptions); + where: {code: 'DELIVERED'} + }); await models.Ticket.state(ctx, { ticketFk: ticketId, stateFk: deliveryState.id }, myOptions); - } + if (ticket?.address()?.province()?.country()?.code != 'ES' && ticket.cmrFk) { + await models.Ticket.saveCmr(ctx, [ticketId], myOptions); + externalTickets.push(ticketId); + } + } if (tx) await tx.commit(); - return; } catch (e) { if (tx) await tx.rollback(); throw e; } + await models.Route.cmrEmail(ctx, externalTickets); }; }; From a359ace1b8550b4213a5c620a4cc94329c45a26a Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 12:57:49 +0100 Subject: [PATCH 181/250] fix: refs #6184 saveSign --- .../ticket/back/methods/ticket/saveSign.js | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 14968c203..7eb4b4144 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -59,19 +59,15 @@ module.exports = Self => { } async function hasSignDms(ticketId) { - const ticketDms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: [ - { - relation: 'dms', - fields: ['id'], - scope: { - where: {dmsTypeFk: dmsTypeTicket.id} - } - } - ] - }); - if (ticketDms?.dms()?.id) return true; + const hasTicketDms = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + WHERE td.ticketFk = ? + AND d.dmsTypeFk = ? + `, [ticketId, dmsTypeTicket.id]); + + if (hasTicketDms.length) return true; } async function createGestDoc() { From 817f685621acc760ca74a2df04ef3be46bba0cab Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 13:00:35 +0100 Subject: [PATCH 182/250] fix: refs #6184 saveSign --- modules/ticket/back/methods/ticket/saveSign.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 7eb4b4144..58599716a 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -65,7 +65,7 @@ module.exports = Self => { JOIN dms d ON d.id = td.dmsFk WHERE td.ticketFk = ? AND d.dmsTypeFk = ? - `, [ticketId, dmsTypeTicket.id]); + `, [ticketId, dmsTypeTicket.id], myOptions); if (hasTicketDms.length) return true; } @@ -108,17 +108,17 @@ module.exports = Self => { fields: ['id'] } }] - }); + }, myOptions); const ticketState = await models.TicketState.findOne({ where: {ticketFk: ticketId}, fields: ['alertLevel'] - }); + }, myOptions); const packedAlertLevel = await models.AlertLevel.findOne({ where: {code: 'PACKED'}, fields: ['id'] - }); + }, myOptions); if (!ticketState) throw new UserError('Ticket does not exist'); @@ -135,7 +135,7 @@ module.exports = Self => { const deliveryState = await models.State.findOne({ where: {code: 'DELIVERED'} - }); + }, myOptions); await models.Ticket.state(ctx, { ticketFk: ticketId, From c1c64d0f89dcbc51e34c2b86318da14ddbdea875 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 13:39:57 +0100 Subject: [PATCH 183/250] fix: refs #6184 saveSign --- modules/ticket/back/methods/ticket/saveSign.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 58599716a..ea9f715a9 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -34,6 +34,8 @@ module.exports = Self => { const myOptions = {userId: ctx.req.accessToken.userId}; let tx; let ticket; + let dms; + let isSignUploaded; let externalTickets = []; if (typeof options == 'object') @@ -80,8 +82,8 @@ module.exports = Self => { description: `Firma del cliente - Ruta ${ticket.route().id}`, hasFile: true }; - const dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); + dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + isSignUploaded = true; } try { @@ -130,7 +132,9 @@ module.exports = Self => { throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); - if (!await hasSignDms(ticketId)) await createGestDoc(ticketId); + if (!await hasSignDms(ticketId) && !isSignUploaded) + await createGestDoc(ticketId); + await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ From 27beefe1efc0fd9cce17823cc99cf8d8829336d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 13:43:32 +0100 Subject: [PATCH 184/250] =?UTF-8?q?feat:Agrupar=20DUA=20en=20funci=C3=B3n?= =?UTF-8?q?=20del=20transitario=20y=20pa=C3=ADs=20#6937?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/versions/10911-wheatGerbera/00-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/10911-wheatGerbera/00-firstScript.sql diff --git a/db/versions/10911-wheatGerbera/00-firstScript.sql b/db/versions/10911-wheatGerbera/00-firstScript.sql new file mode 100644 index 000000000..371c2c358 --- /dev/null +++ b/db/versions/10911-wheatGerbera/00-firstScript.sql @@ -0,0 +1 @@ +-- Place your SQL code here From a4419a2542bb69e89e840d4412d2ebc2a8fd7322 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 13:57:07 +0100 Subject: [PATCH 185/250] fix: refs #6184 saveSign --- modules/route/back/methods/route/cmrEmail.js | 2 +- modules/ticket/back/methods/ticket/saveSign.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index d05d72100..0c4cc5061 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -57,7 +57,7 @@ module.exports = Self => { AND dt.code = 'cmr' `, [ticketId]); - if (!dms.lenght) throw new UserError('Cmr file does not exist'); + if (!dms.length) throw new UserError('Cmr file does not exist'); const response = await models.Dms.downloadFile(ctx, dms[0].id); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index ea9f715a9..00211b6b5 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -134,7 +134,8 @@ module.exports = Self => { if (location) await setLocation(ticketId); if (!await hasSignDms(ticketId) && !isSignUploaded) await createGestDoc(ticketId); - await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); + if (isSignUploaded) + await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ From fa53dcbf9dd8f5a32416c391300dfadb93e34ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 13:57:56 +0100 Subject: [PATCH 186/250] =?UTF-8?q?feat:Agrupar=20DUA=20en=20funci=C3=B3n?= =?UTF-8?q?=20del=20transitario=20y=20pa=C3=ADs=20#6937?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../10912-brownCataractarum/00-firstScript.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 db/versions/10912-brownCataractarum/00-firstScript.sql diff --git a/db/versions/10912-brownCataractarum/00-firstScript.sql b/db/versions/10912-brownCataractarum/00-firstScript.sql new file mode 100644 index 000000000..51aea42a1 --- /dev/null +++ b/db/versions/10912-brownCataractarum/00-firstScript.sql @@ -0,0 +1,12 @@ +ALTER TABLE vn.country + MODIFY COLUMN code varchar(2) NOT NULL; + +ALTER TABLE vn.country + ADD CONSTRAINT country_unique UNIQUE KEY (code); + +ALTER TABLE vn.transitoryDuaUnified + ADD countryCodeFk varchar(2) DEFAULT 'EC' NOT NULL; + +ALTER TABLE vn.transitoryDuaUnified + ADD CONSTRAINT transitoryDuaUnified_country_FK FOREIGN KEY (countryCodeFk) + REFERENCES vn.country(code); From 096987040eeed5c3a37feb8eea4b6e55169baf37 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 14:00:04 +0100 Subject: [PATCH 187/250] fix: refs #6184 saveSign --- modules/ticket/back/methods/ticket/saveSign.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index 00211b6b5..aa970237f 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -83,6 +83,8 @@ module.exports = Self => { hasFile: true }; dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); + // Si se ha subido ya la firma, no se vuelve a subir, ya que si no + // da un error de deadlock en la db isSignUploaded = true; } From 2932e5338957fc15cb930696519ace766ea889ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 14:00:27 +0100 Subject: [PATCH 188/250] =?UTF-8?q?feat:Agrupar=20DUA=20en=20funci=C3=B3n?= =?UTF-8?q?=20del=20transitario=20y=20pa=C3=ADs=20#6937?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/versions/10911-wheatGerbera/00-firstScript.sql | 1 - 1 file changed, 1 deletion(-) delete mode 100644 db/versions/10911-wheatGerbera/00-firstScript.sql diff --git a/db/versions/10911-wheatGerbera/00-firstScript.sql b/db/versions/10911-wheatGerbera/00-firstScript.sql deleted file mode 100644 index 371c2c358..000000000 --- a/db/versions/10911-wheatGerbera/00-firstScript.sql +++ /dev/null @@ -1 +0,0 @@ --- Place your SQL code here From 3579c94268d1ebe1113752e62690d30ad2c3dde6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 26 Feb 2024 14:09:53 +0100 Subject: [PATCH 189/250] fix: refs #6184 saveSign --- modules/route/back/methods/route/cmrEmail.js | 25 ++-- modules/ticket/back/methods/ticket/saveCmr.js | 19 ++- .../ticket/back/methods/ticket/saveSign.js | 126 ++++++++++-------- 3 files changed, 86 insertions(+), 84 deletions(-) diff --git a/modules/route/back/methods/route/cmrEmail.js b/modules/route/back/methods/route/cmrEmail.js index 11c4d3dc8..0c4cc5061 100644 --- a/modules/route/back/methods/route/cmrEmail.js +++ b/modules/route/back/methods/route/cmrEmail.js @@ -48,23 +48,18 @@ module.exports = Self => { if (!recipient) throw new UserError('There is no assigned email for this client'); - const dms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: [{ - relation: 'dms', - fields: ['id'], - scope: { - relation: 'dmsType', - scope: { - where: {code: 'cmr'} - } - } - }] - }, myOptions); + const dms = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + JOIN dmsType dt ON dt.id = d.dmsTypeFk + WHERE td.ticketFk = ? + AND dt.code = 'cmr' + `, [ticketId]); - if (!dms) throw new UserError('Cmr file does not exist'); + if (!dms.length) throw new UserError('Cmr file does not exist'); - const response = await models.Dms.downloadFile(ctx, dms.id); + const response = await models.Dms.downloadFile(ctx, dms[0].id); const email = new Email('cmr', { ticketId, diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 17760bacc..691af796c 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -42,18 +42,15 @@ module.exports = Self => { const ticket = await models.Ticket.findById(ticketId, myOptions); if (ticket.cmrFk) { - const hasDmsCmr = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - include: { - relation: 'dms', - fields: ['dmsFk'], - scope: { - where: {dmsTypeFk: dmsTypeCmr.id} - } - } - }, myOptions); + const hasDmsCmr = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + WHERE td.ticketFk = ? + AND d.dmsTypeFk = ? + `, [ticketId, dmsTypeCmr.id]); - if (hasDmsCmr?.dms()) + if (hasDmsCmr.length) throw new UserError('This ticket already has a cmr saved'); ctx.args.id = ticket.cmrFk; diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index fd40c1c22..aa970237f 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -33,8 +33,10 @@ module.exports = Self => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; + let ticket; let dms; - let gestDocCreated = false; + let isSignUploaded; + let externalTickets = []; if (typeof options == 'object') Object.assign(myOptions, options); @@ -44,6 +46,11 @@ module.exports = Self => { myOptions.transaction = tx; } + const dmsTypeTicket = await models.DmsType.findOne({ + where: {code: 'ticket'}, + fields: ['id'] + }); + async function setLocation(ticketId) { await models.Delivery.create({ ticketFk: ticketId, @@ -53,102 +60,105 @@ module.exports = Self => { }, myOptions); } - async function gestDocExists(ticketId) { - const ticketDms = await models.TicketDms.findOne({ - where: {ticketFk: ticketId}, - fields: ['dmsFk'] - }, myOptions); + async function hasSignDms(ticketId) { + const hasTicketDms = await Self.rawSql(` + SELECT d.id + FROM ticketDms td + JOIN dms d ON d.id = td.dmsFk + WHERE td.ticketFk = ? + AND d.dmsTypeFk = ? + `, [ticketId, dmsTypeTicket.id], myOptions); - if (!ticketDms) return false; - - const ticket = await models.Ticket.findById(ticketId, {fields: ['isSigned']}, myOptions); - if (ticket.isSigned == true) - return true; - else - await models.Dms.destroyAll({where: {reference: ticketId}}, myOptions); - - return false; + if (hasTicketDms.length) return true; } - async function createGestDoc(id) { - const ticket = await models.Ticket.findById(id, - { - include: [ - { - relation: 'warehouse', - scope: { - fields: ['id'] - } - }, { - relation: 'client', - scope: { - fields: ['name'] - } - }, { - relation: 'route', - scope: { - fields: ['id'] - } - } - ] - }, myOptions); - const dmsType = await models.DmsType.findOne({where: {code: 'Ticket'}, fields: ['id']}, myOptions); + async function createGestDoc() { const ctxUploadFile = Object.assign({}, ctx); - if (ticket.route() === null) - throw new UserError('Ticket without route'); ctxUploadFile.args = { warehouseId: ticket.warehouseFk, companyId: ticket.companyFk, - dmsTypeId: dmsType.id, - reference: '', + dmsTypeId: dmsTypeTicket.id, + reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, - hasFile: false + hasFile: true }; dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); - gestDocCreated = true; + // Si se ha subido ya la firma, no se vuelve a subir, ya que si no + // da un error de deadlock en la db + isSignUploaded = true; } try { for (const ticketId of tickets) { - const ticketState = await models.TicketState.findOne( - {where: {ticketFk: ticketId}, - fields: ['alertLevel'] - }, myOptions); + ticket = await models.Ticket.findById(ticketId, { + include: [{ + relation: 'address', + scope: { + include: { + relation: 'province', + scope: { + include: { + relation: 'country', + scope: { + fields: ['code'] + } + } + } + } + } + }, { + relation: 'route', + scope: { + fields: ['id'] + } + }] + }, myOptions); - const packedAlertLevel = await models.AlertLevel.findOne({where: {code: 'PACKED'}, + const ticketState = await models.TicketState.findOne({ + where: {ticketFk: ticketId}, + fields: ['alertLevel'] + }, myOptions); + + const packedAlertLevel = await models.AlertLevel.findOne({ + where: {code: 'PACKED'}, fields: ['id'] }, myOptions); if (!ticketState) throw new UserError('Ticket does not exist'); + if (!ticket.route()) + throw new UserError('Ticket without route'); if (ticketState.alertLevel < packedAlertLevel.id) throw new UserError('This ticket cannot be signed because it has not been boxed'); - if (await gestDocExists(ticketId)) + if (await ticket.isSigned) throw new UserError('Ticket is already signed'); if (location) await setLocation(ticketId); - if (!gestDocCreated) await createGestDoc(ticketId); - await models.TicketDms.create({ticketFk: ticketId, dmsFk: dms[0].id}, myOptions); - const ticket = await models.Ticket.findById(ticketId, null, myOptions); + if (!await hasSignDms(ticketId) && !isSignUploaded) + await createGestDoc(ticketId); + if (isSignUploaded) + await models.TicketDms.create({ticketFk: ticket.id, dmsFk: dms[0].id}, myOptions); await ticket.updateAttribute('isSigned', true, myOptions); const deliveryState = await models.State.findOne({ - where: { - code: 'DELIVERED' - } + where: {code: 'DELIVERED'} }, myOptions); await models.Ticket.state(ctx, { ticketFk: ticketId, stateFk: deliveryState.id }, myOptions); - } + if (ticket?.address()?.province()?.country()?.code != 'ES' && ticket.cmrFk) { + await models.Ticket.saveCmr(ctx, [ticketId], myOptions); + externalTickets.push(ticketId); + } + } if (tx) await tx.commit(); - return; } catch (e) { if (tx) await tx.rollback(); throw e; } + await models.Route.cmrEmail(ctx, externalTickets); }; }; From eba7ef31a280987a7126de6a9704f7ac90cb6b66 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 26 Feb 2024 15:11:02 +0100 Subject: [PATCH 190/250] fix: refs #6513 delete wrong records --- .../00-createSupplierDms.sql | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql index fbdc7ed58..26930880b 100644 --- a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -1,8 +1,24 @@ +DELETE FROM vn.supplierDms + WHERE dmsFk IN ( + SELECT sd.dmsFk + FROM vn.supplierDms sd + LEFT JOIN vn.dms d ON d.id = sd.dmsFk + WHERE d.id IS NULL + ); + +DELETE FROM vn.supplierDms + WHERE supplierFk IN ( + SELECT sd.supplierFk + FROM vn.supplierDms sd + LEFT JOIN vn.supplier s ON s.id = sd.supplierFk + WHERE s.id IS NULL + ); + ALTER TABLE `vn`.`supplierDms` MODIFY COLUMN supplierFk int(10) unsigned NOT NULL, ADD editorFk INT UNSIGNED NULL, ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id), - ADD CONSTRAINT dms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT dms_Fk FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE; ALTER TABLE `supplierLog` From f1329a46247d5381f6562ce6a8ab723864e5c145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 15:43:17 +0100 Subject: [PATCH 191/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/entry_beforeUpdate.sql | 18 ------------------ .../vn/triggers/travel_beforeUpdate.sql | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index 1be493a07..a97a90a3d 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -6,7 +6,6 @@ BEGIN DECLARE vIsVirtual BOOL; DECLARE vPrintedCount INT; DECLARE vHasDistinctWarehouses BOOL; - DECLARE vHasAnyInvoiceBooked BOOL; SET NEW.editorFk = account.myUser_getId(); @@ -43,22 +42,5 @@ BEGIN CALL supplier_checkIsActive(NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); END IF; - - IF NOT (NEW.travelFk <=> OLD.travelFk) - OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN - SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); - END IF; - - IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk)THEN - SELECT COUNT(*) INTO vHasAnyInvoiceBooked - FROM entry e - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE e.id = NEW.id - AND ii.isBooked; - - IF vHasAnyInvoiceBooked THEN - CALL util.throw('The travel has entries with booked invoices'); - END IF; - END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index 30e0445a5..eef67bcdb 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate` BEFORE UPDATE ON `travel` FOR EACH ROW BEGIN + DECLARE vHasAnyInvoiceBooked BOOL; + SET NEW.editorFk = account.myUser_getId(); IF NOT (NEW.landed <=> OLD.landed) @@ -17,5 +19,20 @@ BEGIN IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk); END IF; + + IF NOT (NEW.awbFk <=> OLD.awbFk)THEN + DECLARE vHasAnyInvoiceBooked BOOL; + + SELECT COUNT(*) INTO vHasAnyInvoiceBooked + FROM travel t + JOIN entry e ON e.travelFk = t.id + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE t.id = NEW.id + AND ii.isBooked; + + IF vHasAnyInvoiceBooked THEN + CALL util.throw('The travel has entries with booked invoices'); + END IF; + END IF; END$$ DELIMITER ; From 9cbcd70d4d838d033cb7c57de9c832e133100a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 15:44:34 +0100 Subject: [PATCH 192/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/entry_beforeUpdate.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/routines/vn/triggers/entry_beforeUpdate.sql b/db/routines/vn/triggers/entry_beforeUpdate.sql index a97a90a3d..60b83002c 100644 --- a/db/routines/vn/triggers/entry_beforeUpdate.sql +++ b/db/routines/vn/triggers/entry_beforeUpdate.sql @@ -42,5 +42,10 @@ BEGIN CALL supplier_checkIsActive(NEW.supplierFk); SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk); END IF; + + IF NOT (NEW.travelFk <=> OLD.travelFk) + OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN + SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk); + END IF; END$$ DELIMITER ; From dcb09cd9f965e02b5361406345af78e7027f87a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 26 Feb 2024 15:54:13 +0100 Subject: [PATCH 193/250] feat: comprobaciones facturas contabilizadas refs #6932 --- db/routines/vn/triggers/travel_beforeUpdate.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index eef67bcdb..7cc198e3c 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -21,8 +21,6 @@ BEGIN END IF; IF NOT (NEW.awbFk <=> OLD.awbFk)THEN - DECLARE vHasAnyInvoiceBooked BOOL; - SELECT COUNT(*) INTO vHasAnyInvoiceBooked FROM travel t JOIN entry e ON e.travelFk = t.id From 8263b203a79f336441036af27fbf2e608d2cd0a4 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 26 Feb 2024 18:38:50 +0100 Subject: [PATCH 194/250] remove(claimRma): refs #6349 remove --- db/dump/.dump/data.sql | 2 -- db/dump/fixtures.before.sql | 8 ----- .../10913-bronzeGalax/00-firstScript.sql | 4 +++ modules/claim/back/model-config.json | 5 +--- modules/claim/back/models/claim-rma.js | 9 ------ modules/claim/back/models/claim-rma.json | 30 ------------------- modules/claim/back/models/claim.json | 9 ------ myt.config.yml | 1 - 8 files changed, 5 insertions(+), 63 deletions(-) create mode 100644 db/versions/10913-bronzeGalax/00-firstScript.sql delete mode 100644 modules/claim/back/models/claim-rma.js delete mode 100644 modules/claim/back/models/claim-rma.json diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index d7e99a4ee..979f7d738 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -1356,8 +1356,6 @@ INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','em INSERT INTO `ACL` VALUES (386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'); INSERT INTO `ACL` VALUES (388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'); -INSERT INTO `ACL` VALUES (389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager'); -INSERT INTO `ACL` VALUES (390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager'); INSERT INTO `ACL` VALUES (391,'Notification','*','WRITE','ALLOW','ROLE','system'); INSERT INTO `ACL` VALUES (392,'Boxing','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (393,'Url','*','READ','ALLOW','ROLE','employee'); diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 7ba85d8d5..14380c897 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1880,14 +1880,6 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa (1103, 2000, 0.00, 0.00, 0.02, 1.00), (1104, 2500, 150.00, 0.02, 0.10, 1.00); -INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`) - VALUES - (1, '02676A049183', DEFAULT, 1106), - (2, '02676A049183', DEFAULT, 1106), - (3, '02676A049183', DEFAULT, 1107), - (4, '02676A049183', DEFAULT, 1107), - (5, '01837B023653', DEFAULT, 1106); - INSERT INTO `vn`.`claimLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`) VALUES (1, 18, 'update', 'Claim', '{"hasToPickUp":false}', '{"hasToPickUp":true}', 1, NULL), diff --git a/db/versions/10913-bronzeGalax/00-firstScript.sql b/db/versions/10913-bronzeGalax/00-firstScript.sql new file mode 100644 index 000000000..aef0c8738 --- /dev/null +++ b/db/versions/10913-bronzeGalax/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Place your SQL code here +RENAME TABLE IF EXISTS vn.claimRma TO vn.claimRma__; +ALTER TABLE IF EXISTS vn.claimRma__ COMMENT='kkeada el 2024-02-26 por Pablo'; +ALTER TABLE vn.claim CHANGE IF EXISTS rma rma__ varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL; diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json index 83d88039c..d90ed4c1e 100644 --- a/modules/claim/back/model-config.json +++ b/modules/claim/back/model-config.json @@ -43,8 +43,5 @@ }, "ClaimObservation": { "dataSource": "vn" - }, - "ClaimRma": { - "dataSource": "vn" - } + } } diff --git a/modules/claim/back/models/claim-rma.js b/modules/claim/back/models/claim-rma.js deleted file mode 100644 index 6a93613bd..000000000 --- a/modules/claim/back/models/claim-rma.js +++ /dev/null @@ -1,9 +0,0 @@ -const LoopBackContext = require('loopback-context'); - -module.exports = Self => { - Self.observe('before save', async function(ctx) { - const changes = ctx.data || ctx.instance; - const loopBackContext = LoopBackContext.getCurrentContext(); - changes.workerFk = loopBackContext.active.accessToken.userId; - }); -}; diff --git a/modules/claim/back/models/claim-rma.json b/modules/claim/back/models/claim-rma.json deleted file mode 100644 index 27c3c9729..000000000 --- a/modules/claim/back/models/claim-rma.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "ClaimRma", - "base": "VnModel", - "options": { - "mysql": { - "table": "claimRma" - } - }, - "properties": { - "id": { - "id": true, - "type": "number", - "description": "Identifier" - }, - "code": { - "type": "string", - "required": true - }, - "created": { - "type": "date" - } - }, - "relations": { - "worker": { - "type": "belongsTo", - "model": "Worker", - "foreignKey": "workerFk" - } - } -} diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index b85b9e073..1fbbb00b1 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -45,9 +45,6 @@ }, "packages": { "type": "number" - }, - "rma": { - "type": "string" } }, "relations": { @@ -56,12 +53,6 @@ "model": "ClaimState", "foreignKey": "claimStateFk" }, - "rmas": { - "type": "hasMany", - "model": "ClaimRma", - "foreignKey": "code", - "primaryKey": "rma" - }, "client": { "type": "belongsTo", "model": "Client", diff --git a/myt.config.yml b/myt.config.yml index 0b1d62d25..d7d1ad181 100755 --- a/myt.config.yml +++ b/myt.config.yml @@ -179,7 +179,6 @@ localFixtures: - claimLog - claimObservation - claimRatio - - claimRma - claimState - client - clientConfig From afaa5fee7d64fc28bb43cdc2830ac3d48364d5d5 Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 26 Feb 2024 19:00:45 +0100 Subject: [PATCH 195/250] fix(spec): refs #6349 fix fixtures --- db/dump/fixtures.before.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 14380c897..effb83819 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1826,12 +1826,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, ( 6, 'mana', 'Mana', 72, 4, 0), ( 7, 'lack', 'Faltas', 72, 2, 0); -INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`, `ticketFk`) +INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `ticketFk`) VALUES - (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183', 11), - (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL, 16), - (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL, 7), - (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL, 8); + (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, 11), + (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, 16), + (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, 7), + (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, 8); INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) VALUES From 5f20a66ad7379b2e0eb80f860d497ae04c2964a5 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 27 Feb 2024 08:50:23 +0100 Subject: [PATCH 196/250] fix: refs #6513 use vn --- db/versions/10908-blueAsparagus/00-createSupplierDms.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql index 26930880b..bc0a40f11 100644 --- a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -21,5 +21,5 @@ ALTER TABLE `vn`.`supplierDms` ADD CONSTRAINT dms_Fk FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE; -ALTER TABLE `supplierLog` +ALTER TABLE `vn`.`supplierLog` MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier'; \ No newline at end of file From c0988f8d11061b71373e9a5acd4abaa17e68374d Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 27 Feb 2024 09:31:25 +0100 Subject: [PATCH 197/250] fix json --- loopback/locale/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 1fd26204c..cf5fb4af4 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -346,5 +346,5 @@ "You cannot update these fields": "No puedes actualizar estos campos", "CountryFK cannot be empty": "El país no puede estar vacío", "Cmr file does not exist": "El archivo del cmr no existe", - "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", + "You are not allowed to modify the alias": "No estás autorizado a modificar el alias" } From a8065ab1a4506419d096ef24b6451efb28728035 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 27 Feb 2024 09:43:53 +0100 Subject: [PATCH 198/250] fix: refs #6184 hasFile false in saveSign and saveCmr --- modules/ticket/back/methods/ticket/saveCmr.js | 2 +- modules/ticket/back/methods/ticket/saveSign.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 691af796c..f8d0af8ef 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -63,7 +63,7 @@ module.exports = Self => { warehouseFk: ticket.warehouseFk, reference: ticket.id, contentType: 'application/pdf', - hasFile: true + hasFile: false }; const dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index aa970237f..490b05320 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -80,7 +80,7 @@ module.exports = Self => { dmsTypeId: dmsTypeTicket.id, reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, - hasFile: true + hasFile: false }; dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); // Si se ha subido ya la firma, no se vuelve a subir, ya que si no From 1fe665357ffdd3aef8a5f8a41ebdd861ddcea644 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 27 Feb 2024 10:05:46 +0100 Subject: [PATCH 199/250] refs #6053 fix cpus --- jest.front.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jest.front.config.js b/jest.front.config.js index b631a234a..4b292801e 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -2,9 +2,7 @@ // https://jestjs.io/docs/en/configuration.html /* eslint max-len: ["error", { "code": 150 }]*/ const cpus = require('os').cpus().length; -console.log('cpus: ', cpus); -const maxCpus = Math.floor(cpus / 4); -console.log('maxCpus: ', maxCpus); +const maxCpus = Math.floor(cpus * 0.45); module.exports = { name: 'front end', From b86110c898353e7c1dd0d2e16add048b7af4e850 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 27 Feb 2024 10:29:49 +0100 Subject: [PATCH 200/250] fix: refs #6276 changes --- back/methods/collection/getSales.js | 2 +- modules/item/back/methods/item-shelving/getAlternative.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/back/methods/collection/getSales.js b/back/methods/collection/getSales.js index e9a87bfa3..c9f277890 100644 --- a/back/methods/collection/getSales.js +++ b/back/methods/collection/getSales.js @@ -46,7 +46,7 @@ module.exports = Self => { const [sales] = await Self.rawSql('CALL vn.sale_getFromTicketOrCollection(?)', [id], myOptions); - const isPicker = source == 'CHECKER'; + const isPicker = source != 'CHECKER'; const [placements] = await Self.rawSql('CALL vn.collectionPlacement_get(?, ?)', [id, isPicker], myOptions ); diff --git a/modules/item/back/methods/item-shelving/getAlternative.js b/modules/item/back/methods/item-shelving/getAlternative.js index 8c0f63a2f..dd497d580 100644 --- a/modules/item/back/methods/item-shelving/getAlternative.js +++ b/modules/item/back/methods/item-shelving/getAlternative.js @@ -52,7 +52,9 @@ module.exports = Self => { return { id: itemShelving.id, itemFk: itemShelving.itemFk, - longName: item ? item.longName || `${item.name} ${item.size}` : '', + name: item.name, + size: item.size, + longName: item.longName, quantity: itemShelving.visible, carros }; From 699af5b9b73d78a83d2bd41528760624ff4b43cc Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 27 Feb 2024 11:53:55 +0100 Subject: [PATCH 201/250] refs #6531_hotFix_lastTickets --- modules/ticket/back/methods/ticket/myLastModified.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/back/methods/ticket/myLastModified.js b/modules/ticket/back/methods/ticket/myLastModified.js index a47ea570f..096538bfe 100644 --- a/modules/ticket/back/methods/ticket/myLastModified.js +++ b/modules/ticket/back/methods/ticket/myLastModified.js @@ -19,6 +19,7 @@ module.exports = Self => { FROM ticketTracking tt WHERE tt.userFk = ? GROUP BY ticketFk + ORDER BY created DESC LIMIT 5;`; return await Self.rawSql(query, [userId]); }; From 2fe0d5f5ddb640366eb66663213aedc128e20a23 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 27 Feb 2024 13:02:15 +0100 Subject: [PATCH 202/250] fix: refs #6371 restore tables dock y Tramos --- db/versions/10914-aquaBirch/00-firstScript.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 db/versions/10914-aquaBirch/00-firstScript.sql diff --git a/db/versions/10914-aquaBirch/00-firstScript.sql b/db/versions/10914-aquaBirch/00-firstScript.sql new file mode 100644 index 000000000..a182d5407 --- /dev/null +++ b/db/versions/10914-aquaBirch/00-firstScript.sql @@ -0,0 +1,6 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS vn2008.dock__ RENAME vn2008.dock; +ALTER TABLE IF EXISTS vn2008.dock COMMENT=''; + +ALTER TABLE IF EXISTS vn2008.Tramos__ RENAME vn2008.Tramos; +ALTER TABLE IF EXISTS vn2008.Tramos COMMENT=''; \ No newline at end of file From fefc193ec0f4e3207574aa2f5a00c03772a48472 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 27 Feb 2024 13:59:21 +0100 Subject: [PATCH 203/250] refactor: refs #6496 Deleted clean vn2008 --- db/routines/cache/procedures/clean.sql | 2 +- db/routines/vn/procedures/clean.sql | 233 ++++++++++-------- db/routines/vn2008/procedures/clean.sql | 79 ------ .../vn2008/procedures/clean_launcher.sql | 6 - .../10915-limeMastic/00-firstScript.sql | 2 + 5 files changed, 131 insertions(+), 191 deletions(-) delete mode 100644 db/routines/vn2008/procedures/clean.sql delete mode 100644 db/routines/vn2008/procedures/clean_launcher.sql create mode 100644 db/versions/10915-limeMastic/00-firstScript.sql diff --git a/db/routines/cache/procedures/clean.sql b/db/routines/cache/procedures/clean.sql index 95841a713..ee64d052e 100644 --- a/db/routines/cache/procedures/clean.sql +++ b/db/routines/cache/procedures/clean.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`clean`() BEGIN DECLARE vDateShort DATETIME; - SET vDateShort = TIMESTAMPADD(MONTH, -1, util.VN_CURDATE()); + SET vDateShort = util.VN_CURDATE() - INTERVAL 1 MONTH; DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; END$$ diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 06f36afce..c1cafc0fe 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -1,48 +1,42 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean`() BEGIN - DECLARE vDateShort DATETIME; - DECLARE vOneYearAgo DATE; - DECLARE vFourYearsAgo DATE; - DECLARE vFiveYearsAgo DATE; - DECLARE v18Month DATE; - DECLARE v26Month DATE; - DECLARE v3Month DATE; +/** + * Purges outdated data to optimize performance. + * Exercise caution when executing. + */ + DECLARE v2Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 MONTH; + DECLARE v3Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 3 MONTH; + DECLARE v18Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 18 MONTH; + DECLARE v26Months DATE DEFAULT util.VN_CURDATE() - INTERVAL 26 MONTH; + DECLARE v1Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR; + DECLARE v2Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR; + DECLARE v4Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR; + DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR; DECLARE vTrashId VARCHAR(15); - DECLARE v2Years DATE; - DECLARE v5Years DATE; - - SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH; - SET vOneYearAgo = util.VN_CURDATE() - INTERVAL 1 YEAR; - SET vFourYearsAgo = util.VN_CURDATE() - INTERVAL 4 YEAR; - SET vFiveYearsAgo = util.VN_CURDATE() - INTERVAL 5 YEAR; - SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH; - SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH; - SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH; - SET v2Years = util.VN_CURDATE() - INTERVAL 2 YEAR; - SET v5Years = util.VN_CURDATE() - INTERVAL 5 YEAR; + DECLARE vCompanyBlk INT; DELETE FROM workerActivity WHERE created < v2Years; - DELETE FROM ticketParking WHERE created < vDateShort; - DELETE FROM routesMonitor WHERE dated < vDateShort; - DELETE FROM workerTimeControlLog WHERE created < vDateShort; - DELETE FROM `message` WHERE sendDate < vDateShort; - DELETE FROM messageInbox WHERE sendDate < vDateShort; - DELETE FROM messageInbox WHERE sendDate < vDateShort; - DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo; + DELETE FROM ticketParking WHERE created < v2Months; + DELETE FROM routesMonitor WHERE dated < v2Months; + DELETE FROM workerTimeControlLog WHERE created < v2Months; + DELETE FROM `message` WHERE sendDate < v2Months; + DELETE FROM messageInbox WHERE sendDate < v2Months; + DELETE FROM messageInbox WHERE sendDate < v2Months; + DELETE FROM workerTimeControl WHERE timed < v4Years; DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0; - DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_CURDATE()); - DELETE FROM entryLog WHERE creationDate < vDateShort; - DELETE IGNORE FROM expedition WHERE created < v26Month; - DELETE FROM sms WHERE created < v18Month; - DELETE FROM saleTracking WHERE created < vOneYearAgo; - DELETE FROM ticketTracking WHERE created < v18Month; + DELETE FROM ticketDown WHERE created < util.yesterday(); + DELETE FROM entryLog WHERE creationDate < v2Months; + DELETE IGNORE FROM expedition WHERE created < v26Months; + DELETE FROM sms WHERE created < v18Months; + DELETE FROM saleTracking WHERE created < v1Years; + DELETE FROM ticketTracking WHERE created < v18Months; DELETE tobs FROM ticketObservation tobs JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < v5Years; - DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; - DELETE FROM sharingCart where ended < vDateShort; - DELETE FROM sharingClient where ended < vDateShort; + DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < v1Years; + DELETE FROM sharingCart where ended < v2Months; + DELETE FROM sharingClient where ended < v2Months; DELETE tw.* FROM ticketWeekly tw LEFT JOIN sale s ON s.ticketFk = tw.ticketFk LEFT JOIN ticketRequest tr ON tr.ticketFk = tw.ticketFk @@ -50,73 +44,73 @@ BEGIN WHERE s.id IS NULL AND tr.id IS NULL AND ts.id IS NULL; - DELETE FROM claim WHERE ticketCreated < vFourYearsAgo; - DELETE FROM message WHERE sendDate < vDateShort; - -- Robert ubicacion anterior de trevelLog comentario para debug - DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month; + DELETE FROM claim WHERE ticketCreated < v4Years; + -- Robert ubicacion anterior de travelLog comentario para debug + DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Months; DELETE bm FROM buyMark bm JOIN buy b ON b.id = bm.id JOIN entry e ON e.id = b.entryFk JOIN travel t ON t.id = e.travelFk - WHERE t.landed <= vDateShort; - DELETE b FROM vn.buy b - JOIN vn.entryConfig e ON e.defaultEntry = b.entryFk - WHERE b.created < vDateShort; - DELETE FROM vn.itemShelvingLog WHERE created < vDateShort; - DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort; - DELETE FROM vn.itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR; - DELETE FROM printQueue WHERE statusCode = 'printed' AND created < vDateShort; - DELETE FROM ticketLog WHERE creationDate <= vFiveYearsAgo; + WHERE t.landed <= v2Months; + DELETE b FROM buy b + JOIN entryConfig e ON e.defaultEntry = b.entryFk + WHERE b.created < v2Months; + DELETE FROM itemShelvingLog WHERE created < v2Months; + DELETE FROM stockBuyed WHERE creationDate < v2Months; + DELETE FROM itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR; + DELETE FROM printQueue WHERE statusCode = 'printed' AND created < v2Months; + DELETE FROM ticketLog WHERE creationDate <= v5Years; -- Equipos duplicados DELETE w.* FROM workerTeam w - JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated + JOIN ( + SELECT id, team, workerFk, COUNT(*) - 1 duplicated FROM workerTeam GROUP BY team,workerFk HAVING duplicated - ) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id; + ) d ON d.team = w.team + AND d.workerFk = w.workerFk + AND d.id <> w.id; DELETE sc FROM saleComponent sc JOIN sale s ON s.id= sc.saleFk JOIN ticket t ON t.id= s.ticketFk - WHERE t.shipped < v18Month; + WHERE t.shipped < v18Months; DELETE c - FROM vn.claim c - JOIN vn.claimState cs ON cs.id = c.claimStateFk - WHERE cs.description = "Anulado" AND - c.created < vDateShort; - DELETE - FROM vn.expeditionTruck - WHERE eta < v3Month; + FROM claim c + JOIN claimState cs ON cs.id = c.claimStateFk + WHERE cs.description = "Anulado" + AND c.created < v2Months; - DELETE FROM XDiario WHERE FECHA < v3Month OR FECHA IS NULL; - -- borrar travels sin entradas - DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; - CREATE TEMPORARY TABLE tmp.thermographToDelete + DELETE FROM expeditionTruck WHERE eta < v3Months; + DELETE FROM XDiario WHERE FECHA < v3Months OR FECHA IS NULL; + + -- Borrar travels sin entradas + CREATE OR REPLACE TEMPORARY TABLE tThermographToDelete SELECT th.id,th.dmsFk - FROM vn.travel t - LEFT JOIN vn.entry e ON e.travelFk = t.id - JOIN vn.travelThermograph th ON th.travelFk = t.id + FROM travel t + LEFT JOIN entry e ON e.travelFk = t.id + JOIN travelThermograph th ON th.travelFk = t.id WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; SELECT dt.id INTO vTrashId - FROM vn.dmsType dt + FROM dmsType dt WHERE dt.code = 'trash'; - UPDATE tmp.thermographToDelete th - JOIN vn.dms d ON d.id = th.dmsFk + UPDATE tThermographToDelete th + JOIN dms d ON d.id = th.dmsFk SET d.dmsTypeFk = vTrashId; DELETE th - FROM tmp.thermographToDelete tmp - JOIN vn.travelThermograph th ON th.id = tmp.id; + FROM tThermographToDelete tmp + JOIN travelThermograph th ON th.id = tmp.id; DELETE t - FROM vn.travel t - LEFT JOIN vn.entry e ON e.travelFk = t.id + FROM travel t + LEFT JOIN entry e ON e.travelFk = t.id WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; UPDATE dms d @@ -125,69 +119,98 @@ BEGIN WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE()); -- borrar entradas sin compras - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - CREATE TEMPORARY TABLE tmp.entryToDelete + CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete SELECT e.* - FROM vn.entry e - LEFT JOIN vn.buy b ON b.entryFk = e.id - JOIN vn.entryConfig ec ON e.id != ec.defaultEntry + FROM entry e + LEFT JOIN buy b ON b.entryFk = e.id + JOIN entryConfig ec ON e.id <> ec.defaultEntry WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL; DELETE e - FROM vn.entry e - JOIN tmp.entryToDelete tmp ON tmp.id = e.id; + FROM entry e + JOIN tEntryToDelete tmp ON tmp.id = e.id; -- borrar de route registros menores a 4 años - DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete; - CREATE TEMPORARY TABLE tmp.routeToDelete + CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete SELECT * - FROM vn.route r + FROM route r WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); - UPDATE tmp.routeToDelete tmp - JOIN vn.dms d ON d.id = tmp.gestdocFk + UPDATE tRouteToDelete tmp + JOIN dms d ON d.id = tmp.gestdocFk SET d.dmsTypeFk = vTrashId; DELETE r - FROM tmp.routeToDelete tmp - JOIN vn.route r ON r.id = tmp.id; + FROM tRouteToDelete tmp + JOIN route r ON r.id = tmp.id; -- borrar registros de dua y awb menores a 2 años - DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; - CREATE TEMPORARY TABLE tmp.duaToDelete + CREATE OR REPLACE TEMPORARY TABLE tDuaToDelete SELECT * - FROM vn.dua + FROM dua WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE()); - UPDATE tmp.duaToDelete tm - JOIN vn.dms d ON d.id = tm.gestdocFk + UPDATE tDuaToDelete tm + JOIN dms d ON d.id = tm.gestdocFk SET d.dmsTypeFk = vTrashId; DELETE d - FROM tmp.duaToDelete tmp - JOIN vn.dua d ON d.id = tmp.id; + FROM tDuaToDelete tmp + JOIN dua d ON d.id = tmp.id; DELETE a - FROM vn.awb a - LEFT JOIN vn.travel t ON t.awbFk = a.id + FROM awb a + LEFT JOIN travel t ON t.awbFk = a.id WHERE a.created < v2Years AND t.id IS NULL; -- Borra los registros de collection y ticketcollection - DELETE FROM vn.collection WHERE created < vDateShort; + DELETE FROM collection WHERE created < v2Months; + DELETE FROM travelLog WHERE creationDate < v3Months; - DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; - - DELETE FROM travelLog WHERE creationDate < v3Month; - - CALL shelving_clean; + CALL shelving_clean(); DELETE FROM chat WHERE dated < v5Years; + DELETE tt FROM ticketTracking tt + JOIN ticket t ON tt.ticketFk = t.id + WHERE t.shipped <= v2Months; - DELETE tt FROM ticketTracking tt JOIN vn.ticket t ON tt.ticketFk = t.id - WHERE t.shipped <= vDateShort; + -- Clean vn2008 + DELETE FROM mail WHERE creationDate < v2Months; + DELETE FROM split WHERE dated < v18Months; + DELETE FROM remittance WHERE dated < v18Months; + + CREATE OR REPLACE TEMPORARY TABLE tTicketDelete + SELECT DISTINCT tl.originFk ticketFk + FROM ticketLog tl + JOIN ( + SELECT MAX(tl.id)ids + FROM ticket t + JOIN ticketLog tl ON tl.originFk = t.id + WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31' + AND t.isDeleted + GROUP BY t.id + ) sub ON sub.ids = tl.id + WHERE tl.creationDate <= util.VN_CURDATE() - INTERVAL 60 DAY; + DELETE t + FROM ticket t + JOIN tTicketDelete tmp ON tmp.ticketFk = t.id; + -- Tickets Nulos PAK 11/10/2016 + SELECT id INTO vCompanyBlk FROM company WHERE code = 'BLK'; + UPDATE ticket + SET companyFk = vCompanyBlk + WHERE clientFk = (SELECT id FROM client WHERE name = 'AUTOCONSUMO') + AND companyFk <> vCompanyBlk; + + DROP TEMPORARY TABLE tTicketDelete, + tThermographToDelete, + tEntryToDelete, + tDuaToDelete, + tRouteToDelete; + + -- Other schemas + DELETE FROM hedera.`order` WHERE date_send < v18Months; + DELETE FROM pbx.cdr WHERE call_date < v18Months; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql deleted file mode 100644 index 946157fa0..000000000 --- a/db/routines/vn2008/procedures/clean.sql +++ /dev/null @@ -1,79 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`clean`(IN `v_full` TINYINT(1)) -proc: BEGIN - DECLARE vDate DATETIME; - DECLARE vDate18 DATETIME; - DECLARE vDate26 DATETIME; - DECLARE vDate8 DATE; - DECLARE vDate6 DATE; - DECLARE vDate3 DATE; - DECLARE vDate2000 DATE; - DECLARE vRangeDeleteTicket INT; - DECLARE vStrtable VARCHAR(15) DEFAULT NULL; - - SET vDate = util.VN_CURDATE() - INTERVAL 2 MONTH; - SET vDate18 = util.VN_CURDATE() - INTERVAL 18 MONTH; - SET vDate26 = util.VN_CURDATE() - INTERVAL 26 MONTH; - SET vDate3 = util.VN_CURDATE() - INTERVAL 3 MONTH; - SET vDate8 = util.VN_CURDATE() - INTERVAL 8 DAY; - SET vDate6 = util.VN_CURDATE() - INTERVAL 6 DAY; - SET vDate2000 = util.VN_CURDATE() + INTERVAL (2000 - YEAR(util.VN_CURDATE())) YEAR; - SET vRangeDeleteTicket = 60; - - DELETE FROM cdr WHERE calldate < vDate18; - DELETE FROM mail WHERE DATE_ODBC < vDate; - DELETE FROM Movimientos_mark WHERE odbc_date < vDate; - DELETE FROM Splits WHERE Fecha < vDate18; - - DELETE tobs - FROM movement_label tobs - JOIN Movimientos m ON tobs.Id_Movimiento = m.Id_Movimiento - JOIN Tickets t ON m.Id_Ticket = t.Id_Ticket WHERE t.Fecha < vDate; - - DELETE FROM Remesas WHERE `Fecha Remesa` < vDate18; - - DELETE tt.* - FROM Tickets_turno tt - LEFT JOIN Movimientos m USING(Id_Ticket) - WHERE m.Id_Article IS NULL; - - DELETE FROM cl_main WHERE Fecha < vDate18; - DELETE FROM hedera.`order` WHERE date_send < vDate18; - DELETE FROM vn.message WHERE sendDate < vDate; - - DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH; - - DELETE cm - FROM Compres_mark cm - JOIN Compres c ON c.Id_Compra = cm.Id_Compra - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE t.landing <= vDate; - - IF v_full THEN - CREATE OR REPLACE TEMPORARY TABLE tTicketDelete - SELECT DISTINCT tl.originFk ticketFk - FROM vn.ticketLog tl - JOIN (SELECT MAX(tl.id)ids - FROM vn.ticket t - JOIN vn.ticketLog tl ON tl.originFk = t.id - WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31' - AND t.isDeleted - GROUP BY t.id - )sub ON sub.ids = tl.id - WHERE tl.creationDate <= util.VN_CURDATE() - INTERVAL 60 DAY; - - DELETE t - FROM vn.ticket t - JOIN tTicketDelete tmp ON tmp.ticketFk = t.id; - - DROP TEMPORARY TABLE tTicketDelete; - END IF; - - -- Tickets Nulos PAK 11/10/2016 - UPDATE Tickets - SET empresa_id = 965 - WHERE Id_Cliente = 31 - AND empresa_id != 965; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/clean_launcher.sql b/db/routines/vn2008/procedures/clean_launcher.sql deleted file mode 100644 index 63c23e8cf..000000000 --- a/db/routines/vn2008/procedures/clean_launcher.sql +++ /dev/null @@ -1,6 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`clean_launcher`() -BEGIN - CALL clean(TRUE); -END$$ -DELIMITER ; diff --git a/db/versions/10915-limeMastic/00-firstScript.sql b/db/versions/10915-limeMastic/00-firstScript.sql new file mode 100644 index 000000000..be83a4984 --- /dev/null +++ b/db/versions/10915-limeMastic/00-firstScript.sql @@ -0,0 +1,2 @@ +DELETE IGNORE FROM bs.nightTask + WHERE `procedure` = 'clean_launcher'; From 80ecd698f8011c506b467f255ab285c8a42ba466 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 28 Feb 2024 08:23:58 +0100 Subject: [PATCH 204/250] refactor: refs #6499 Migrated procs to vn --- .../procedures/balanceNestTree_addChild.sql} | 33 +++--- .../procedures/balanceNestTree_delete.sql} | 35 +++--- .../vn/procedures/balanceNestTree_move.sql | 111 ++++++++++++++++++ db/routines/vn/procedures/pay.sql | 68 +++++++++++ db/routines/vn2008/procedures/nest_move.sql | 108 ----------------- db/routines/vn2008/procedures/pay.sql | 67 ----------- 6 files changed, 210 insertions(+), 212 deletions(-) rename db/routines/{vn2008/procedures/nest_child_add.sql => vn/procedures/balanceNestTree_addChild.sql} (54%) rename db/routines/{vn2008/procedures/nest_delete.sql => vn/procedures/balanceNestTree_delete.sql} (52%) create mode 100644 db/routines/vn/procedures/balanceNestTree_move.sql create mode 100644 db/routines/vn/procedures/pay.sql delete mode 100644 db/routines/vn2008/procedures/nest_move.sql delete mode 100644 db/routines/vn2008/procedures/pay.sql diff --git a/db/routines/vn2008/procedures/nest_child_add.sql b/db/routines/vn/procedures/balanceNestTree_addChild.sql similarity index 54% rename from db/routines/vn2008/procedures/nest_child_add.sql rename to db/routines/vn/procedures/balanceNestTree_addChild.sql index 5b45a9d07..d16168a59 100644 --- a/db/routines/vn2008/procedures/nest_child_add.sql +++ b/db/routines/vn/procedures/balanceNestTree_addChild.sql @@ -1,48 +1,45 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_child_add`( - vTable VARCHAR(45) - ,vChild VARCHAR(45) - ,vFatherId INT +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`( + vSelfFather INT, + vName VARCHAR(45) ) BEGIN - DECLARE vMyLeft INT; + DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); + DECLARE vLeft INT; - SET vTable = util.quoteIdentifier(vTable); - - DROP TEMPORARY TABLE IF EXISTS aux; - CREATE TEMPORARY TABLE aux - SELECT 0 as lft; + CREATE OR REPLACE TEMPORARY TABLE tAux + SELECT 0 lft; EXECUTE IMMEDIATE CONCAT( - 'UPDATE aux + 'UPDATE tAux SET lft = (SELECT lft FROM ', vTable, ' WHERE id = ?)') USING vFatherId; - SELECT lft INTO vMyLeft FROM aux; - DROP TEMPORARY TABLE aux; + SELECT lft INTO vLeft FROM tAux; EXECUTE IMMEDIATE CONCAT( 'UPDATE ', vTable, ' SET rgt = rgt + 2 WHERE rgt > ? ORDER BY rgt DESC') - USING vMyLeft; + USING vLeft; EXECUTE IMMEDIATE CONCAT( 'UPDATE ', vTable, ' SET lft = lft + 2 WHERE lft > ? ORDER BY lft DESC') - USING vMyLeft; + USING vLeft; EXECUTE IMMEDIATE CONCAT( 'INSERT INTO ', vTable, ' (name, lft, rgt) VALUES(?, ? + 1, ? + 2)') USING vChild, - vMyLeft, - vMyLeft; - + vLeft, + vLeft; + + DROP TEMPORARY TABLE tAux; END$$ DELIMITER ; diff --git a/db/routines/vn2008/procedures/nest_delete.sql b/db/routines/vn/procedures/balanceNestTree_delete.sql similarity index 52% rename from db/routines/vn2008/procedures/nest_delete.sql rename to db/routines/vn/procedures/balanceNestTree_delete.sql index 84f75294b..d2f37851f 100644 --- a/db/routines/vn2008/procedures/nest_delete.sql +++ b/db/routines/vn/procedures/balanceNestTree_delete.sql @@ -1,51 +1,48 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_delete`( - vTable VARCHAR(45) - ,vNodeId INT +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`( + vSelf INT ) BEGIN - DECLARE vMyRight INT; - DECLARE vMyLeft INT; - DECLARE vMyWidth INT; + DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); + DECLARE vRight INT; + DECLARE vLeft INT; + DECLARE vWidth INT; - DROP TEMPORARY TABLE IF EXISTS aux; - CREATE TEMPORARY TABLE aux + CREATE OR REPLACE TEMPORARY TABLE tAux SELECT 0 rgt, 0 lft, 0 wdt; - - SET vTable = util.quoteIdentifier(vTable); EXECUTE IMMEDIATE CONCAT( - 'UPDATE aux a + 'UPDATE tAux a JOIN ', vTable, ' t SET a.rgt = t.rgt, a.lft = t.lft, a.wdt = t.rgt - t.lft + 1 WHERE t.id = ?') - USING vNodeId; + USING vSelf; SELECT rgt, lft, wdt - INTO vMyRight, vMyLeft, vMyWidth - FROM aux; - - DROP TEMPORARY TABLE aux; + INTO vRight, vLeft, vWidth + FROM tAux; EXECUTE IMMEDIATE CONCAT( 'DELETE FROM ', vTable, ' WHERE lft BETWEEN ? AND ?') - USING vMyLeft, vMyRight; + USING vLeft, vRight; EXECUTE IMMEDIATE CONCAT( 'UPDATE ', vTable, ' SET rgt = rgt - ? WHERE rgt > ? ORDER BY rgt') - USING vMyWidth,vMyRight; + USING vWidth,vRight; EXECUTE IMMEDIATE CONCAT( 'UPDATE ', vTable, ' SET lft = lft - ? WHERE lft > ? ORDER BY lft') - USING vMyWidth, vMyRight; + USING vWidth, vRight; + + DROP TEMPORARY TABLE tAux; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/balanceNestTree_move.sql b/db/routines/vn/procedures/balanceNestTree_move.sql new file mode 100644 index 000000000..ea7c734db --- /dev/null +++ b/db/routines/vn/procedures/balanceNestTree_move.sql @@ -0,0 +1,111 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`( + vSelfNode INT, + vSelfFather INT +) +BEGIN + DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); + DECLARE vRight INT; + DECLARE vLeft INT; + DECLARE vWidth INT; + DECLARE vFatherRight INT; + DECLARE vFatherLeft INT; + DECLARE vGap INT; + + CREATE OR REPLACE TEMPORARY TABLE tAux + SELECT 0 rgt, 0 lft, 0 wdt, 0 frg, 0 flf; + + -- Averiguamos el ancho de la rama + EXECUTE IMMEDIATE CONCAT( + 'UPDATE tAux a + JOIN ', vTable, ' t + SET a.wdt = t.rgt - t.lft + 1 + WHERE t.id = ?') + USING vSelfNode; + + -- Averiguamos la posicion del nuevo padre + EXECUTE IMMEDIATE CONCAT( + 'UPDATE tAux a + JOIN ', vTable, ' t + SET a.frg = t.rgt, + a.flf = t.lft + WHERE t.id = ?') + USING vSelfFather; + + SELECT wdt, frg, flf + INTO vWidth, vFatherRight, vFatherLeft + FROM tAux; + + -- 1º Incrementamos los valores de todos los nodos a la derecha + -- del punto de inserción (vFatherRight) , para hacer sitio + EXECUTE IMMEDIATE CONCAT( + 'UPDATE ', vTable, + 'SET rgt = rgt + ? + WHERE rgt >= ? + ORDER BY rgt DESC') + USING vWidth, + vFatherRight; + + EXECUTE IMMEDIATE CONCAT( + 'UPDATE ', vTable, + 'SET lft = lft + ? + WHERE lft >= ? + ORDER BY lft DESC') + USING vWidth, + vFatherRight; + + -- Es preciso recalcular los valores del nodo en el + -- caso de que estuviera a la derecha del nuevo padre + EXECUTE IMMEDIATE CONCAT( + 'UPDATE tAux a + JOIN ', vTable, ' t + SET a.rgt = t.rgt, + a.lft = t.lft + WHERE t.id = ?') + USING vSelfNode; + + SELECT lft, rgt, frg - lft + INTO vLeft, vRight, vGap + FROM tAux; + + -- 2º Incrementamos el valor de todos los nodos a + -- trasladar hasta alcanzar su nueva posicion + EXECUTE IMMEDIATE CONCAT( + 'UPDATE ', vTable, + 'SET lft = lft + ? + WHERE lft BETWEEN ? AND ? + ORDER BY lft DESC') + USING vGap, + vLeft, + vRight; + + EXECUTE IMMEDIATE CONCAT( + 'UPDATE ', vTable, + 'SET rgt = rgt + ? + WHERE rgt BETWEEN ? AND ? + ORDER BY rgt DESC') + USING vGap, + vLeft, + vRight; + + -- 3º Restaremos a todos los nodos resultantes, a la derecha + -- de la posicion arrancada el ancho de la rama escindida + EXECUTE IMMEDIATE CONCAT( + 'UPDATE ', vTable, + 'SET lft = lft - ? + WHERE lft > ? + ORDER BY lft') + USING vWidth, + vLeft; + + EXECUTE IMMEDIATE CONCAT( + 'UPDATE ', vTable, + 'SET rgt = rgt - ? + WHERE rgt > ? + ORDER BY rgt') + USING vWidth, + vRight; + + DROP TEMPORARY TABLE tAux; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/pay.sql b/db/routines/vn/procedures/pay.sql new file mode 100644 index 000000000..42b7a6a55 --- /dev/null +++ b/db/routines/vn/procedures/pay.sql @@ -0,0 +1,68 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`pay`( + vDated DATE, + vSupplierFk INT, + vAmount DOUBLE, + vCurrencyFk INT, + vDivisa DOUBLE, + vBankFk INT, + vPayMethodFk INT, + vExpenseFk DOUBLE, + vConcept VARCHAR(40), + vCompanyFk INT) +BEGIN + INSERT INTO till( + concept, + serie, + `number`, + `out`, + dated, + isAccountable, + bankFk, + workerFk, + companyFk, + isConciliate + ) + SELECT CONCAT('n/pago a ', `name`), + 'R', + vSupplierFk, + vAmount, + vDated, + 1, + vBankFk, + account.myUser_getId(), + vCompanyFk, + 1 + FROM supplier + WHERE id = vSupplierFk; + + INSERT INTO payment( + received, + dueDated, + supplierFk, + amount, + currencyFk, + divisa, + bankFk, + payMethodFk, + bankingFees, + concept, + companyFk + ) + VALUES( + vDated, + vDated, + vSupplierFk, + vAmount, + vCurrencyFk, + IF(NOT vDivisa, NULL, vDivisa), + vBankFk, + vPayMethodFk, + vExpenseFk, + vConcept, + vCompanyFk + ); + + SELECT LAST_INSERT_ID() pago_id; +END$$ +DELIMITER ; diff --git a/db/routines/vn2008/procedures/nest_move.sql b/db/routines/vn2008/procedures/nest_move.sql deleted file mode 100644 index 950d46e68..000000000 --- a/db/routines/vn2008/procedures/nest_move.sql +++ /dev/null @@ -1,108 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_move`( - vTable VARCHAR(45) - ,idNODE INT - ,idFATHER INT -) -BEGIN - DECLARE myRight INT; - DECLARE myLeft INT; - DECLARE myWidth INT; - DECLARE fatherRight INT; - DECLARE fatherLeft INT; - DECLARE gap INT; - - SET vTable = util.quoteIdentifier(vTable); - - DROP TEMPORARY TABLE IF EXISTS aux; - CREATE TEMPORARY TABLE aux - SELECT 0 as rgt, 0 as lft, 0 as wdt, 0 as frg, 0 as flf; - - -- Averiguamos el ancho de la rama - EXECUTE IMMEDIATE CONCAT( - 'UPDATE aux a - JOIN ', vTable, ' t - SET a.wdt = t.rgt - t.lft + 1 - WHERE t.id = ?') - USING idNODE; - - -- Averiguamos la posicion del nuevo padre - EXECUTE IMMEDIATE CONCAT( - 'UPDATE aux a - JOIN ', vTable, ' t - SET a.frg = t.rgt, - a.flf = t.lft - WHERE t.id = ?') - USING idFATHER; - - SELECT wdt, frg, flf INTO myWidth, fatherRight, fatherLeft - FROM aux; - - -- 1º Incrementamos los valores de todos los nodos a la derecha del punto de inserción (fatherRight) , para hacer sitio - EXECUTE IMMEDIATE CONCAT( - 'UPDATE ', vTable, - 'SET rgt = rgt + ? - WHERE rgt >= ? - ORDER BY rgt DESC') - USING myWidth, - fatherRight; - - EXECUTE IMMEDIATE CONCAT( - 'UPDATE ', vTable, - 'SET lft = lft + ? - WHERE lft >= ? - ORDER BY lft DESC') - USING myWidth, - fatherRight; - - -- Es preciso recalcular los valores del nodo en el caso de que estuviera a la derecha del nuevo padre - EXECUTE IMMEDIATE CONCAT( - 'UPDATE aux a - JOIN ', vTable, ' t - SET a.rgt = t.rgt, - a.lft = t.lft - WHERE t.id = ?') - USING idNODE; - - SELECT lft, rgt, frg - lft INTO myLeft, myRight, gap - FROM aux; - - -- 2º Incrementamos el valor de todos los nodos a trasladar hasta alcanzar su nueva posicion - EXECUTE IMMEDIATE CONCAT( - 'UPDATE ', vTable, - 'SET lft = lft + ? - WHERE lft BETWEEN ? AND ? - ORDER BY lft DESC') - USING gap, - myLeft, - myRight; - - EXECUTE IMMEDIATE CONCAT( - 'UPDATE ', vTable, - 'SET rgt = rgt + ? - WHERE rgt BETWEEN ? AND ? - ORDER BY rgt DESC') - USING gap, - myLeft, - myRight; - - -- 3º Restaremos a todos los nodos resultantes, a la derecha de la posicion arrancada el ancho de la rama escindida - EXECUTE IMMEDIATE CONCAT( - 'UPDATE ', vTable, - 'SET lft = lft - ? - WHERE lft > ? - ORDER BY lft') - USING myWidth, - myLeft; - - EXECUTE IMMEDIATE CONCAT( - 'UPDATE ', vTable, - 'SET rgt = rgt - ? - WHERE rgt > ? - ORDER BY rgt') - USING myWidth, - myRight; - - DROP TEMPORARY TABLE aux; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/pay.sql b/db/routines/vn2008/procedures/pay.sql deleted file mode 100644 index ec73ee696..000000000 --- a/db/routines/vn2008/procedures/pay.sql +++ /dev/null @@ -1,67 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`pay`(IN datFEC DATE - , IN idPROV INT - , IN dblIMPORTE DOUBLE - , IN idMONEDA INT - , IN dblDIVISA DOUBLE - , IN idCAJA INT - , IN idPAYMET INT - , IN dblGASTOS DOUBLE - , IN strCONCEPTO VARCHAR(40) - , IN idEMP INT) -BEGIN - - -- Registro en la tabla Cajas - INSERT INTO Cajas ( Concepto - , Serie - , Numero - , Salida - , Cajafecha - , Partida - , Id_Banco - , Id_Trabajador - ,empresa_id - ,conciliado) - - SELECT CONCAT('n/pago a ', Proveedor) - , 'R' - , idPROV - , dblIMPORTE - , datFEC - , 1 - , idCAJA - , account.myUser_getId() - , idEMP - , 1 - FROM Proveedores - WHERE Id_Proveedor = idPROV; - - -- Registro en la tabla pago - INSERT INTO pago(fecha - , dueDated - , id_proveedor - , importe - , id_moneda - , divisa - , id_banco - , pay_met_id - , g_bancarios - , concepte - , empresa_id) - - VALUES(datFEC - , datFEC - , idPROV - , dblIMPORTE - , idMONEDA - , IF(dblDIVISA = 0, NULL, dblDIVISA) - , idCAJA - , idPAYMET - , dblGASTOS - , strCONCEPTO - , idEMP); - - SELECT LAST_INSERT_ID() as pago_id; - -END$$ -DELIMITER ; From 6c67462943343b21c5cc5292c24762665523325e Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 28 Feb 2024 08:26:17 +0100 Subject: [PATCH 205/250] refactor: refs #6499 Minor changes --- db/routines/vn/procedures/balanceNestTree_addChild.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/balanceNestTree_addChild.sql b/db/routines/vn/procedures/balanceNestTree_addChild.sql index d16168a59..a4d6dc4b0 100644 --- a/db/routines/vn/procedures/balanceNestTree_addChild.sql +++ b/db/routines/vn/procedures/balanceNestTree_addChild.sql @@ -15,7 +15,7 @@ BEGIN SET lft = (SELECT lft FROM ', vTable, ' WHERE id = ?)') - USING vFatherId; + USING vSelfFather; SELECT lft INTO vLeft FROM tAux; From b9c5930f68a31f93125229227a44ecdb70b5e379 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 28 Feb 2024 08:29:12 +0100 Subject: [PATCH 206/250] refactor: refs #6499 Minor changes --- db/routines/vn/procedures/balanceNestTree_addChild.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/balanceNestTree_addChild.sql b/db/routines/vn/procedures/balanceNestTree_addChild.sql index a4d6dc4b0..7433cbb42 100644 --- a/db/routines/vn/procedures/balanceNestTree_addChild.sql +++ b/db/routines/vn/procedures/balanceNestTree_addChild.sql @@ -36,7 +36,7 @@ BEGIN EXECUTE IMMEDIATE CONCAT( 'INSERT INTO ', vTable, ' (name, lft, rgt) VALUES(?, ? + 1, ? + 2)') - USING vChild, + USING vName, vLeft, vLeft; From cba0e55846045da31098d94f15d9e2c207a8c403 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 28 Feb 2024 08:39:49 +0100 Subject: [PATCH 207/250] refactor: refs #6499 Added comments --- .../vn/procedures/balanceNestTree_addChild.sql | 11 +++++++++-- .../vn/procedures/balanceNestTree_delete.sql | 5 +++++ db/routines/vn/procedures/balanceNestTree_move.sql | 12 +++++++++--- db/routines/vn/procedures/pay.sql | 14 ++++++++++++++ 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/procedures/balanceNestTree_addChild.sql b/db/routines/vn/procedures/balanceNestTree_addChild.sql index 7433cbb42..0f4f31b06 100644 --- a/db/routines/vn/procedures/balanceNestTree_addChild.sql +++ b/db/routines/vn/procedures/balanceNestTree_addChild.sql @@ -1,9 +1,16 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`( - vSelfFather INT, + vSelf INT, vName VARCHAR(45) ) BEGIN +/** + * Agrega u nuevo nodo hijo a un nodo existente dentro de la estructura + * de árbol de vn.balanceNestTree. + * + * @param vSelf Identificador del nodo + * @param vName Nombre del nuevo nodo hijo + */ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); DECLARE vLeft INT; @@ -15,7 +22,7 @@ BEGIN SET lft = (SELECT lft FROM ', vTable, ' WHERE id = ?)') - USING vSelfFather; + USING vSelf; SELECT lft INTO vLeft FROM tAux; diff --git a/db/routines/vn/procedures/balanceNestTree_delete.sql b/db/routines/vn/procedures/balanceNestTree_delete.sql index d2f37851f..1d6a9efff 100644 --- a/db/routines/vn/procedures/balanceNestTree_delete.sql +++ b/db/routines/vn/procedures/balanceNestTree_delete.sql @@ -3,6 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_del vSelf INT ) BEGIN +/** + * Elimina un nodo dentro de la estructura de árbol de vn.balanceNestTree. + * + * @param vSelf Identificador del nodo + */ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); DECLARE vRight INT; DECLARE vLeft INT; diff --git a/db/routines/vn/procedures/balanceNestTree_move.sql b/db/routines/vn/procedures/balanceNestTree_move.sql index ea7c734db..e4f0b9de4 100644 --- a/db/routines/vn/procedures/balanceNestTree_move.sql +++ b/db/routines/vn/procedures/balanceNestTree_move.sql @@ -1,9 +1,15 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`( - vSelfNode INT, + vSelf INT, vSelfFather INT ) BEGIN +/** + * Mueve un nodo dentro de la estructura de árbol de vn.balanceNestTree. + * + * @param vSelf Identificador del nodo + * @param vSelfFather Identificador del nuevo padre del nodo + */ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); DECLARE vRight INT; DECLARE vLeft INT; @@ -21,7 +27,7 @@ BEGIN JOIN ', vTable, ' t SET a.wdt = t.rgt - t.lft + 1 WHERE t.id = ?') - USING vSelfNode; + USING vSelf; -- Averiguamos la posicion del nuevo padre EXECUTE IMMEDIATE CONCAT( @@ -62,7 +68,7 @@ BEGIN SET a.rgt = t.rgt, a.lft = t.lft WHERE t.id = ?') - USING vSelfNode; + USING vSelf; SELECT lft, rgt, frg - lft INTO vLeft, vRight, vGap diff --git a/db/routines/vn/procedures/pay.sql b/db/routines/vn/procedures/pay.sql index 42b7a6a55..5dc21e45f 100644 --- a/db/routines/vn/procedures/pay.sql +++ b/db/routines/vn/procedures/pay.sql @@ -11,6 +11,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`pay`( vConcept VARCHAR(40), vCompanyFk INT) BEGIN +/** + * Registra un pago realizado a un proveedor. + * + * @param vDated Fecha del pago + * @param vSupplierFk Id del proveedor + * @param vAmount Cantidad a pagar + * @param vCurrencyFk Id de la moneda + * @param vDivisa Tipo de cambio utilizado + * @param vBankFk Id del banco + * @param vPayMethodFk Id del método de pago + * @param vExpenseFk Id de gasto + * @param vConcept Concepto del pago + * @param vCompanyFk Id de la empresa + */ INSERT INTO till( concept, serie, From f95a4f3530a14b875e113ef155920ccbbff407a9 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 28 Feb 2024 09:06:48 +0100 Subject: [PATCH 208/250] refactor: refs #6276 drop setState function --- back/methods/collection/getSales.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/back/methods/collection/getSales.js b/back/methods/collection/getSales.js index c9f277890..cf0496600 100644 --- a/back/methods/collection/getSales.js +++ b/back/methods/collection/getSales.js @@ -42,7 +42,12 @@ module.exports = Self => { const [tickets] = await Self.rawSql('CALL vn.collection_getTickets(?)', [id], myOptions); - await setState(source, id, myOptions); + if (source) { + await Self.rawSql( + 'CALL vn.ticketStateToday_setState(?,?)', [id, source], options + ); + } + const [sales] = await Self.rawSql('CALL vn.sale_getFromTicketOrCollection(?)', [id], myOptions); @@ -151,16 +156,4 @@ module.exports = Self => { AND tr.landed >= DATE_SUB(CURDATE(), INTERVAL 1 YEAR)`; return Self.rawSql(query, [ticketId], options); } - - async function setState(source, id, options) { - const states = { - 'PRECHECKER': 'PREVIOUS_CONTROL', - 'CHECKER': 'ON_CHECKING' - }; - if (states[source]) { - await Self.rawSql( - 'CALL vn.ticketStateToday_setState(?,?)', [id, states[source]], options - ); - } - } }; From b8e6cc9f9ce3e6221aba1385046db019daf0bb47 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 28 Feb 2024 09:08:47 +0100 Subject: [PATCH 209/250] refactor: refs #6499 Added comments --- db/routines/vn/procedures/balanceNestTree_addChild.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/balanceNestTree_addChild.sql b/db/routines/vn/procedures/balanceNestTree_addChild.sql index 0f4f31b06..5cd1ab470 100644 --- a/db/routines/vn/procedures/balanceNestTree_addChild.sql +++ b/db/routines/vn/procedures/balanceNestTree_addChild.sql @@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_add ) BEGIN /** - * Agrega u nuevo nodo hijo a un nodo existente dentro de la estructura + * Agrega un nuevo nodo hijo a un nodo existente dentro de la estructura * de árbol de vn.balanceNestTree. * * @param vSelf Identificador del nodo From 9f2d1a8c0f523db3b7ec33ad90dd1d883136e8dd Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 28 Feb 2024 09:13:01 +0100 Subject: [PATCH 210/250] refactor: refs #6499 Minor change --- db/routines/vn/procedures/pay.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/pay.sql b/db/routines/vn/procedures/pay.sql index 5dc21e45f..c868bfb53 100644 --- a/db/routines/vn/procedures/pay.sql +++ b/db/routines/vn/procedures/pay.sql @@ -24,6 +24,7 @@ BEGIN * @param vExpenseFk Id de gasto * @param vConcept Concepto del pago * @param vCompanyFk Id de la empresa + * @return paymentFk Id de pago insertado */ INSERT INTO till( concept, @@ -77,6 +78,6 @@ BEGIN vCompanyFk ); - SELECT LAST_INSERT_ID() pago_id; + SELECT LAST_INSERT_ID() paymentFk; END$$ DELIMITER ; From 82445683a77d9fc0599980691ea8a03857e29a1a Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 28 Feb 2024 09:19:57 +0100 Subject: [PATCH 211/250] fix: refs #6501 entry_getTransferFix --- .../vn/procedures/entry_getTransfer.sql | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/db/routines/vn/procedures/entry_getTransfer.sql b/db/routines/vn/procedures/entry_getTransfer.sql index 151bebd4d..b82f273ae 100644 --- a/db/routines/vn/procedures/entry_getTransfer.sql +++ b/db/routines/vn/procedures/entry_getTransfer.sql @@ -13,15 +13,15 @@ BEGIN DECLARE vWarehouseIn INT; DECLARE vWarehouseOut INT; DECLARE vCalcVisible INT; - DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate(); + DECLARE vInventoryDate DATE DEFAULT getInventoryDate(); SELECT shipped, landed, warehouseInFk, warehouseOutFk INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut - FROM vn.travel t - JOIN vn.entry e ON e.travelFk = t.id + FROM travel t + JOIN entry e ON e.travelFk = t.id WHERE e.id = vSelf; - CALL vn.rate_getPrices(vDateShipped, vWarehouseIn); + CALL rate_getPrices(vDateShipped, vWarehouseIn); -- Traslado en almacen origen CREATE OR REPLACE TEMPORARY TABLE tBuy @@ -84,7 +84,7 @@ BEGIN WHERE a.available ON DUPLICATE KEY UPDATE availableLanding = a.available; ELSE - CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL); + CALL item_getStock(vWarehouseOut, vDateShipped, NULL); CREATE OR REPLACE TEMPORARY TABLE tItem (UNIQUE INDEX i USING HASH (itemFk)) @@ -97,7 +97,7 @@ BEGIN FROM tmp.itemList; END IF; - CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); + CALL buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded); CREATE OR REPLACE TEMPORARY TABLE tTransfer ENGINE = MEMORY @@ -145,26 +145,26 @@ BEGIN b.id buyFkOrigin, pa.returnCost, b.weight - FROM vn.item i + FROM item i JOIN tItem ti ON ti.itemFk = i.id - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN producer p ON p.id = i.producerFk + LEFT JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN origin o ON o.id = i.originFk LEFT JOIN tBuy lb ON lb.itemFk = i.id - LEFT JOIN vn.buy b ON b.id = lb.buyFk - LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk - LEFT JOIN vn.entry e2 ON e2.id = b.entryFk - LEFT JOIN vn.supplier s ON s.id = e2.supplierFk - LEFT JOIN vn.entry e ON e.id = vSelf - LEFT JOIN vn.travel tr ON tr.id = e.travelFk - LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk - LEFT JOIN vn.buy b2 ON b2.itemFk = i.id + LEFT JOIN buy b ON b.id = lb.buyFk + LEFT JOIN packaging pa ON pa.id = b.packagingFk + LEFT JOIN entry e2 ON e2.id = b.entryFk + LEFT JOIN supplier s ON s.id = e2.supplierFk + LEFT JOIN entry e ON e.id = vSelf + LEFT JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN agencyMode am ON am.id = tr.agencyModeFk + LEFT JOIN buy b2 ON b2.itemFk = i.id AND b2.entryFk = vSelf - LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk + LEFT JOIN packaging pa2 ON pa2.id = b.packagingFk LEFT JOIN tmp.rate r ON TRUE LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id - LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk + LEFT JOIN buy b3 ON b3.id = bufi.buyFk WHERE ic.display AND NOT e.isRaid AND (ti.visible OR ti.available) @@ -172,11 +172,6 @@ BEGIN CREATE INDEX tIndex USING HASH ON tTransfer (itemFk); - SET @carriage := 0; - SET @comission := 0; - SET @packaging := 0; - SET @rate3 := 0; - SET @cost := 0; SELECT *, quantity - MOD(quantity , `grouping`) subQuantity, MOD(quantity, `grouping`) soll, From c7f527133ed8911350c4083177259350958c855a Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 28 Feb 2024 14:05:43 +0100 Subject: [PATCH 212/250] refs #6053 fixture --- db/dump/fixtures.before.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 7ba85d8d5..060ca7ee9 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -564,13 +564,13 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`) INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) VALUES - (1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), + (1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), + (2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), (69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), - (442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), + (442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), (567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), (791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), - (1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); + (1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`) VALUES From 831da1344ae873d350de3b82989cabfbec3655e5 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 28 Feb 2024 14:21:15 +0100 Subject: [PATCH 213/250] fix jenkins --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 821316c87..9ca7f5d19 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,6 +71,7 @@ pipeline { stage('Back') { steps { sh 'pnpm install --prefer-offline' + sh 'pnpx puppeteer browsers install chrome' } } stage('Print') { From 7044a843548b52d4f26e69e09c3f226714fb2008 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 28 Feb 2024 14:26:18 +0100 Subject: [PATCH 214/250] fix puppeteer --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 302738524..588106b4c 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "mysql": "2.18.1", "node-ssh": "^11.0.0", "object.pick": "^1.3.0", - "puppeteer": "^21.11.0", + "puppeteer": "^22.3.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "smbhash": "0.0.1", From d4133580c4bb98627b11629ae17bb46e2546c515 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 28 Feb 2024 14:30:34 +0100 Subject: [PATCH 215/250] fix pnpm --- pnpm-lock.yaml | 117 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 36 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 36bff2fe1..613b3af2d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,8 +93,8 @@ dependencies: specifier: ^1.3.0 version: 1.3.0 puppeteer: - specifier: ^21.11.0 - version: 21.11.0 + specifier: ^22.3.0 + version: 22.3.0 read-chunk: specifier: ^3.2.0 version: 3.2.0 @@ -1916,16 +1916,17 @@ packages: dev: true optional: true - /@puppeteer/browsers@1.9.1: - resolution: {integrity: sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==} - engines: {node: '>=16.3.0'} + /@puppeteer/browsers@2.1.0: + resolution: {integrity: sha512-xloWvocjvryHdUjDam/ZuGMh7zn4Sn3ZAaV4Ah2e2EwEt90N3XphZlSsU3n0VDc1F7kggCjMuH0UuxfPQ5mD9w==} + engines: {node: '>=18'} hasBin: true dependencies: debug: 4.3.4(supports-color@6.1.0) extract-zip: 2.0.1 progress: 2.0.3 - proxy-agent: 6.3.1 - tar-fs: 3.0.4 + proxy-agent: 6.4.0 + semver: 7.6.0 + tar-fs: 3.0.5 unbzip2-stream: 1.4.3 yargs: 17.7.2 transitivePeerDependencies: @@ -3498,6 +3499,37 @@ packages: /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + /bare-events@2.2.0: + resolution: {integrity: sha512-Yyyqff4PIFfSuthCZqLlPISTWHmnQxoPuAvkmgzsJEmG3CesdIv6Xweayl0JkCZJSB2yYIdJyEz97tpxNhgjbg==} + requiresBuild: true + dev: false + optional: true + + /bare-fs@2.2.0: + resolution: {integrity: sha512-+VhW202E9eTVGkX7p+TNXtZC4RTzj9JfJW7PtfIbZ7mIQ/QT9uOafQTx7lx2n9ERmWsXvLHF4hStAFn4gl2mQw==} + requiresBuild: true + dependencies: + bare-events: 2.2.0 + bare-os: 2.2.0 + bare-path: 2.1.0 + streamx: 2.15.6 + dev: false + optional: true + + /bare-os@2.2.0: + resolution: {integrity: sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==} + requiresBuild: true + dev: false + optional: true + + /bare-path@2.1.0: + resolution: {integrity: sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==} + requiresBuild: true + dependencies: + bare-os: 2.2.0 + dev: false + optional: true + /base64-js@0.0.2: resolution: {integrity: sha512-Pj9L87dCdGcKlSqPVUjD+q96pbIx1zQQLb2CUiWURfjiBELv84YX+0nGnKmyT/9KkC7PQk7UN1w+Al8bBozaxQ==} engines: {node: '>= 0.4'} @@ -4060,12 +4092,12 @@ packages: engines: {node: '>=6.0'} dev: true - /chromium-bidi@0.5.8(devtools-protocol@0.0.1232444): - resolution: {integrity: sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==} + /chromium-bidi@0.5.10(devtools-protocol@0.0.1249869): + resolution: {integrity: sha512-4hsPE1VaLLM/sgNK/SlLbI24Ra7ZOuWAjA3rhw1lVCZ8ZiUgccS6cL5L/iqo4hjRcl5vwgYJ8xTtbXdulA9b6Q==} peerDependencies: devtools-protocol: '*' dependencies: - devtools-protocol: 0.0.1232444 + devtools-protocol: 0.0.1249869 mitt: 3.0.1 urlpattern-polyfill: 10.0.0 dev: false @@ -5049,8 +5081,8 @@ packages: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} dev: true - /devtools-protocol@0.0.1232444: - resolution: {integrity: sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==} + /devtools-protocol@0.0.1249869: + resolution: {integrity: sha512-Ctp4hInA0BEavlUoRy9mhGq0i+JSo/AwVyX2EFgZmV1kYB+Zq+EMBAn52QWu6FbRr10hRb6pBl420upbp4++vg==} dev: false /diff-sequences@26.6.2: @@ -7288,8 +7320,8 @@ packages: - supports-color dev: true - /http-proxy-agent@7.0.0: - resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} + /http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -7367,8 +7399,8 @@ packages: transitivePeerDependencies: - supports-color - /https-proxy-agent@7.0.2: - resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} + /https-proxy-agent@7.0.4: + resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -9780,7 +9812,9 @@ packages: /mkdirp-classic@0.5.3: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + requiresBuild: true dev: false + optional: true /mkdirp@0.3.0: resolution: {integrity: sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==} @@ -10692,8 +10726,8 @@ packages: agent-base: 7.1.0 debug: 4.3.4(supports-color@6.1.0) get-uri: 6.0.2 - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.4 pac-resolver: 7.0.0 socks-proxy-agent: 8.0.2 transitivePeerDependencies: @@ -11149,14 +11183,14 @@ packages: forwarded: 0.2.0 ipaddr.js: 1.9.1 - /proxy-agent@6.3.1: - resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==} + /proxy-agent@6.4.0: + resolution: {integrity: sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 debug: 4.3.4(supports-color@6.1.0) - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.4 lru-cache: 7.18.3 pac-proxy-agent: 7.0.1 proxy-from-env: 1.1.0 @@ -11222,15 +11256,15 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - /puppeteer-core@21.11.0: - resolution: {integrity: sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==} - engines: {node: '>=16.13.2'} + /puppeteer-core@22.3.0: + resolution: {integrity: sha512-Ho5Vdpdro05ZyCx/l5Hkc5vHiibKTaY37fIAD9NF9Gi/vDxkVTeX40U/mFnEmeoxyuYALvWCJfi7JTT82R6Tuw==} + engines: {node: '>=18'} dependencies: - '@puppeteer/browsers': 1.9.1 - chromium-bidi: 0.5.8(devtools-protocol@0.0.1232444) + '@puppeteer/browsers': 2.1.0 + chromium-bidi: 0.5.10(devtools-protocol@0.0.1249869) cross-fetch: 4.0.0 debug: 4.3.4(supports-color@6.1.0) - devtools-protocol: 0.0.1232444 + devtools-protocol: 0.0.1249869 ws: 8.16.0 transitivePeerDependencies: - bufferutil @@ -11239,15 +11273,15 @@ packages: - utf-8-validate dev: false - /puppeteer@21.11.0: - resolution: {integrity: sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==} - engines: {node: '>=16.13.2'} + /puppeteer@22.3.0: + resolution: {integrity: sha512-GC+tyjzYKjaNjhlDAuqRgDM+IOsqOG75Da4L28G4eULNLLxKDt+79x2OOSQ47HheJBgGq7ATSExNE6gayxP6cg==} + engines: {node: '>=18'} hasBin: true requiresBuild: true dependencies: - '@puppeteer/browsers': 1.9.1 + '@puppeteer/browsers': 2.1.0 cosmiconfig: 9.0.0 - puppeteer-core: 21.11.0 + puppeteer-core: 22.3.0 transitivePeerDependencies: - bufferutil - encoding @@ -11288,6 +11322,7 @@ packages: /queue-tick@1.0.1: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + requiresBuild: true dev: false /quick-lru@4.0.1: @@ -11987,6 +12022,14 @@ packages: dependencies: lru-cache: 6.0.0 + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: false + /send@0.18.0(supports-color@6.1.0): resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -12986,12 +13029,14 @@ packages: dev: false optional: true - /tar-fs@3.0.4: - resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==} + /tar-fs@3.0.5: + resolution: {integrity: sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==} dependencies: - mkdirp-classic: 0.5.3 pump: 3.0.0 tar-stream: 3.1.7 + optionalDependencies: + bare-fs: 2.2.0 + bare-path: 2.1.0 dev: false /tar-stream@1.6.2: From 7316673a0bb22b2b836ad07f62db155da8fb3676 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 28 Feb 2024 14:51:08 +0100 Subject: [PATCH 216/250] fix pnpm --- package.json | 2 +- pnpm-lock.yaml | 101 ++++++++++++++----------------------------------- 2 files changed, 30 insertions(+), 73 deletions(-) diff --git a/package.json b/package.json index 588106b4c..302738524 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "mysql": "2.18.1", "node-ssh": "^11.0.0", "object.pick": "^1.3.0", - "puppeteer": "^22.3.0", + "puppeteer": "^21.11.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "smbhash": "0.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 613b3af2d..3e335c06c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -93,8 +93,8 @@ dependencies: specifier: ^1.3.0 version: 1.3.0 puppeteer: - specifier: ^22.3.0 - version: 22.3.0 + specifier: ^21.11.0 + version: 21.11.0 read-chunk: specifier: ^3.2.0 version: 3.2.0 @@ -1916,17 +1916,16 @@ packages: dev: true optional: true - /@puppeteer/browsers@2.1.0: - resolution: {integrity: sha512-xloWvocjvryHdUjDam/ZuGMh7zn4Sn3ZAaV4Ah2e2EwEt90N3XphZlSsU3n0VDc1F7kggCjMuH0UuxfPQ5mD9w==} - engines: {node: '>=18'} + /@puppeteer/browsers@1.9.1: + resolution: {integrity: sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==} + engines: {node: '>=16.3.0'} hasBin: true dependencies: debug: 4.3.4(supports-color@6.1.0) extract-zip: 2.0.1 progress: 2.0.3 - proxy-agent: 6.4.0 - semver: 7.6.0 - tar-fs: 3.0.5 + proxy-agent: 6.3.1 + tar-fs: 3.0.4 unbzip2-stream: 1.4.3 yargs: 17.7.2 transitivePeerDependencies: @@ -3499,37 +3498,6 @@ packages: /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - /bare-events@2.2.0: - resolution: {integrity: sha512-Yyyqff4PIFfSuthCZqLlPISTWHmnQxoPuAvkmgzsJEmG3CesdIv6Xweayl0JkCZJSB2yYIdJyEz97tpxNhgjbg==} - requiresBuild: true - dev: false - optional: true - - /bare-fs@2.2.0: - resolution: {integrity: sha512-+VhW202E9eTVGkX7p+TNXtZC4RTzj9JfJW7PtfIbZ7mIQ/QT9uOafQTx7lx2n9ERmWsXvLHF4hStAFn4gl2mQw==} - requiresBuild: true - dependencies: - bare-events: 2.2.0 - bare-os: 2.2.0 - bare-path: 2.1.0 - streamx: 2.15.6 - dev: false - optional: true - - /bare-os@2.2.0: - resolution: {integrity: sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==} - requiresBuild: true - dev: false - optional: true - - /bare-path@2.1.0: - resolution: {integrity: sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==} - requiresBuild: true - dependencies: - bare-os: 2.2.0 - dev: false - optional: true - /base64-js@0.0.2: resolution: {integrity: sha512-Pj9L87dCdGcKlSqPVUjD+q96pbIx1zQQLb2CUiWURfjiBELv84YX+0nGnKmyT/9KkC7PQk7UN1w+Al8bBozaxQ==} engines: {node: '>= 0.4'} @@ -3818,7 +3786,7 @@ packages: resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==} dependencies: base64-js: 1.5.1 - ieee754: 1.1.13 + ieee754: 1.2.1 isarray: 1.0.0 dev: false @@ -4092,12 +4060,12 @@ packages: engines: {node: '>=6.0'} dev: true - /chromium-bidi@0.5.10(devtools-protocol@0.0.1249869): - resolution: {integrity: sha512-4hsPE1VaLLM/sgNK/SlLbI24Ra7ZOuWAjA3rhw1lVCZ8ZiUgccS6cL5L/iqo4hjRcl5vwgYJ8xTtbXdulA9b6Q==} + /chromium-bidi@0.5.8(devtools-protocol@0.0.1232444): + resolution: {integrity: sha512-blqh+1cEQbHBKmok3rVJkBlBxt9beKBgOsxbFgs7UJcoVbbeZ+K7+6liAsjgpc8l1Xd55cQUy14fXZdGSb4zIw==} peerDependencies: devtools-protocol: '*' dependencies: - devtools-protocol: 0.0.1249869 + devtools-protocol: 0.0.1232444 mitt: 3.0.1 urlpattern-polyfill: 10.0.0 dev: false @@ -5081,8 +5049,8 @@ packages: resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} dev: true - /devtools-protocol@0.0.1249869: - resolution: {integrity: sha512-Ctp4hInA0BEavlUoRy9mhGq0i+JSo/AwVyX2EFgZmV1kYB+Zq+EMBAn52QWu6FbRr10hRb6pBl420upbp4++vg==} + /devtools-protocol@0.0.1232444: + resolution: {integrity: sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==} dev: false /diff-sequences@26.6.2: @@ -9814,7 +9782,6 @@ packages: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} requiresBuild: true dev: false - optional: true /mkdirp@0.3.0: resolution: {integrity: sha512-OHsdUcVAQ6pOtg5JYWpCBo9W/GySVuwvP9hueRMW7UqshC0tbfzLv8wjySTPm3tfUZ/21CE9E1pJagOA91Pxew==} @@ -11183,8 +11150,8 @@ packages: forwarded: 0.2.0 ipaddr.js: 1.9.1 - /proxy-agent@6.4.0: - resolution: {integrity: sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==} + /proxy-agent@6.3.1: + resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -11256,15 +11223,15 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} - /puppeteer-core@22.3.0: - resolution: {integrity: sha512-Ho5Vdpdro05ZyCx/l5Hkc5vHiibKTaY37fIAD9NF9Gi/vDxkVTeX40U/mFnEmeoxyuYALvWCJfi7JTT82R6Tuw==} - engines: {node: '>=18'} + /puppeteer-core@21.11.0: + resolution: {integrity: sha512-ArbnyA3U5SGHokEvkfWjW+O8hOxV1RSJxOgriX/3A4xZRqixt9ZFHD0yPgZQF05Qj0oAqi8H/7stDorjoHY90Q==} + engines: {node: '>=16.13.2'} dependencies: - '@puppeteer/browsers': 2.1.0 - chromium-bidi: 0.5.10(devtools-protocol@0.0.1249869) + '@puppeteer/browsers': 1.9.1 + chromium-bidi: 0.5.8(devtools-protocol@0.0.1232444) cross-fetch: 4.0.0 debug: 4.3.4(supports-color@6.1.0) - devtools-protocol: 0.0.1249869 + devtools-protocol: 0.0.1232444 ws: 8.16.0 transitivePeerDependencies: - bufferutil @@ -11273,15 +11240,15 @@ packages: - utf-8-validate dev: false - /puppeteer@22.3.0: - resolution: {integrity: sha512-GC+tyjzYKjaNjhlDAuqRgDM+IOsqOG75Da4L28G4eULNLLxKDt+79x2OOSQ47HheJBgGq7ATSExNE6gayxP6cg==} - engines: {node: '>=18'} + /puppeteer@21.11.0: + resolution: {integrity: sha512-9jTHuYe22TD3sNxy0nEIzC7ZrlRnDgeX3xPkbS7PnbdwYjl2o/z/YuCrRBwezdKpbTDTJ4VqIggzNyeRcKq3cg==} + engines: {node: '>=16.13.2'} hasBin: true requiresBuild: true dependencies: - '@puppeteer/browsers': 2.1.0 + '@puppeteer/browsers': 1.9.1 cosmiconfig: 9.0.0 - puppeteer-core: 22.3.0 + puppeteer-core: 21.11.0 transitivePeerDependencies: - bufferutil - encoding @@ -12022,14 +11989,6 @@ packages: dependencies: lru-cache: 6.0.0 - /semver@7.6.0: - resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: false - /send@0.18.0(supports-color@6.1.0): resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} @@ -13029,14 +12988,12 @@ packages: dev: false optional: true - /tar-fs@3.0.5: - resolution: {integrity: sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==} + /tar-fs@3.0.4: + resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==} dependencies: + mkdirp-classic: 0.5.3 pump: 3.0.0 tar-stream: 3.1.7 - optionalDependencies: - bare-fs: 2.2.0 - bare-path: 2.1.0 dev: false /tar-stream@1.6.2: From 6b7dc67c3e1f42f3e94da3946331d68d57fa0034 Mon Sep 17 00:00:00 2001 From: JAVIER SEGARRA MARTINEZ Date: Thu, 29 Feb 2024 06:25:41 +0000 Subject: [PATCH 217/250] hotfix fix: replace pdf with csv --- modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js index d33df74a2..c734b588c 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js @@ -80,6 +80,6 @@ module.exports = Self => { const content = toCSV(sales); - return [content, 'text/csv', `inline; filename="doc-${reference}.pdf"`]; + return [content, 'text/csv', `inline; filename="doc-${reference}.csv"`]; }; }; From 599e8761c15d06a67f1c5cc224c1d197814449d9 Mon Sep 17 00:00:00 2001 From: JAVIER SEGARRA MARTINEZ Date: Thu, 29 Feb 2024 06:26:21 +0000 Subject: [PATCH 218/250] hotfix fix: replace pdf with csv --- modules/ticket/back/methods/ticket/deliveryNoteCsv.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js index 55ec4089d..40526ac16 100644 --- a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js +++ b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js @@ -79,6 +79,6 @@ module.exports = Self => { ORDER BY s.ticketFk, s.created`, [id]); const content = toCSV(sales); - return [content, 'text/csv', `inline; filename="doc-${id}.pdf"`]; + return [content, 'text/csv', `inline; filename="doc-${id}.csv"`]; }; }; From 7a43ccaa3685d11afcedcb68569eaa75b5b6ca3c Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 29 Feb 2024 07:32:19 +0100 Subject: [PATCH 219/250] refactor: refs #6496 Requested changes --- db/routines/cache/procedures/clean.sql | 6 +--- db/routines/vn/procedures/clean.sql | 45 +++++++++++++------------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/db/routines/cache/procedures/clean.sql b/db/routines/cache/procedures/clean.sql index ee64d052e..5e6628689 100644 --- a/db/routines/cache/procedures/clean.sql +++ b/db/routines/cache/procedures/clean.sql @@ -1,10 +1,6 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`clean`() BEGIN - DECLARE vDateShort DATETIME; - - SET vDateShort = util.VN_CURDATE() - INTERVAL 1 MONTH; - - DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; + DELETE FROM cache.departure_limit WHERE Fecha < util.VN_CURDATE() - INTERVAL 1 MONTH; END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index c1cafc0fe..898a5c835 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -82,7 +82,7 @@ BEGIN DELETE c FROM claim c JOIN claimState cs ON cs.id = c.claimStateFk - WHERE cs.description = "Anulado" + WHERE cs.description = 'Anulado' AND c.created < v2Months; DELETE FROM expeditionTruck WHERE eta < v3Months; @@ -94,69 +94,71 @@ BEGIN FROM travel t LEFT JOIN entry e ON e.travelFk = t.id JOIN travelThermograph th ON th.travelFk = t.id - WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; + WHERE t.shipped < v3Months + AND e.travelFk IS NULL; SELECT dt.id INTO vTrashId FROM dmsType dt WHERE dt.code = 'trash'; UPDATE tThermographToDelete th - JOIN dms d ON d.id = th.dmsFk + JOIN dms d ON d.id = th.dmsFk SET d.dmsTypeFk = vTrashId; DELETE th FROM tThermographToDelete tmp - JOIN travelThermograph th ON th.id = tmp.id; + JOIN travelThermograph th ON th.id = tmp.id; DELETE t FROM travel t - LEFT JOIN entry e ON e.travelFk = t.id - WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL; + LEFT JOIN entry e ON e.travelFk = t.id + WHERE t.shipped < v3Months AND e.travelFk IS NULL; UPDATE dms d JOIN dmsType dt ON dt.id = d.dmsTypeFk SET d.dmsTypeFk = vTrashId - WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE()); + WHERE created < util.VN_CURDATE() - INTERVAL dt.monthToDelete MONTH; -- borrar entradas sin compras CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete SELECT e.* FROM entry e - LEFT JOIN buy b ON b.entryFk = e.id - JOIN entryConfig ec ON e.id <> ec.defaultEntry - WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL; + LEFT JOIN buy b ON b.entryFk = e.id + JOIN entryConfig ec ON e.id <> ec.defaultEntry + WHERE e.dated < v3Months + AND b.entryFK IS NULL; DELETE e FROM entry e - JOIN tEntryToDelete tmp ON tmp.id = e.id; + JOIN tEntryToDelete tmp ON tmp.id = e.id; -- borrar de route registros menores a 4 años CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete SELECT * - FROM route r - WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE()); + FROM route r + WHERE created < v4Years; UPDATE tRouteToDelete tmp - JOIN dms d ON d.id = tmp.gestdocFk + JOIN dms d ON d.id = tmp.gestdocFk SET d.dmsTypeFk = vTrashId; DELETE r FROM tRouteToDelete tmp - JOIN route r ON r.id = tmp.id; + JOIN route r ON r.id = tmp.id; -- borrar registros de dua y awb menores a 2 años CREATE OR REPLACE TEMPORARY TABLE tDuaToDelete SELECT * FROM dua - WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE()); + WHERE operated < v2Years; - UPDATE tDuaToDelete tm - JOIN dms d ON d.id = tm.gestdocFk + UPDATE tDuaToDelete tm + JOIN dms d ON d.id = tm.gestdocFk SET d.dmsTypeFk = vTrashId; DELETE d FROM tDuaToDelete tmp - JOIN dua d ON d.id = tmp.id; + JOIN dua d ON d.id = tmp.id; DELETE a FROM awb a @@ -165,17 +167,16 @@ BEGIN AND t.id IS NULL; -- Borra los registros de collection y ticketcollection - DELETE FROM collection WHERE created < v2Months; + DELETE FROM collection WHERE created < v2Months; DELETE FROM travelLog WHERE creationDate < v3Months; CALL shelving_clean(); DELETE FROM chat WHERE dated < v5Years; DELETE tt FROM ticketTracking tt - JOIN ticket t ON tt.ticketFk = t.id + JOIN ticket t ON tt.ticketFk = t.id WHERE t.shipped <= v2Months; - -- Clean vn2008 DELETE FROM mail WHERE creationDate < v2Months; DELETE FROM split WHERE dated < v18Months; DELETE FROM remittance WHERE dated < v18Months; From 96bab9b27d039a04b246f01dc1439642f39b8a02 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 29 Feb 2024 07:37:23 +0100 Subject: [PATCH 220/250] refactor: refs #6496 Requested changes --- db/routines/vn/procedures/balanceNestTree_move.sql | 6 +++--- db/routines/vn/procedures/pay.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/routines/vn/procedures/balanceNestTree_move.sql b/db/routines/vn/procedures/balanceNestTree_move.sql index e4f0b9de4..ce29de1d9 100644 --- a/db/routines/vn/procedures/balanceNestTree_move.sql +++ b/db/routines/vn/procedures/balanceNestTree_move.sql @@ -1,14 +1,14 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`( vSelf INT, - vSelfFather INT + vFather INT ) BEGIN /** * Mueve un nodo dentro de la estructura de árbol de vn.balanceNestTree. * * @param vSelf Identificador del nodo - * @param vSelfFather Identificador del nuevo padre del nodo + * @param vFather Identificador del nuevo padre del nodo */ DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree'); DECLARE vRight INT; @@ -36,7 +36,7 @@ BEGIN SET a.frg = t.rgt, a.flf = t.lft WHERE t.id = ?') - USING vSelfFather; + USING vFather; SELECT wdt, frg, flf INTO vWidth, vFatherRight, vFatherLeft diff --git a/db/routines/vn/procedures/pay.sql b/db/routines/vn/procedures/pay.sql index c868bfb53..2ef9ca2d6 100644 --- a/db/routines/vn/procedures/pay.sql +++ b/db/routines/vn/procedures/pay.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`pay`( vSupplierFk INT, vAmount DOUBLE, vCurrencyFk INT, - vDivisa DOUBLE, + vForeignValue DOUBLE, vBankFk INT, vPayMethodFk INT, vExpenseFk DOUBLE, @@ -18,7 +18,7 @@ BEGIN * @param vSupplierFk Id del proveedor * @param vAmount Cantidad a pagar * @param vCurrencyFk Id de la moneda - * @param vDivisa Tipo de cambio utilizado + * @param vForeignValue Tipo de cambio utilizado * @param vBankFk Id del banco * @param vPayMethodFk Id del método de pago * @param vExpenseFk Id de gasto @@ -70,7 +70,7 @@ BEGIN vSupplierFk, vAmount, vCurrencyFk, - IF(NOT vDivisa, NULL, vDivisa), + IF(NOT vForeignValue, NULL, vForeignValue), vBankFk, vPayMethodFk, vExpenseFk, From feeb9eece7f68dbf4b209ec3f39f5abcee8994e3 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 29 Feb 2024 08:12:17 +0100 Subject: [PATCH 221/250] feat: refs #6401 Added QR and CIF in the CMR report --- .../reports/cmr/assets/css/style.css | 17 +++- print/templates/reports/cmr/cmr.html | 22 +++++- print/templates/reports/cmr/cmr.js | 77 +++++++++++-------- print/templates/reports/cmr/sql/data.sql | 1 + 4 files changed, 78 insertions(+), 39 deletions(-) diff --git a/print/templates/reports/cmr/assets/css/style.css b/print/templates/reports/cmr/assets/css/style.css index 201afc3b6..8b007b3b0 100644 --- a/print/templates/reports/cmr/assets/css/style.css +++ b/print/templates/reports/cmr/assets/css/style.css @@ -3,7 +3,7 @@ html { margin: 10px; font-size: 22px; } -.mainTable, .specialTable, .categoryTable { +.mainTable, .specialTable, .categoryTable, .observationTable { width: 100%; border-collapse: collapse; font-size: inherit; @@ -98,4 +98,19 @@ img { #merchandiseLabels td { padding-bottom: 11px; max-width: 300px; +} + +.observationTable tr td { + border: none; + padding: 5px; +} + +#qrSection { + text-align: center; + width: 30%; +} + +#truckPlateQr { + width: 125px; + margin-bottom: 10px; } \ No newline at end of file diff --git a/print/templates/reports/cmr/cmr.html b/print/templates/reports/cmr/cmr.html index c6a9e79d6..a8f302086 100644 --- a/print/templates/reports/cmr/cmr.html +++ b/print/templates/reports/cmr/cmr.html @@ -30,8 +30,11 @@ 16. Transportista / Transporteur / Carrier
{{data.carrierName}}
- {{data.carrierStreet}}
- {{data.carrierPostalCode}} {{data.carrierCity}} {{(data.carrierCountry) ? `(${data.carrierCountry})` : null}} + {{data.carrierStreet}} {{data.carrierPostalCode}} + {{data.carrierCity}} {{(data.carrierCountry) + ? `(${data.carrierCountry})` + : null}}
+ CIF: {{data.carrierCif}} @@ -71,8 +74,19 @@ Carrier's reservations and observations
- {{data.truckPlate}}
- {{data.observations}} + + + + + +
+ {{data.observations}} + + +
+ {{data.truckPlate}} +
+ diff --git a/print/templates/reports/cmr/cmr.js b/print/templates/reports/cmr/cmr.js index c939e5152..2ee855ce0 100644 --- a/print/templates/reports/cmr/cmr.js +++ b/print/templates/reports/cmr/cmr.js @@ -2,44 +2,53 @@ const config = require(`vn-print/core/config`); const vnReport = require('../../../core/mixins/vn-report.js'); const md5 = require('md5'); const fs = require('fs-extra'); +const qrcode = require('qrcode'); const prefixBase64 = 'data:image/png;base64,'; module.exports = { - name: 'cmr', - mixins: [vnReport], - async serverPrefetch() { - this.data = await this.findOneFromDef('data', [this.id]); - if (this.data.ticketFk) { - this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]); - this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]); - } else - this.merchandises = null; + name: 'cmr', + mixins: [vnReport], + async serverPrefetch() { + this.data = await this.findOneFromDef('data', [this.id]); + if (this.data.ticketFk) { + this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]); + this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]); + } else + this.merchandises = null; - this.senderStamp = (this.data.senderStamp) - ? `${prefixBase64} ${this.data.senderStamp.toString('base64')}` - : null; - this.deliveryStamp = (this.data.deliveryStamp) - ? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}` - : null; - }, - props: { - id: { - type: Number, - required: true, - description: 'The cmr id' - }, - }, - computed: { - signPath() { - if (!this.signature) return; + this.senderStamp = (this.data.senderStamp) + ? `${prefixBase64} ${this.data.senderStamp.toString('base64')}` + : null; + this.deliveryStamp = (this.data.deliveryStamp) + ? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}` + : null; + this.truckPlateQr = await this.getQR(this.data.truckPlate); + }, + props: { + id: { + type: Number, + required: true, + description: 'The cmr id' + }, + }, + computed: { + signPath() { + if (!this.signature) return; - const signatureName = this.signature.signature - const hash = md5(signatureName.toString()).substring(0, 3); - const file = `${config.storage.root}/${hash}/${signatureName}.png`; - if (!fs.existsSync(file)) return null; + const signatureName = this.signature.signature; + const hash = md5(signatureName.toString()).substring(0, 3); + const file = `${config.storage.root}/${hash}/${signatureName}.png`; + if (!fs.existsSync(file)) return null; - return `${prefixBase64} ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; - }, - } -}; \ No newline at end of file + return `${prefixBase64} ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; + }, + }, + methods: { + getQR(id) { + const data = String(id); + + return qrcode.toDataURL(data, {margin: 0}); + }, + } +}; diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql index 9708c4483..e9500cc4b 100644 --- a/print/templates/reports/cmr/sql/data.sql +++ b/print/templates/reports/cmr/sql/data.sql @@ -10,6 +10,7 @@ SELECT c.id cmrFk, c.merchandiseDetail, c.ead, s.name carrierName, + s.nif carrierCif, s.street carrierStreet, s.postCode carrierPostCode, s.city carrierCity, From 3736d0708bd99873b34e2d5b5a791b7c9148173c Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 29 Feb 2024 08:16:07 +0100 Subject: [PATCH 222/250] feat: refs #6401 Minor change --- print/templates/reports/cmr/cmr.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/print/templates/reports/cmr/cmr.js b/print/templates/reports/cmr/cmr.js index 2ee855ce0..ef99a08a0 100644 --- a/print/templates/reports/cmr/cmr.js +++ b/print/templates/reports/cmr/cmr.js @@ -46,9 +46,7 @@ module.exports = { }, methods: { getQR(id) { - const data = String(id); - - return qrcode.toDataURL(data, {margin: 0}); + return qrcode.toDataURL(String(id), {margin: 0}); }, } }; From 0af17fb081fcb4c3f2d1805719a9c4f7c95ae074 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 29 Feb 2024 10:22:19 +0100 Subject: [PATCH 223/250] refs #6956 deploy: init version 2412 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 302738524..3a442cac5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "salix-back", - "version": "24.10.0", + "version": "24.12.0", "author": "Verdnatura Levante SL", "description": "Salix backend", "license": "GPL-3.0", From 6e4b4537d368a0acef7ab4306c318a4478c7579c Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 29 Feb 2024 12:22:04 +0100 Subject: [PATCH 224/250] fix(style): refs #6684 add wordBreak --- .../reports/driver-route/assets/css/style.css | 11 ----------- .../templates/reports/driver-route/driver-route.html | 4 ++-- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/print/templates/reports/driver-route/assets/css/style.css b/print/templates/reports/driver-route/assets/css/style.css index 101ef7b3f..a3bcae789 100644 --- a/print/templates/reports/driver-route/assets/css/style.css +++ b/print/templates/reports/driver-route/assets/css/style.css @@ -40,17 +40,6 @@ table.repeatable > tbody > tr > td { padding-top: 0.5em; } -section.text-area { - margin-top: 1em; - padding: 0.19em; - padding-left: 1em; - padding-right: 1em; - background-color: #e5e5e5; - & > p { - word-break: break-all; - } -} - .route-block { margin-bottom: 100px; page-break-after: always; diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 1475b8e77..109afd2f5 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -128,8 +128,8 @@ -
-

{{ticket.description}}

+
+

{{ticket.description}}

From 594780d6cb57b4f0119651a6be3c34907ae37f09 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 29 Feb 2024 13:44:49 +0100 Subject: [PATCH 225/250] feat: refs #6958 delete sale_checkNoComponents --- .../vn/events/sale_checkWithoutComponents.sql | 8 --- .../vn/procedures/sale_checkNoComponents.sql | 70 ------------------- 2 files changed, 78 deletions(-) delete mode 100644 db/routines/vn/events/sale_checkWithoutComponents.sql delete mode 100644 db/routines/vn/procedures/sale_checkNoComponents.sql diff --git a/db/routines/vn/events/sale_checkWithoutComponents.sql b/db/routines/vn/events/sale_checkWithoutComponents.sql deleted file mode 100644 index 2a1ced6ca..000000000 --- a/db/routines/vn/events/sale_checkWithoutComponents.sql +++ /dev/null @@ -1,8 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`sale_checkWithoutComponents` - ON SCHEDULE EVERY 10 MINUTE - STARTS '2020-05-04 11:56:23.000' - ON COMPLETION PRESERVE - ENABLE -DO call sale_checkNoComponents(DATE_ADD(util.VN_NOW(), INTERVAL -10 MINUTE),DATE_ADD(util.VN_NOW(), INTERVAL -1 MINUTE))$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/sale_checkNoComponents.sql b/db/routines/vn/procedures/sale_checkNoComponents.sql deleted file mode 100644 index 79abbbf92..000000000 --- a/db/routines/vn/procedures/sale_checkNoComponents.sql +++ /dev/null @@ -1,70 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME) -BEGIN -/** - * Comprueba que las ventas creadas entre un rango de fechas tienen componentes - * - * @param vCreatedFrom inicio del rango - * @param vCreatedTo fin del rango - */ - DECLARE v_done BOOL DEFAULT FALSE; - DECLARE vSaleFk INTEGER; - DECLARE vTicketFk INTEGER; - DECLARE vConcept VARCHAR(50); - DECLARE vCur CURSOR FOR - SELECT s.id - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - LEFT JOIN tmp.coste c ON c.id = s.id - WHERE s.created >= vCreatedFrom AND s.created <= vCreatedTo - AND c.id IS NULL - AND t.agencyModeFk IS NOT NULL - AND t.isDeleted IS FALSE - AND t.warehouseFk = 60 - AND ic.merchandise != FALSE - GROUP BY s.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - CREATE TEMPORARY TABLE tmp.coste - (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT s.id - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - JOIN saleComponent sc ON sc.saleFk = s.id - JOIN component c ON c.id = sc.componentFk - JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 6 - WHERE s.created >= vCreatedFrom - AND ic.merchandise != FALSE; - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vSaleFk; - - IF v_done THEN - LEAVE l; - END IF; - - SELECT ticketFk, concept - INTO vTicketFk, vConcept - FROM sale - WHERE id = vSaleFk; - - CALL sale_calculateComponent(vSaleFk, 'renewPrices'); - END LOOP; - - CLOSE vCur; - DROP TEMPORARY TABLE tmp.coste; -END$$ -DELIMITER ; From 625d19e88c90a1c1c971c4c5547b156d80f6d7f6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 29 Feb 2024 13:44:58 +0100 Subject: [PATCH 226/250] hotfix: Autoincrement warehouse --- db/versions/10922-salmonCordyline/00-firstScript.sql | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/versions/10922-salmonCordyline/00-firstScript.sql diff --git a/db/versions/10922-salmonCordyline/00-firstScript.sql b/db/versions/10922-salmonCordyline/00-firstScript.sql new file mode 100644 index 000000000..37557d326 --- /dev/null +++ b/db/versions/10922-salmonCordyline/00-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.warehouse AUTO_INCREMENT=92; From f4aa5cea915eefc0b8872a41f16a72a660176f31 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 1 Mar 2024 07:32:45 +0100 Subject: [PATCH 227/250] refactor: refs #6499 Grants --- db/versions/10924-pinkCordyline/00-firstScript.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 db/versions/10924-pinkCordyline/00-firstScript.sql diff --git a/db/versions/10924-pinkCordyline/00-firstScript.sql b/db/versions/10924-pinkCordyline/00-firstScript.sql new file mode 100644 index 000000000..ea04623cd --- /dev/null +++ b/db/versions/10924-pinkCordyline/00-firstScript.sql @@ -0,0 +1,4 @@ +GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_addChild TO adminBoss; +GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_delete TO adminBoss; +GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_move TO adminBoss; +GRANT EXECUTE ON PROCEDURE vn.pay TO financial; From 1f9f10323b9b738bb2238412381b25a8b042aeb9 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 1 Mar 2024 11:21:04 +0100 Subject: [PATCH 228/250] refactor: refs #6494 Migrated and deleted residual procs --- .../procedures/confection_controlSource.sql | 112 ++++++++++++++++++ db/routines/vn/procedures/remittance_calc.sql | 70 +++++++++++ .../vn2008/procedures/CalculoRemesas.sql | 66 ----------- db/routines/vn2008/procedures/cacheReset.sql | 11 -- db/routines/vn2008/procedures/camiones.sql | 23 ---- db/routines/vn2008/procedures/cobro.sql | 79 ------------ .../procedures/confection_control_source.sql | 105 ---------------- .../10925-orangeLaurel/00-firstScript.sql | 15 +++ 8 files changed, 197 insertions(+), 284 deletions(-) create mode 100644 db/routines/vn/procedures/confection_controlSource.sql create mode 100644 db/routines/vn/procedures/remittance_calc.sql delete mode 100644 db/routines/vn2008/procedures/CalculoRemesas.sql delete mode 100644 db/routines/vn2008/procedures/cacheReset.sql delete mode 100644 db/routines/vn2008/procedures/camiones.sql delete mode 100644 db/routines/vn2008/procedures/cobro.sql delete mode 100644 db/routines/vn2008/procedures/confection_control_source.sql create mode 100644 db/versions/10925-orangeLaurel/00-firstScript.sql diff --git a/db/routines/vn/procedures/confection_controlSource.sql b/db/routines/vn/procedures/confection_controlSource.sql new file mode 100644 index 000000000..6cd43036f --- /dev/null +++ b/db/routines/vn/procedures/confection_controlSource.sql @@ -0,0 +1,112 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`confection_controlSource`( + vDated DATE, + vScopeDays INT, + vMaxAlertLevel INT, + vWarehouseFk INT +) +BEGIN +/** + * Obtiene la información para el control de confección, + * ya sean tickets y/o entradas. + * + * @param vDated Fecha a calcular + * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo. + * @param vMaxAlertLevel Id nivel de alerta + * @param vWarehouseFk Id de almacén + */ + DECLARE vMidnight DATETIME DEFAULT util.dayEnd(vDated); + DECLARE vEndingDate DATETIME DEFAULT vMidnight + INTERVAL vScopeDays DAY; + + CREATE OR REPLACE TEMPORARY TABLE tConfectionControlSource + ENGINE = MEMORY + SELECT t.shipped, + t.id ticketFk, + s.id saleFk, + s.quantity, + s.concept, + ABS(s.reserved) isReserved, + i.category, + it.name itemType, + t.nickname, + wh.name warehouse, + t.warehouseFk warehouseFk, + a.provinceFk, + am.agencyFk, + ct.description, + stock.visible, + stock.available + FROM ticket t + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN warehouse wh ON wh.id = t.warehouseFk + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN confectionType ct ON ct.id = it.making + JOIN `address` a on a.id = t.addressFk + LEFT JOIN ticketState tls on tls.ticketFk = t.id + LEFT JOIN + ( + SELECT item_id, + SUM(visible) visible, + SUM(available) available + FROM ( + SELECT a.item_id, + 0 visible, + a.available + FROM cache.cache_calc cc + LEFT JOIN cache.available a ON a.calc_id = cc.id + WHERE cc.cache_id IN ('visible', 'available') + AND cc.params = CONCAT(vWarehouseFk, "/", util.VN_CURDATE()) + UNION ALL + SELECT v.item_id, + v.visible, + 0 + FROM cache.cache_calc cc + LEFT JOIN cache.visible v ON v.calc_id = cc.id + WHERE cc.cacheName IN ('visible', 'available') + AND cc.params = vWarehouseFk + ) sub + GROUP BY item_id + ) stock ON stock.item_id = s.itemFk + WHERE it.making + AND tls.alertLevel < vMaxAlertLevel + AND wh.hasConfectionTeam + AND t.shipped BETWEEN vDated AND vEndingDate + AND s.quantity > 0; + + -- Entradas + INSERT INTO tConfectionControlSource( + shipped, + ticketFk, + quantity, + concept, + category, + nickname, + warehouse, + description + ) + SELECT tr.shipped, + e.id, + b.quantity, + i.name, + i.category, + whi.name, + who.name, + ct.description + FROM buy b + JOIN `entry` e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse whi ON whi.id = tr.warehouseInFk + JOIN warehouse who ON who.id = tr.warehouseOutFk + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN confectionType ct ON ct.id = it.making + WHERE who.hasConfectionTeam + AND it.making + AND tr.shipped BETWEEN vDated AND vEndingDate; + + SELECT * FROM tConfectionControlSource; + DROP TEMPORARY TABLE tConfectionControlSource; +END$$ +DELIMITER ; diff --git a/db/routines/vn/procedures/remittance_calc.sql b/db/routines/vn/procedures/remittance_calc.sql new file mode 100644 index 000000000..ed0a18662 --- /dev/null +++ b/db/routines/vn/procedures/remittance_calc.sql @@ -0,0 +1,70 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`remittance_calc`( + vDated DATE +) +BEGIN +/** +* Calcula los datos de remesa, incluyendo el importe, +* el vencimiento, y otros datos relevantes. +* +* @param vDated Fecha a calcular +* @return tmp.remittance +*/ + CREATE OR REPLACE TEMPORARY TABLE tmp.remittance + SELECT CONCAT(s.nif, REPEAT('0', 12 - LENGTH(s.nif))) cif, + c.id clientFk, + c.name client, + c.fi, + sub.paymentDate, + 0 invoiceAmount, + CAST(sub.receipt AS DECIMAL(10,2)) receiptAmount, + 0 currentAmount, + sub.companyFk, + c.socialName, + CAST(sub.receipt AS DECIMAL(10,2)) totalAmount, + CAST(sub.receipt AS DECIMAL(10,2)) balance, + s.name company, + co.code companyCode, + c.accountingAccount, + c.iban, + c.hasSepaVnl, + c.hasCoreVnl, + c.hasLcr, + be.bic, + be.`name` entityName + FROM client c + JOIN ( + SELECT risk.companyFk, + c.id, + SUM(risk.amount) receipt, + IF((c.dueDay + graceDays) MOD 30.001 <= DAY(vDated), + LAST_DAY(vDated - INTERVAL 1 MONTH) + INTERVAL (c.dueDay + graceDays) MOD 30.001 DAY, + LAST_DAY(vDated - INTERVAL 2 MONTH) + INTERVAL (c.dueDay + graceDays) MOD 30.001 DAY + ) paymentDate + FROM client c + JOIN payMethod pm ON pm.id = c.payMethodFk + JOIN ( + SELECT cr.companyFk, cr.clientFk, cr.amount + FROM client c + JOIN clientRisk cr ON cr.clientFk = c.id + JOIN payMethod pm ON pm.id = c.payMethodFk + WHERE pm.code = 'bankDraft' + UNION ALL + SELECT io.companyFk, io.clientFk, - io.amount + FROM invoiceOut io + JOIN client c ON c.id = io.clientFk + JOIN payMethod pm ON pm.id = c.payMethodFk + WHERE io.dued > vDated + AND pm.code = 'bankDraft' + AND pm.outstandingDebt + AND io.amount > 0 + + ) risk ON risk.clientFk = c.id + GROUP BY risk.companyFk, c.id + HAVING receipt > 10 + ) sub ON sub.id = c.id + JOIN supplier s ON s.id = sub.companyFk + JOIN company co ON co.id = sub.companyFk + LEFT JOIN bankEntity be ON be.id = c.bankEntityFk; +END$$ +DELIMITER ; diff --git a/db/routines/vn2008/procedures/CalculoRemesas.sql b/db/routines/vn2008/procedures/CalculoRemesas.sql deleted file mode 100644 index a4c191a80..000000000 --- a/db/routines/vn2008/procedures/CalculoRemesas.sql +++ /dev/null @@ -1,66 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`CalculoRemesas`(IN vFechaRemesa DATE) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS TMP_REMESAS; - CREATE TEMPORARY TABLE TMP_REMESAS - SELECT - CONCAT(p.NIF,REPEAT('0', 12-LENGTH(p.NIF))) as CIF1, - cli.Id_Cliente, - cli.Cliente, - cli.`IF` as NIF, - c.PaymentDate as Vencimiento, - 0 ImporteFac, - cast(c.Recibo as decimal(10,2)) as ImporteRec, - 0 as ImporteActual, - c.companyFk empresa_id, - cli.RazonSocial, - cast(c.Recibo as decimal(10,2)) as ImporteTotal, - cast(c.Recibo as decimal(10,2)) as Saldo, - p.Proveedor as Empresa, - e.abbreviation as EMP, - cli.cuenta, - iban AS Iban, - CONVERT(SUBSTRING(iban,5,4),UNSIGNED INT) AS nrbe, - sepavnl as SEPA, - corevnl as RecibidoCORE, - hasLcr, - be.bic, - be.`name` entityName - FROM Clientes cli - JOIN - (SELECT risk.companyFk, - c.Id_Cliente, - sum(risk.amount) as Recibo, - IF((c.Vencimiento + graceDays) mod 30.001 <= day(vFechaRemesa) - ,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-1,vFechaRemesa))) - ,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-2,vFechaRemesa))) - ) as PaymentDate - FROM Clientes c - JOIN pay_met pm on pm.id = pay_met_id - JOIN - ( - SELECT companyFk, clientFk, amount - FROM Clientes c - JOIN vn.clientRisk cr ON cr.clientFk = c.Id_Cliente - WHERE pay_met_id = 4 - - UNION ALL - - SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount - FROM vn.invoiceOut io - JOIN Clientes c ON c.Id_Cliente = io.clientFk - JOIN pay_met pm on pm.id = pay_met_id - WHERE io.dued > vFechaRemesa - AND pay_met_id = 4 AND pm.deudaviva - AND io.amount > 0 - - ) risk ON c.Id_Cliente = risk.clientFk - GROUP BY risk.companyFk, Id_Cliente - HAVING Recibo > 10 - ) c on c.Id_Cliente = cli.Id_Cliente - JOIN Proveedores p on p.Id_Proveedor = c.companyFk - JOIN empresa e on e.id = c.companyFk - LEFT JOIN vn.bankEntity be ON be.id = cli.bankEntityFk; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/cacheReset.sql b/db/routines/vn2008/procedures/cacheReset.sql deleted file mode 100644 index f36169fda..000000000 --- a/db/routines/vn2008/procedures/cacheReset.sql +++ /dev/null @@ -1,11 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`cacheReset`(vCacheName VARCHAR(10), vParams VARCHAR(15)) -BEGIN - - UPDATE cache.cache_calc - SET expires = util.VN_NOW() - WHERE cacheName = vCacheName collate utf8_unicode_ci - AND params = vParams collate utf8_unicode_ci; - -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/camiones.sql b/db/routines/vn2008/procedures/camiones.sql deleted file mode 100644 index 4c37cf9da..000000000 --- a/db/routines/vn2008/procedures/camiones.sql +++ /dev/null @@ -1,23 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`camiones`(vWarehouse INT, vDate DATE) -BEGIN - SELECT Temperatura - ,ROUND(SUM(Etiquetas * volume)) AS cm3 - ,ROUND(SUM(IF(scanned, Etiquetas, 0) * volume)) AS cm3s - ,ROUND(SUM(Vida * volume)) AS cm3e - FROM ( - SELECT t.Temperatura, c.Etiquetas, b.scanned, c.Vida, - IF(cu.Volumen > 0, cu.Volumen, cu.x * cu.y * IF(cu.z > 0, cu.z, a.Medida + 10)) volume - FROM Compres c - LEFT JOIN buy_edi b ON b.id = c.buy_edi_id - JOIN Articles a ON a.Id_Article = c.Id_Article - JOIN Tipos t ON t.tipo_id = a.tipo_id - JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel tr ON tr.id = e.travel_id - JOIN Cubos cu ON cu.Id_Cubo = c.Id_Cubo - WHERE tr.warehouse_id = vWarehouse - AND tr.landing = vDate - ) sub - GROUP BY Temperatura; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/cobro.sql b/db/routines/vn2008/procedures/cobro.sql deleted file mode 100644 index 26d906813..000000000 --- a/db/routines/vn2008/procedures/cobro.sql +++ /dev/null @@ -1,79 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`cobro`(IN datFEC DATE - , IN idCLI INT - , IN dblIMPORTE DOUBLE - , IN idCAJA INT - , IN idPAYMET INT - , IN strCONCEPTO VARCHAR(40) - , IN idEMP INT - , IN idWH INT - , IN idTRABAJADOR INT) -BEGIN - - DECLARE bolCASH BOOLEAN; - DECLARE cuenta_banco BIGINT; - DECLARE cuenta_cliente BIGINT; - DECLARE max_asien INT; - -- XDIARIO - -- No se asientan los cobros directamente, salvo en el caso de las cajas de CASH - SELECT (at2.code = 'cash') INTO bolCASH FROM Bancos b JOIN vn.accountingType at2 ON at2.id = b.cash WHERE b.Id_Banco = idCAJA; - IF bolCASH THEN - SELECT Cuenta INTO cuenta_banco - FROM Bancos - WHERE Id_Banco = idCAJA; - SELECT Cuenta INTO cuenta_cliente - FROM Clientes - WHERE Id_Cliente = idCLI; - CALL vn.ledger_next(max_asien); - INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) - SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP - FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER - UNION ALL - SELECT cuenta_cliente SUBCTA, cuenta_banco CONTRA, dblIMPORTE EURODEBE, 0 EUROHABER - ) gf; - END IF; - - -- CAJERA - INSERT INTO Cajas(Id_Trabajador, - Id_Banco, - Entrada, - Concepto, - Cajafecha, - Serie, - Partida, - Numero, - empresa_id, - warehouse_id - ) - VALUES (idTRABAJADOR, - idCAJA, - dblIMPORTE, - strCONCEPTO, - datFEC, - 'A', - TRUE, - idCLI, - idEMP, - idWH - ); - - -- RECIBO - INSERT INTO Recibos(Entregado, - Fechacobro, - Id_Trabajador, - Id_Banco, - Id_Cliente, - Id_Factura, - empresa_id - ) - VALUES ( dblIMPORTE, - datFEC, - idTRABAJADOR, - idCAJA, - idCLI, - strCONCEPTO, - idEMP - ); - -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql deleted file mode 100644 index 77b4df5f3..000000000 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ /dev/null @@ -1,105 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`confection_control_source`(vDated DATE, vScopeDays TINYINT) -BEGIN - - DECLARE vMidnight DATETIME DEFAULT TIMESTAMP(vDated,'23:59:59'); - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,vMidnight); - DECLARE maxAlertLevel INT DEFAULT 2; - - DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; - - CREATE TEMPORARY TABLE tmp.production_buffer - ENGINE = MEMORY - SELECT - date(t.Fecha) as Fecha, - hour(t.Fecha) as Hora, - hour(t.Fecha) as Departure, - t.Id_Ticket, - m.Id_Movimiento, - m.Cantidad, - m.Concepte, - ABS(m.Reservado) Reservado, - i.Categoria, - tp.Tipo, - t.Alias as Cliente, - wh.name as Almacen, - t.warehouse_id, - cs.province_id, - a.agency_id, - ct.description as Taller, - stock.visible, - stock.available - FROM vn2008.Tickets t - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn.warehouse wh ON wh.id = t.warehouse_id - JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket - JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article - JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id - JOIN vn.confectionType ct ON ct.id = tp.confeccion - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - LEFT JOIN vn.ticketState tls on tls.ticketFk = t.Id_Ticket - LEFT JOIN - ( - SELECT item_id, sum(visible) visible, sum(available) available - FROM - ( - SELECT a.item_id, 0 as visible, a.available - FROM cache.cache_calc cc - LEFT JOIN cache.available a ON a.calc_id = cc.id - WHERE cc.cache_id IN (2,8) - AND cc.params IN (concat("1/", util.VN_CURDATE()),concat("44/", util.VN_CURDATE())) - - UNION ALL - - SELECT v.item_id, v.visible, 0 as available - FROM cache.cache_calc cc - LEFT JOIN cache.visible v ON v.calc_id = cc.id - where cc.cache_id IN (2,8) and cc.params IN ("1","44") - ) sub - GROUP BY item_id - ) stock ON stock.item_id = m.Id_Article - WHERE tp.confeccion - AND tls.alertLevel < maxAlertLevel - AND wh.hasConfectionTeam - AND t.Fecha BETWEEN vDated AND vEndingDate - AND m.Cantidad > 0; - - -- Entradas - - INSERT INTO tmp.production_buffer( - Fecha, - Id_Ticket, - Cantidad, - Concepte, - Categoria, - Cliente, - Almacen, - Taller - ) - SELECT - tr.shipment AS Fecha, - e.Id_Entrada AS Id_Ticket, - c.Cantidad, - a.Article, - a.Categoria, - whi.name as Cliente, - who.name as Almacen, - ct.description as Taller - FROM vn2008.Compres c - JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN vn2008.travel tr ON tr.id = e.travel_id - JOIN vn.warehouse whi ON whi.id = tr.warehouse_id - JOIN vn.warehouse who ON who.id = tr.warehouse_id_out - JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id - JOIN vn.confectionType ct ON ct.id = tp.confeccion - WHERE who.hasConfectionTeam - AND tp.confeccion - AND tr.shipment BETWEEN vDated AND vEndingDate; - - - SELECT * FROM tmp.production_buffer; - - -END$$ -DELIMITER ; diff --git a/db/versions/10925-orangeLaurel/00-firstScript.sql b/db/versions/10925-orangeLaurel/00-firstScript.sql new file mode 100644 index 000000000..049627082 --- /dev/null +++ b/db/versions/10925-orangeLaurel/00-firstScript.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`confection_controlSource`() +BEGIN + SELECT 1; +END$$ +DELIMITER ; +GRANT EXECUTE ON PROCEDURE vn.confection_controlSource TO handmadeBoss, productionAssi, artificialBoss; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`remittance_calc`() +BEGIN + SELECT 1; +END$$ +DELIMITER ; +GRANT EXECUTE ON PROCEDURE vn.remittance_calc TO financial; \ No newline at end of file From 97f76c64ffd99b0abfbbdb15b8b693196e65cc3a Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 1 Mar 2024 13:35:07 +0100 Subject: [PATCH 229/250] refactor: refs #6276 drop sendRocket method --- back/methods/collection/getSales.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/back/methods/collection/getSales.js b/back/methods/collection/getSales.js index cf0496600..a5e7aeefa 100644 --- a/back/methods/collection/getSales.js +++ b/back/methods/collection/getSales.js @@ -58,24 +58,22 @@ module.exports = Self => { if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions); - if (tickets.length) await sendRocketTickets(tickets, $t); - - return getCollection(id, tickets, sales, placements, myOptions); - }; - async function sendRocketTickets(tickets, $t) { for (let ticket of tickets) { let observations = ticket.observaciones.split(' '); for (let observation of observations) { const salesPerson = ticket.salesPersonFk; - if (!observation.startsWith('#') && !observation.startsWith('@')) return; - await models.Chat.send(ctx, - observation, - $t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson}) - ); + if (observation.startsWith('#') || observation.startsWith('@')) { + await models.Chat.send(ctx, + observation, + $t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson}) + ); + } } } - } + + return getCollection(id, tickets, sales, placements, myOptions); + }; async function getCollection(id, tickets, sales, placements, options) { const collection = { From a3052c1cf98c325ceee9d2437e3d3bdc6f3ee398 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 1 Mar 2024 15:05:12 +0100 Subject: [PATCH 230/250] refs #6925 hotFix(invoice) parenthesis & handle incoterms error --- db/routines/vn/procedures/ticket_closeByTicket.sql | 2 +- loopback/locale/es.json | 5 +++-- .../reports/invoice-incoterms/invoice-incoterms.js | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/ticket_closeByTicket.sql b/db/routines/vn/procedures/ticket_closeByTicket.sql index 93772225b..6e32a3e76 100644 --- a/db/routines/vn/procedures/ticket_closeByTicket.sql +++ b/db/routines/vn/procedures/ticket_closeByTicket.sql @@ -15,7 +15,7 @@ BEGIN JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN ticketState ts ON ts.ticketFk = t.id JOIN alertLevel al ON al.id = ts.alertLevel - WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered') + WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')) AND t.id = vTicketFk AND t.refFk IS NULL GROUP BY t.id); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index b14358e85..49283e633 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -344,5 +344,6 @@ "CountryFK cannot be empty": "El país no puede estar vacío", "Cmr file does not exist": "El archivo del cmr no existe", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias", - "No tickets to invoice": "No hay tickets para facturar" -} \ No newline at end of file + "No tickets to invoice": "No hay tickets para facturar", + "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" +} diff --git a/print/templates/reports/invoice-incoterms/invoice-incoterms.js b/print/templates/reports/invoice-incoterms/invoice-incoterms.js index 9cc2600af..cfe29169b 100755 --- a/print/templates/reports/invoice-incoterms/invoice-incoterms.js +++ b/print/templates/reports/invoice-incoterms/invoice-incoterms.js @@ -1,4 +1,5 @@ const vnReport = require('../../../core/mixins/vn-report.js'); +const UserError = require('vn-loopback/util/user-error'); module.exports = { name: 'invoice-incoterms', @@ -7,7 +8,10 @@ module.exports = { this.invoice = await this.findOneFromDef('invoice', [this.reference]); this.checkMainEntity(this.invoice); this.client = await this.findOneFromDef('client', [this.reference]); - this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]); + this.incoterms = + await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]); + if (!this.incoterms) + throw new UserError(`The address of the customer must have information about Incoterms and Customs Agent`); }, props: { reference: { From 28dbb200fcb51350b641c4e462cfd6ece24549fc Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 4 Mar 2024 08:38:24 +0100 Subject: [PATCH 231/250] refactor: refs #6874 Proc itemProposal --- db/routines/vn/procedures/itemProposal.sql | 97 ++++++++++++++-------- 1 file changed, 63 insertions(+), 34 deletions(-) diff --git a/db/routines/vn/procedures/itemProposal.sql b/db/routines/vn/procedures/itemProposal.sql index 74d356d77..cc58715ad 100644 --- a/db/routines/vn/procedures/itemProposal.sql +++ b/db/routines/vn/procedures/itemProposal.sql @@ -1,19 +1,23 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal`(vItemFk INT, vTicketFk INT,vShowType BOOL) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal`( + vItemFk INT, + vTicketFk INT, + vShowType BOOL +) BEGIN - /** - * Propone articulos disponible ordenado, con la cantidad de veces usado y segun sus caracteristicas - * - * @param vItemFk item id - * @param vTicketFk ticket id - * @param vShowType mostrar tipos - */ - +* Propone articulos disponibles ordenados, con la cantidad +* de veces usado y segun sus caracteristicas. +* +* @param vItemFk Id de artículo +* @param vTicketFk Id de ticket +* @param vShowType Mostrar tipos +*/ DECLARE vWarehouseFk INT; DECLARE vShipped DATE; DECLARE vCalcFk INT; DECLARE vTypeFk INT; + DECLARE vPriority INT DEFAULT 1; DECLARE vTag1 VARCHAR(25); DECLARE vTag5 VARCHAR(25); @@ -27,15 +31,37 @@ BEGIN DECLARE vValue7 VARCHAR(50); DECLARE vValue8 VARCHAR(50); - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket + SELECT warehouseFk, shipped + INTO vWarehouseFk, vShipped + FROM ticket WHERE id = vTicketFk; - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + SELECT typeFk, + tag5, + value5, + tag6, + value6, + tag7, + value7, + tag8, + value8, + t.name, + it.value + INTO vTypeFk, + vTag5, + vValue5, + vTag6, + vValue6, + vTag7, + vValue7, + vTag8, + vValue8, + vTag1, + vValue1 + FROM item i + LEFT JOIN itemTag it ON it.itemFk = i.id + AND it.priority = vPriority + LEFT JOIN tag t ON t.id = it.tagFk WHERE i.id = vItemFk; CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); @@ -56,32 +82,35 @@ BEGIN i.value8, (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, a.available, - IFNULL(ip.counter,0) counter, - IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity, + IFNULL(ip.counter, 0) `counter`, + IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity, iss.visible located FROM item i JOIN cache.available a ON a.item_id = i.id - LEFT JOIN itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN tag t1 ON t1.id = it1.tagFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN itemProposal ip ON ip.mateFk = i.id + AND ip.itemFk = vItemFk + LEFT JOIN itemTag it ON it.itemFk = i.id + AND it.priority = vPriority + LEFT JOIN tag t ON t.id = it.tagFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id + AND lb.warehouse_id = vWarehouseFk LEFT JOIN buy b ON b.id = lb.buy_id - LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id AND iss.warehouseFk = vWarehouseFk + LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id + AND iss.warehouseFk = vWarehouseFk WHERE a.calc_id = vCalcFk - AND available > 0 - AND IF(vShowType,i.typeFk = vTypeFk,true) - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1 COLLATE utf8_general_ci) DESC, - (it1.value = vValue1 COLLATE utf8_general_ci) DESC, + AND a.available > 0 + AND IF(vShowType, i.typeFk = vTypeFk, TRUE) + AND i.id <> vItemFk + ORDER BY `counter` DESC, + (t.name = vTag1 COLLATE utf8_general_ci) DESC, + (it.value = vValue1 COLLATE utf8_general_ci) DESC, (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, + match5 DESC, (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, + match6 DESC, (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, + match7 DESC, (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) DESC; - + match8 DESC; END$$ DELIMITER ; From bd5d88f5ef1a6163c9a289caa904f56db7c88eaa Mon Sep 17 00:00:00 2001 From: ivanm Date: Mon, 4 Mar 2024 08:41:09 +0100 Subject: [PATCH 232/250] refs #6969 Error packaging --- db/routines/vn/procedures/buyUltimateFromInterval.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/routines/vn/procedures/buyUltimateFromInterval.sql b/db/routines/vn/procedures/buyUltimateFromInterval.sql index 92434a47b..f78174482 100644 --- a/db/routines/vn/procedures/buyUltimateFromInterval.sql +++ b/db/routines/vn/procedures/buyUltimateFromInterval.sql @@ -39,7 +39,6 @@ BEGIN WHERE t.landed BETWEEN vStarted AND vEnded AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) AND b.price2 > 0 - AND b.quantity > 0 ORDER BY NOT b.isIgnored DESC, t.landed DESC, b.id DESC LIMIT 10000000000000000000) sub GROUP BY itemFk, warehouseFk; From 854a9b62af94160de9933c74e7d21a54407aa6cf Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 4 Mar 2024 09:21:41 +0100 Subject: [PATCH 233/250] fix: refs #6276 refactor updateInTime & changes --- back/methods/machine-worker/updateInTime.js | 10 +++++----- modules/item/back/methods/item-barcode/delete.js | 2 +- .../item/back/methods/item-shelving/getAlternative.js | 4 ++-- .../methods/item-shelving/specs/getAlternative.spec.js | 2 +- modules/ticket/back/methods/sale-tracking/setPicked.js | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/back/methods/machine-worker/updateInTime.js b/back/methods/machine-worker/updateInTime.js index cfeda4425..8f663302d 100644 --- a/back/methods/machine-worker/updateInTime.js +++ b/back/methods/machine-worker/updateInTime.js @@ -47,9 +47,10 @@ module.exports = Self => { } }, myOptions); + const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); + const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); + if (machineWorker) { - const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions); - const hoursDifference = (Date.vnNow() - machineWorker.inTime.getTime()) / (60 * 60 * 1000); const isHimself = userId == machineWorker.workerFk; const isSameMachine = machine.id == machineWorker.machineFk; @@ -62,10 +63,9 @@ module.exports = Self => { await machineWorker.updateAttributes({ outTime: Date.vnNew() }, myOptions); + } - if (hoursDifference >= maxHours) - await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); - } else + if (!machineWorker || hoursDifference >= maxHours) await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions); if (tx) await tx.commit(); diff --git a/modules/item/back/methods/item-barcode/delete.js b/modules/item/back/methods/item-barcode/delete.js index b27782b1b..0eea651d3 100644 --- a/modules/item/back/methods/item-barcode/delete.js +++ b/modules/item/back/methods/item-barcode/delete.js @@ -1,7 +1,7 @@ module.exports = Self => { Self.remoteMethod('delete', { description: 'Delete an ItemBarcode by itemFk and code', - accessType: 'READ', + accessType: 'WRITE', accepts: [ { arg: 'barcode', diff --git a/modules/item/back/methods/item-shelving/getAlternative.js b/modules/item/back/methods/item-shelving/getAlternative.js index dd497d580..8108bfa6e 100644 --- a/modules/item/back/methods/item-shelving/getAlternative.js +++ b/modules/item/back/methods/item-shelving/getAlternative.js @@ -47,7 +47,7 @@ module.exports = Self => { return itemShelvings.map(itemShelving => { const item = itemShelving.item(); - const carros = alternatives.filter(alternative => alternative.itemFk == itemShelving.itemFk); + const shelvings = alternatives.filter(alternative => alternative.itemFk == itemShelving.itemFk); return { id: itemShelving.id, @@ -56,7 +56,7 @@ module.exports = Self => { size: item.size, longName: item.longName, quantity: itemShelving.visible, - carros + shelvings }; }); } diff --git a/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js b/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js index 8c8d8a33d..3f4917477 100644 --- a/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js +++ b/modules/item/back/methods/item-shelving/specs/getAlternative.spec.js @@ -13,7 +13,7 @@ describe('itemShelving getAlternative()', () => { const shelvingFk = 'HEJ'; const itemShelvings = await models.ItemShelving.getAlternative(shelvingFk); - expect(itemShelvings[0].carros.length).toEqual(0); + expect(itemShelvings[0].shelvings.length).toEqual(0); }); it('should return an empty list', async() => { diff --git a/modules/ticket/back/methods/sale-tracking/setPicked.js b/modules/ticket/back/methods/sale-tracking/setPicked.js index 990768197..828f6eb7e 100644 --- a/modules/ticket/back/methods/sale-tracking/setPicked.js +++ b/modules/ticket/back/methods/sale-tracking/setPicked.js @@ -73,7 +73,7 @@ module.exports = Self => { userFk: userId }, myOptions); - const itemShelving = await models.ItemShelving.findById(itemShelvingFk, myOptions); + const itemShelving = await models.ItemShelving.findById(itemShelvingFk, null, myOptions); await itemShelving.updateAttributes({visible: itemShelving.visible - quantity}, myOptions); @@ -86,8 +86,8 @@ module.exports = Self => { await Self.updateTracking(ctx, saleFk, originalQuantity, code, isChecked, null, isScanned, myOptions); try { - const buy = await models.Buy.findById(buyFk, myOptions); - if (buy.itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); + const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions); + if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); } catch (e) { throw new UserError('The sale cannot be tracked'); } From 9cff06ae3d9718417996bad6238c208f5a08376a Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 4 Mar 2024 09:30:07 +0100 Subject: [PATCH 234/250] feat: refs #6276 acl itemBarcode delete --- db/versions/10832-purpleAralia/00-newWareHouse.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/versions/10832-purpleAralia/00-newWareHouse.sql b/db/versions/10832-purpleAralia/00-newWareHouse.sql index 448c69322..dd2c16bdb 100644 --- a/db/versions/10832-purpleAralia/00-newWareHouse.sql +++ b/db/versions/10832-purpleAralia/00-newWareHouse.sql @@ -8,4 +8,5 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp ('SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'), ('SaleTracking','setPicked','WRITE','ALLOW','ROLE','production'), ('ExpeditionPallet', '*', 'READ', 'ALLOW', 'ROLE', 'production'), - ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file + ('Sale', 'getFromSectorCollection', 'READ', 'ALLOW', 'ROLE', 'production'), + ('ItemBarcode', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'production'); \ No newline at end of file From cf810fe4977e42d0de9a46334132eecb9d623e9f Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 4 Mar 2024 13:14:41 +0100 Subject: [PATCH 235/250] refactor: refs #6874 Proc itemProposal --- db/routines/vn/procedures/itemProposal.sql | 116 ------------- .../vn/procedures/itemProposal_beta.sql | 76 -------- db/routines/vn/procedures/item_getSimilar.sql | 162 +++++++++++------- 3 files changed, 97 insertions(+), 257 deletions(-) delete mode 100644 db/routines/vn/procedures/itemProposal.sql delete mode 100644 db/routines/vn/procedures/itemProposal_beta.sql diff --git a/db/routines/vn/procedures/itemProposal.sql b/db/routines/vn/procedures/itemProposal.sql deleted file mode 100644 index cc58715ad..000000000 --- a/db/routines/vn/procedures/itemProposal.sql +++ /dev/null @@ -1,116 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal`( - vItemFk INT, - vTicketFk INT, - vShowType BOOL -) -BEGIN -/** -* Propone articulos disponibles ordenados, con la cantidad -* de veces usado y segun sus caracteristicas. -* -* @param vItemFk Id de artículo -* @param vTicketFk Id de ticket -* @param vShowType Mostrar tipos -*/ - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - DECLARE vPriority INT DEFAULT 1; - - DECLARE vTag1 VARCHAR(25); - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); - - DECLARE vValue1 VARCHAR(50); - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped - INTO vWarehouseFk, vShipped - FROM ticket - WHERE id = vTicketFk; - - SELECT typeFk, - tag5, - value5, - tag6, - value6, - tag7, - value7, - tag8, - value8, - t.name, - it.value - INTO vTypeFk, - vTag5, - vValue5, - vTag6, - vValue6, - vTag7, - vValue7, - vTag8, - vValue8, - vTag1, - vValue1 - FROM item i - LEFT JOIN itemTag it ON it.itemFk = i.id - AND it.priority = vPriority - LEFT JOIN tag t ON t.id = it.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, - a.available, - IFNULL(ip.counter, 0) `counter`, - IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity, - iss.visible located - FROM item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN itemProposal ip ON ip.mateFk = i.id - AND ip.itemFk = vItemFk - LEFT JOIN itemTag it ON it.itemFk = i.id - AND it.priority = vPriority - LEFT JOIN tag t ON t.id = it.tagFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id - AND lb.warehouse_id = vWarehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id - LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id - AND iss.warehouseFk = vWarehouseFk - WHERE a.calc_id = vCalcFk - AND a.available > 0 - AND IF(vShowType, i.typeFk = vTypeFk, TRUE) - AND i.id <> vItemFk - ORDER BY `counter` DESC, - (t.name = vTag1 COLLATE utf8_general_ci) DESC, - (it.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - match5 DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - match6 DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - match7 DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - match8 DESC; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/itemProposal_beta.sql b/db/routines/vn/procedures/itemProposal_beta.sql deleted file mode 100644 index 4a6f761a9..000000000 --- a/db/routines/vn/procedures/itemProposal_beta.sql +++ /dev/null @@ -1,76 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal_beta`(vItemFk INT, vTicketFk INT) -BEGIN - - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - DECLARE vResultsMax INT DEFAULT 10; - - DECLARE vTag1 VARCHAR(25); - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); - - DECLARE vValue1 VARCHAR(50); - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, - a.available, - IFNULL(ip.counter,0) counter - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE a.calc_id = vCalcFk - AND available > 0 - AND i.typeFk = vTypeFk - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1 COLLATE utf8_general_ci) DESC, - (it1.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) DESC - LIMIT vResultsMax; - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index 7cc9ad63e..2522280f7 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -1,20 +1,24 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getSimilar`(vItemFk INT, vWarehouseFk INT, vDate DATE, vIsShowedByType BOOL) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getSimilar`( + vSelf INT, + vTicketFk INT, + vShowType BOOL +) BEGIN - /** - * Propone articulos similares para posible cambio, - * ordenado con la cantidad de veces usado y segun sus caracteristicas - * - * @param vItemFk item id - * @param vWarehouseFk warehouse id - * @param vDate fecha para revisar disponible - * @param vIsShowedByType para mostrar solo artículos de ese tipo - */ +* Propone articulos disponibles ordenados, con la cantidad +* de veces usado y segun sus caracteristicas. +* +* @param vSelf Id de artículo +* @param vTicketFk Id de ticket +* @param vShowType Mostrar tipos +*/ + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vCalcFk INT; + DECLARE vTypeFk INT; + DECLARE vPriority INT DEFAULT 1; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; @@ -27,58 +31,86 @@ BEGIN DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDate); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8) match8, - a.available, - IFNULL(ip.counter,0) counter, - IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - WHERE a.calc_id = vCalcFk - AND available > 0 - AND IF(vIsShowedByType, i.typeFk = vTypeFk, TRUE) - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1) DESC, - (it1.value = vValue1) DESC, - (i.tag6 = vTag6) DESC, - (i.value6 = vValue6) DESC, - (i.tag5 = vTag5) DESC, - (i.value5 = vValue5) DESC, - (i.tag7 = vTag7) DESC, - (i.value7 = vValue7) DESC, - (i.tag8 = vTag8) DESC, - (i.value8 = vValue8) DESC - LIMIT 30; - + SELECT warehouseFk, shipped + INTO vWarehouseFk, vShipped + FROM ticket + WHERE id = vTicketFk; + SELECT typeFk, + tag5, + value5, + tag6, + value6, + tag7, + value7, + tag8, + value8, + t.name, + it.value + INTO vTypeFk, + vTag5, + vValue5, + vTag6, + vValue6, + vTag7, + vValue7, + vTag8, + vValue8, + vTag1, + vValue1 + FROM item i + LEFT JOIN itemTag it ON it.itemFk = i.id + AND it.priority = vPriority + LEFT JOIN tag t ON t.id = it.tagFk + WHERE i.id = vSelf; + + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); + + SELECT i.id itemFk, + i.longName, + i.subName, + i.tag5, + i.value5, + (i.value5 <=> vValue5) match5, + i.tag6, + i.value6, + (i.value6 <=> vValue6) match6, + i.tag7, + i.value7, + (i.value7 <=> vValue7) match7, + i.tag8, + i.value8, + (i.value8 <=> vValue8) match8, + a.available, + IFNULL(ip.counter, 0) `counter`, + IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity, + iss.visible located + FROM item i + JOIN cache.available a ON a.item_id = i.id + LEFT JOIN itemProposal ip ON ip.mateFk = i.id + AND ip.itemFk = vSelf + LEFT JOIN itemTag it ON it.itemFk = i.id + AND it.priority = vPriority + LEFT JOIN tag t ON t.id = it.tagFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id + AND lb.warehouse_id = vWarehouseFk + LEFT JOIN buy b ON b.id = lb.buy_id + LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id + AND iss.warehouseFk = vWarehouseFk + WHERE a.calc_id = vCalcFk + AND a.available > 0 + AND IF(vShowType, i.typeFk = vTypeFk, TRUE) + AND i.id <> vSelf + ORDER BY `counter` DESC, + (t.name = vTag1) DESC, + (it.value = vValue1) DESC, + (i.tag5 = vTag5) DESC, + match5 DESC, + (i.tag6 = vTag6) DESC, + match6 DESC, + (i.tag7 = vTag7) DESC, + match7 DESC, + (i.tag8 = vTag8) DESC, + match8 DESC; END$$ DELIMITER ; From a96743c3b96c81be2ee2a742de056c302c26acac Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 4 Mar 2024 13:34:42 +0100 Subject: [PATCH 236/250] refactor: refs #6494 Requested changes --- .../procedures/confection_controlSource.sql | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/db/routines/vn/procedures/confection_controlSource.sql b/db/routines/vn/procedures/confection_controlSource.sql index 6cd43036f..f011a52e9 100644 --- a/db/routines/vn/procedures/confection_controlSource.sql +++ b/db/routines/vn/procedures/confection_controlSource.sql @@ -15,11 +15,8 @@ BEGIN * @param vMaxAlertLevel Id nivel de alerta * @param vWarehouseFk Id de almacén */ - DECLARE vMidnight DATETIME DEFAULT util.dayEnd(vDated); - DECLARE vEndingDate DATETIME DEFAULT vMidnight + INTERVAL vScopeDays DAY; + DECLARE vEndingDate DATETIME DEFAULT util.dayEnd(vDated) + INTERVAL vScopeDays DAY; - CREATE OR REPLACE TEMPORARY TABLE tConfectionControlSource - ENGINE = MEMORY SELECT t.shipped, t.id ticketFk, s.id saleFk, @@ -73,27 +70,24 @@ BEGIN AND tls.alertLevel < vMaxAlertLevel AND wh.hasConfectionTeam AND t.shipped BETWEEN vDated AND vEndingDate - AND s.quantity > 0; - - -- Entradas - INSERT INTO tConfectionControlSource( - shipped, - ticketFk, - quantity, - concept, - category, - nickname, - warehouse, - description - ) + AND s.quantity > 0 + UNION ALL SELECT tr.shipped, e.id, + NULL, b.quantity, i.name, + NULL, i.category, + NULL, whi.name, who.name, - ct.description + NULL, + NULL, + NULL, + ct.description, + NULL, + NULL FROM buy b JOIN `entry` e ON e.id = b.entryFk JOIN travel tr ON tr.id = e.travelFk @@ -105,8 +99,5 @@ BEGIN WHERE who.hasConfectionTeam AND it.making AND tr.shipped BETWEEN vDated AND vEndingDate; - - SELECT * FROM tConfectionControlSource; - DROP TEMPORARY TABLE tConfectionControlSource; END$$ DELIMITER ; From fa70eeb75c78b95960c0ce265e038d77f52c4b2b Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 4 Mar 2024 13:42:11 +0100 Subject: [PATCH 237/250] refactor: refs #6499 Requested changes --- .../procedures/{pay.sql => payment_add.sql} | 5 ++-- .../10924-pinkCordyline/00-firstScript.sql | 29 ++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) rename db/routines/vn/procedures/{pay.sql => payment_add.sql} (93%) diff --git a/db/routines/vn/procedures/pay.sql b/db/routines/vn/procedures/payment_add.sql similarity index 93% rename from db/routines/vn/procedures/pay.sql rename to db/routines/vn/procedures/payment_add.sql index 2ef9ca2d6..061a75848 100644 --- a/db/routines/vn/procedures/pay.sql +++ b/db/routines/vn/procedures/payment_add.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`pay`( +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`payment_add`( vDated DATE, vSupplierFk INT, vAmount DOUBLE, @@ -12,7 +12,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`pay`( vCompanyFk INT) BEGIN /** - * Registra un pago realizado a un proveedor. + * Registra un pago realizado a un proveedor y + * su correspondiente registro en caja. * * @param vDated Fecha del pago * @param vSupplierFk Id del proveedor diff --git a/db/versions/10924-pinkCordyline/00-firstScript.sql b/db/versions/10924-pinkCordyline/00-firstScript.sql index ea04623cd..1c6c1c0f8 100644 --- a/db/versions/10924-pinkCordyline/00-firstScript.sql +++ b/db/versions/10924-pinkCordyline/00-firstScript.sql @@ -1,4 +1,31 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`() +BEGIN + SELECT 1; +END$$ +DELIMITER ; GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_addChild TO adminBoss; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`() +BEGIN + SELECT 1; +END$$ +DELIMITER ; GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_delete TO adminBoss; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`() +BEGIN + SELECT 1; +END$$ +DELIMITER ; GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_move TO adminBoss; -GRANT EXECUTE ON PROCEDURE vn.pay TO financial; + +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`payment_add`() +BEGIN + SELECT 1; +END$$ +DELIMITER ; +GRANT EXECUTE ON PROCEDURE vn.payment_add TO financial; From b761c258a1589fa11e312a99484c59dbdd2cf7d5 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 4 Mar 2024 14:12:56 +0100 Subject: [PATCH 238/250] refs #6336 feat(claimState): delete without using --- db/dump/fixtures.before.sql | 11 ++++------- db/versions/10926-limeFern/00-refactorClaimState.sql | 8 ++++++++ e2e/paths/06-claim/01_basic_data.spec.js | 4 ++-- .../back/methods/claim-state/specs/isEditable.spec.js | 2 +- .../methods/claim/specs/updateClaimAction.spec.js | 2 +- 5 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 db/versions/10926-limeFern/00-refactorClaimState.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index aef0f13e3..c7f177742 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1819,19 +1819,16 @@ INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`, `hasToNotify`) VALUES ( 1, 'pending', 'Pendiente', 1, 1, 0), - ( 2, 'managed', 'Gestionado', 72, 5, 0), ( 3, 'resolved', 'Resuelto', 72, 7, 0), ( 4, 'canceled', 'Anulado', 72, 6, 1), - ( 5, 'incomplete', 'Incompleta', 1, 3, 1), - ( 6, 'mana', 'Mana', 72, 4, 0), - ( 7, 'lack', 'Faltas', 72, 2, 0); + ( 5, 'incomplete', 'Incompleta', 1, 3, 1); INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `ticketFk`) VALUES (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, 11), - (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, 16), - (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, 7), - (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, 8); + (2, util.VN_CURDATE(), 4, 1101, 18, 3, 0, util.VN_CURDATE(), 1, 16), + (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, 7), + (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, 8); INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) VALUES diff --git a/db/versions/10926-limeFern/00-refactorClaimState.sql b/db/versions/10926-limeFern/00-refactorClaimState.sql new file mode 100644 index 000000000..bb2dc349a --- /dev/null +++ b/db/versions/10926-limeFern/00-refactorClaimState.sql @@ -0,0 +1,8 @@ +UPDATE vn.claim c + JOIN vn.claimState cs ON cs.id = c.claimStateFk + JOIN vn.claimState ns ON ns.code = 'resolved' + SET c.claimStateFk = ns.id + WHERE cs.code IN ('managed', 'mana', 'lack', 'relocation'); + +DELETE FROM vn.claimState + WHERE code IN ('managed', 'mana', 'lack', 'relocation'); diff --git a/e2e/paths/06-claim/01_basic_data.spec.js b/e2e/paths/06-claim/01_basic_data.spec.js index 0a08cad9f..2df95bd4a 100644 --- a/e2e/paths/06-claim/01_basic_data.spec.js +++ b/e2e/paths/06-claim/01_basic_data.spec.js @@ -21,7 +21,7 @@ describe('Claim edit basic data path', () => { }); it(`should edit claim state and observation fields`, async() => { - await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Gestionado'); + await page.autocompleteSearch(selectors.claimBasicData.claimState, 'Resuelto'); await page.clearInput(selectors.claimBasicData.packages); await page.write(selectors.claimBasicData.packages, '2'); await page.waitToClick(selectors.claimBasicData.saveButton); @@ -48,7 +48,7 @@ describe('Claim edit basic data path', () => { await page.waitForSelector(selectors.claimBasicData.claimState); const result = await page.waitToGetProperty(selectors.claimBasicData.claimState, 'value'); - expect(result).toEqual('Gestionado'); + expect(result).toEqual('Resuelto'); }); it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => { diff --git a/modules/claim/back/methods/claim-state/specs/isEditable.spec.js b/modules/claim/back/methods/claim-state/specs/isEditable.spec.js index 1fb8e1536..6d97eed06 100644 --- a/modules/claim/back/methods/claim-state/specs/isEditable.spec.js +++ b/modules/claim/back/methods/claim-state/specs/isEditable.spec.js @@ -64,7 +64,7 @@ describe('claimstate isEditable()', () => { const options = {transaction: tx}; const ctx = {req: {accessToken: {userId: claimManagerId}}}; - const result = await app.models.ClaimState.isEditable(ctx, 7, options); + const result = await app.models.ClaimState.isEditable(ctx, 5, options); expect(result).toEqual(true); diff --git a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js index 2f16d002c..99436fed6 100644 --- a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js @@ -21,7 +21,7 @@ describe('Update Claim', () => { clientFk: 1101, ticketCreated: newDate, workerFk: 18, - claimStateFk: 2, + claimStateFk: 1, isChargedToMana: true, responsibility: 4, observation: 'observation' From d979e36686e7db370c6ded1a1afd47c5be12631b Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 4 Mar 2024 14:13:37 +0100 Subject: [PATCH 239/250] refs #6336 feat(claimState): delete without using & refactor: unnecessary test --- .../methods/claim/specs/updateClaim.spec.js | 126 +----------------- 1 file changed, 4 insertions(+), 122 deletions(-) diff --git a/modules/claim/back/methods/claim/specs/updateClaim.spec.js b/modules/claim/back/methods/claim/specs/updateClaim.spec.js index e2d5fcfeb..bd77ae406 100644 --- a/modules/claim/back/methods/claim/specs/updateClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaim.spec.js @@ -21,12 +21,13 @@ describe('Update Claim', () => { claimStatesMap = claimStates.reduce((acc, state) => ({...acc, [state.code]: state.id}), {}); }); const newDate = Date.vnNew(); + const claimManagerId = 72; const originalData = { ticketFk: 3, clientFk: 1101, ticketCreated: newDate, workerFk: 18, - claimStateFk: 2, + claimStateFk: 5, isChargedToMana: true, responsibility: 4, observation: 'observation' @@ -77,7 +78,6 @@ describe('Update Claim', () => { spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); const pendingState = claimStatesMap.pending; - const claimManagerId = 72; const ctx = { req: { accessToken: {userId: claimManagerId}, @@ -104,85 +104,7 @@ describe('Update Claim', () => { } }); - it(`should success to update the claimState to 'managed' and send a rocket message`, async() => { - const tx = await app.models.Claim.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const newClaim = await app.models.Claim.create(originalData, options); - - const chatModel = app.models.Chat; - spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); - - const managedState = claimStatesMap.managed; - const claimManagerId = 72; - const ctx = { - req: { - accessToken: {userId: claimManagerId}, - headers: {origin: url} - }, - args: { - observation: 'valid observation', - claimStateFk: managedState, - hasToPickUp: false - } - }; - ctx.req.__ = i18n.__; - await app.models.Claim.updateClaim(ctx, newClaim.id, options); - - let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options); - - expect(updatedClaim.observation).toEqual(ctx.args.observation); - expect(chatModel.sendCheckingPresence).toHaveBeenCalled(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it(`should success to update the claimState to 'resolved' and send a rocket message`, async() => { - const tx = await app.models.Claim.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const newClaim = await app.models.Claim.create(originalData, options); - - const chatModel = app.models.Chat; - spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); - - const resolvedState = claimStatesMap.resolved; - const claimManagerId = 72; - const ctx = { - req: { - accessToken: {userId: claimManagerId}, - headers: {origin: url} - }, - args: { - observation: 'valid observation', - claimStateFk: resolvedState, - hasToPickUp: false - } - }; - ctx.req.__ = i18n.__; - await app.models.Claim.updateClaim(ctx, newClaim.id, options); - - let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options); - - expect(updatedClaim.observation).toEqual(ctx.args.observation); - expect(chatModel.sendCheckingPresence).toHaveBeenCalled(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it(`should success to update the claimState to 'canceled' and send a rocket message`, async() => { + it(`should success to update the claimState to 'canceled' and send two rocket message`, async() => { const tx = await app.models.Claim.beginTransaction({}); try { @@ -194,7 +116,6 @@ describe('Update Claim', () => { spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); const canceledState = claimStatesMap.canceled; - const claimManagerId = 72; const ctx = { req: { accessToken: {userId: claimManagerId}, @@ -212,46 +133,7 @@ describe('Update Claim', () => { let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options); expect(updatedClaim.observation).toEqual(ctx.args.observation); - expect(chatModel.sendCheckingPresence).toHaveBeenCalled(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); - - it(`should success to update the claimState to 'incomplete' and send a rocket message`, async() => { - const tx = await app.models.Claim.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const newClaim = await app.models.Claim.create(originalData, options); - - const chatModel = app.models.Chat; - spyOn(chatModel, 'sendCheckingPresence').and.callThrough(); - - const incompleteState = 5; - const claimManagerId = 72; - const ctx = { - req: { - accessToken: {userId: claimManagerId}, - headers: {origin: url} - }, - args: { - observation: 'valid observation', - claimStateFk: incompleteState, - hasToPickUp: false - } - }; - ctx.req.__ = i18n.__; - await app.models.Claim.updateClaim(ctx, newClaim.id, options); - - let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options); - - expect(updatedClaim.observation).toEqual(ctx.args.observation); - expect(chatModel.sendCheckingPresence).toHaveBeenCalled(); + expect(chatModel.sendCheckingPresence).toHaveBeenCalledTimes(2); await tx.rollback(); } catch (e) { From 2b299eb32b4db2527e16f21d76c753e96d14c281 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 5 Mar 2024 09:48:53 +0100 Subject: [PATCH 240/250] refs #6980 fix iban --- loopback/util/validateIban.js | 1 - modules/client/front/billing-data/index.html | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/loopback/util/validateIban.js b/loopback/util/validateIban.js index ed3e00426..2386538b5 100644 --- a/loopback/util/validateIban.js +++ b/loopback/util/validateIban.js @@ -3,7 +3,6 @@ module.exports = function(iban, countryCode) { if (typeof iban != 'string') return false; if (countryCode?.toLowerCase() != 'es') return true; - iban = iban.toUpperCase(); iban = trim(iban); iban = iban.replace(/\s/g, ''); diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html index bd4f86d1c..39c0fc428 100644 --- a/modules/client/front/billing-data/index.html +++ b/modules/client/front/billing-data/index.html @@ -33,6 +33,7 @@ Date: Tue, 5 Mar 2024 10:09:32 +0100 Subject: [PATCH 241/250] fix: refs #6276 options --- back/methods/collection/getSales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/collection/getSales.js b/back/methods/collection/getSales.js index a5e7aeefa..78945dc80 100644 --- a/back/methods/collection/getSales.js +++ b/back/methods/collection/getSales.js @@ -44,7 +44,7 @@ module.exports = Self => { if (source) { await Self.rawSql( - 'CALL vn.ticketStateToday_setState(?,?)', [id, source], options + 'CALL vn.ticketStateToday_setState(?,?)', [id, source], myOptions ); } From 726558d5a7b3e74bfb8ea6809df059679bb2c669 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 5 Mar 2024 10:37:15 +0100 Subject: [PATCH 242/250] refs #6607 feat:[checking boxes] --- db/routines/vn/procedures/sale_getFromTicketOrCollection.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql index e0cff202f..39c82d4ca 100644 --- a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql +++ b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql @@ -80,6 +80,9 @@ DECLARE vIsCollection BOOL; MIN(iss.created) picked, IF(sm.id, TRUE, FALSE) hasMistake, sg.sectorFk + b.packing, + b.grouping, + o.code FROM tmp.ticket t JOIN sale s ON s.ticketFk = t.id JOIN ticket tt ON tt.id = t.id From d2f451c613d0f1a447cd61558aefda9b1ea6040e Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 5 Mar 2024 12:33:28 +0100 Subject: [PATCH 243/250] ticket #162561 hotfix --- db/routines/vn/procedures/itemProposal.sql | 137 +++++++++++++-------- 1 file changed, 83 insertions(+), 54 deletions(-) diff --git a/db/routines/vn/procedures/itemProposal.sql b/db/routines/vn/procedures/itemProposal.sql index 74d356d77..47a4e9779 100644 --- a/db/routines/vn/procedures/itemProposal.sql +++ b/db/routines/vn/procedures/itemProposal.sql @@ -1,42 +1,68 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal`(vItemFk INT, vTicketFk INT,vShowType BOOL) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal`( + vSelf INT, + vTicketFk INT, + vShowType BOOL +) BEGIN - /** - * Propone articulos disponible ordenado, con la cantidad de veces usado y segun sus caracteristicas - * - * @param vItemFk item id - * @param vTicketFk ticket id - * @param vShowType mostrar tipos - */ - +* Propone articulos disponibles ordenados, con la cantidad +* de veces usado y segun sus caracteristicas. +* +* @param vSelf Id de artículo +* @param vTicketFk Id de ticket +* @param vShowType Mostrar tipos +*/ DECLARE vWarehouseFk INT; DECLARE vShipped DATE; DECLARE vCalcFk INT; DECLARE vTypeFk INT; + DECLARE vPriority INT DEFAULT 1; - DECLARE vTag1 VARCHAR(25); - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); + DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag7 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag8 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + + DECLARE vValue1 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue5 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue6 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vValue1 VARCHAR(50); - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket + SELECT warehouseFk, shipped + INTO vWarehouseFk, vShipped + FROM ticket WHERE id = vTicketFk; - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; + SELECT typeFk, + tag5, + value5, + tag6, + value6, + tag7, + value7, + tag8, + value8, + t.name, + it.value + INTO vTypeFk, + vTag5, + vValue5, + vTag6, + vValue6, + vTag7, + vValue7, + vTag8, + vValue8, + vTag1, + vValue1 + FROM item i + LEFT JOIN itemTag it ON it.itemFk = i.id + AND it.priority = vPriority + LEFT JOIN tag t ON t.id = it.tagFk + WHERE i.id = vSelf; CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); @@ -45,43 +71,46 @@ BEGIN i.subName, i.tag5, i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, + (i.value5 <=> vValue5) match5, i.tag6, i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, + (i.value6 <=> vValue6) match6, i.tag7, i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, + (i.value7 <=> vValue7) match7, i.tag8, i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, + (i.value8 <=> vValue8) match8, a.available, - IFNULL(ip.counter,0) counter, - IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity, + IFNULL(ip.counter, 0) `counter`, + IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity, iss.visible located FROM item i JOIN cache.available a ON a.item_id = i.id - LEFT JOIN itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN tag t1 ON t1.id = it1.tagFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN itemProposal ip ON ip.mateFk = i.id + AND ip.itemFk = vSelf + LEFT JOIN itemTag it ON it.itemFk = i.id + AND it.priority = vPriority + LEFT JOIN tag t ON t.id = it.tagFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id + AND lb.warehouse_id = vWarehouseFk LEFT JOIN buy b ON b.id = lb.buy_id - LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id AND iss.warehouseFk = vWarehouseFk + LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id + AND iss.warehouseFk = vWarehouseFk WHERE a.calc_id = vCalcFk - AND available > 0 - AND IF(vShowType,i.typeFk = vTypeFk,true) - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1 COLLATE utf8_general_ci) DESC, - (it1.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) DESC; - + AND a.available > 0 + AND IF(vShowType, i.typeFk = vTypeFk, TRUE) + AND i.id <> vSelf + ORDER BY `counter` DESC, + (t.name = vTag1) DESC, + (it.value = vValue1) DESC, + (i.tag5 = vTag5) DESC, + match5 DESC, + (i.tag6 = vTag6) DESC, + match6 DESC, + (i.tag7 = vTag7) DESC, + match7 DESC, + (i.tag8 = vTag8) DESC, + match8 DESC; END$$ DELIMITER ; From 950d7a24612e95f01a156e2ec63b1ee33859b14a Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 5 Mar 2024 12:48:39 +0100 Subject: [PATCH 244/250] refactor: refs #6874 Changed params item_getSimilar --- db/routines/vn/procedures/item_getSimilar.sql | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index 2522280f7..e87e77819 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -1,7 +1,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getSimilar`( vSelf INT, - vTicketFk INT, + vWarehouseFk INT, + vDated DATE, vShowType BOOL ) BEGIN @@ -10,11 +11,10 @@ BEGIN * de veces usado y segun sus caracteristicas. * * @param vSelf Id de artículo -* @param vTicketFk Id de ticket +* @param vWarehouseFk Id de almacen +* @param vDated Fecha * @param vShowType Mostrar tipos */ - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; DECLARE vCalcFk INT; DECLARE vTypeFk INT; DECLARE vPriority INT DEFAULT 1; @@ -31,11 +31,6 @@ BEGIN DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - SELECT warehouseFk, shipped - INTO vWarehouseFk, vShipped - FROM ticket - WHERE id = vTicketFk; - SELECT typeFk, tag5, value5, @@ -64,7 +59,7 @@ BEGIN LEFT JOIN tag t ON t.id = it.tagFk WHERE i.id = vSelf; - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDated); SELECT i.id itemFk, i.longName, From 9c14836bc7301c7171cefdd0c9374136f3d2d252 Mon Sep 17 00:00:00 2001 From: Pako Date: Tue, 5 Mar 2024 13:18:13 +0100 Subject: [PATCH 245/250] BlueMonkey --- db/routines/vn/procedures/sale_getBoxPickingList.sql | 4 +--- db/versions/10929-orangeAnthurium/00-firstScript.sql | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 db/versions/10929-orangeAnthurium/00-firstScript.sql diff --git a/db/routines/vn/procedures/sale_getBoxPickingList.sql b/db/routines/vn/procedures/sale_getBoxPickingList.sql index 0af23e945..ff0e85259 100644 --- a/db/routines/vn/procedures/sale_getBoxPickingList.sql +++ b/db/routines/vn/procedures/sale_getBoxPickingList.sql @@ -27,7 +27,7 @@ BEGIN s.quantity, MAKETIME(pb.HH,pb.mm,0) etd, pb.routeFk, - FLOOR(s.quantity / ish.packing) stickers, + FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers, IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing, b.packagingFk FROM sale s @@ -71,5 +71,3 @@ BEGIN DROP TEMPORARY TABLE tmp.sale; END$$ DELIMITER ; - -CALL `vn`.`sale_getBoxPickingList`(1, curdate()); \ No newline at end of file diff --git a/db/versions/10929-orangeAnthurium/00-firstScript.sql b/db/versions/10929-orangeAnthurium/00-firstScript.sql new file mode 100644 index 000000000..299ac63c7 --- /dev/null +++ b/db/versions/10929-orangeAnthurium/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE dipole.expedition_PrintOut MODIFY COLUMN street varchar(42) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT ' ' NOT NULL; \ No newline at end of file From d397980efb791b979bb41a0a79204c5c9980b67f Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 5 Mar 2024 16:10:56 +0100 Subject: [PATCH 246/250] refs #6607 feat:[checking boxes] --- db/routines/vn/procedures/sale_getFromTicketOrCollection.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql index 39c82d4ca..5308bdd28 100644 --- a/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql +++ b/db/routines/vn/procedures/sale_getFromTicketOrCollection.sql @@ -79,7 +79,7 @@ DECLARE vIsCollection BOOL; IF(SUM(iss.quantity) IS NULL, 0, SUM(iss.quantity)) pickedQuantity, MIN(iss.created) picked, IF(sm.id, TRUE, FALSE) hasMistake, - sg.sectorFk + sg.sectorFk, b.packing, b.grouping, o.code From 117e550bf2cf49eda2314667bf8924f4e019efa4 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 6 Mar 2024 08:58:30 +0100 Subject: [PATCH 247/250] refs #6990 hotFix: puppeteer cluster --- print/package.json | 1 + print/pnpm-lock.yaml | 135 ++++++++++++++++++++++++++++++------------- 2 files changed, 95 insertions(+), 41 deletions(-) diff --git a/print/package.json b/print/package.json index 8a01312b0..2adb7f1e0 100755 --- a/print/package.json +++ b/print/package.json @@ -22,6 +22,7 @@ "log4js": "^6.7.0", "mysql2": "^1.7.0", "nodemailer": "^4.7.0", + "puppeteer": "^22.4.0", "puppeteer-cluster": "^0.23.0", "qrcode": "^1.4.2", "strftime": "^0.10.0", diff --git a/print/pnpm-lock.yaml b/print/pnpm-lock.yaml index ddf00f08d..185dd89de 100644 --- a/print/pnpm-lock.yaml +++ b/print/pnpm-lock.yaml @@ -32,9 +32,12 @@ dependencies: nodemailer: specifier: ^4.7.0 version: 4.7.0 + puppeteer: + specifier: ^22.4.0 + version: 22.4.0 puppeteer-cluster: specifier: ^0.23.0 - version: 0.23.0(puppeteer@21.10.0) + version: 0.23.0(puppeteer@22.4.0) qrcode: specifier: ^1.4.2 version: 1.5.3 @@ -100,16 +103,17 @@ packages: to-fast-properties: 2.0.0 dev: false - /@puppeteer/browsers@1.9.1: - resolution: {integrity: sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==} - engines: {node: '>=16.3.0'} + /@puppeteer/browsers@2.1.0: + resolution: {integrity: sha512-xloWvocjvryHdUjDam/ZuGMh7zn4Sn3ZAaV4Ah2e2EwEt90N3XphZlSsU3n0VDc1F7kggCjMuH0UuxfPQ5mD9w==} + engines: {node: '>=18'} hasBin: true dependencies: debug: 4.3.4 extract-zip: 2.0.1 progress: 2.0.3 - proxy-agent: 6.3.1 - tar-fs: 3.0.4 + proxy-agent: 6.4.0 + semver: 7.6.0 + tar-fs: 3.0.5 unbzip2-stream: 1.4.3 yargs: 17.7.2 transitivePeerDependencies: @@ -243,6 +247,37 @@ packages: resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==} dev: false + /bare-events@2.2.1: + resolution: {integrity: sha512-9GYPpsPFvrWBkelIhOhTWtkeZxVxZOdb3VnFTCzlOo3OjvmTvzLoZFUT8kNFACx0vJej6QPney1Cf9BvzCNE/A==} + requiresBuild: true + dev: false + optional: true + + /bare-fs@2.2.1: + resolution: {integrity: sha512-+CjmZANQDFZWy4PGbVdmALIwmt33aJg8qTkVjClU6X4WmZkTPBDxRHiBn7fpqEWEfF3AC2io++erpViAIQbSjg==} + requiresBuild: true + dependencies: + bare-events: 2.2.1 + bare-os: 2.2.0 + bare-path: 2.1.0 + streamx: 2.15.6 + dev: false + optional: true + + /bare-os@2.2.0: + resolution: {integrity: sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==} + requiresBuild: true + dev: false + optional: true + + /bare-path@2.1.0: + resolution: {integrity: sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==} + requiresBuild: true + dependencies: + bare-os: 2.2.0 + dev: false + optional: true + /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} dev: false @@ -326,12 +361,12 @@ packages: lodash.some: 4.6.0 dev: false - /chromium-bidi@0.5.6(devtools-protocol@0.0.1232444): - resolution: {integrity: sha512-ber8smgoAs4EqSUHRb0I8fpx371ZmvsdQav8HRM9oO4fk5Ox16vQiNYXlsZkRj4FfvVL2dCef+zBFQixp+79CA==} + /chromium-bidi@0.5.12(devtools-protocol@0.0.1249869): + resolution: {integrity: sha512-sZMgEBWKbupD0Q7lyFu8AWkrE+rs5ycE12jFkGwIgD/VS8lDPtelPlXM7LYaq4zrkZ/O2L3f4afHUHL0ICdKog==} peerDependencies: devtools-protocol: '*' dependencies: - devtools-protocol: 0.0.1232444 + devtools-protocol: 0.0.1249869 mitt: 3.0.1 urlpattern-polyfill: 10.0.0 dev: false @@ -545,8 +580,8 @@ packages: resolution: {integrity: sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==} dev: false - /devtools-protocol@0.0.1232444: - resolution: {integrity: sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==} + /devtools-protocol@0.0.1249869: + resolution: {integrity: sha512-Ctp4hInA0BEavlUoRy9mhGq0i+JSo/AwVyX2EFgZmV1kYB+Zq+EMBAn52QWu6FbRr10hRb6pBl420upbp4++vg==} dev: false /dijkstrajs@1.0.3: @@ -968,8 +1003,8 @@ packages: statuses: 1.3.1 dev: false - /http-proxy-agent@7.0.0: - resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} + /http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -987,8 +1022,8 @@ packages: sshpk: 1.18.0 dev: false - /https-proxy-agent@7.0.2: - resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} + /https-proxy-agent@7.0.4: + resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 @@ -1258,6 +1293,13 @@ packages: yallist: 3.1.1 dev: false + /lru-cache@6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + dependencies: + yallist: 4.0.0 + dev: false + /lru-cache@7.18.3: resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==} engines: {node: '>=12'} @@ -1308,10 +1350,6 @@ packages: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} dev: false - /mkdirp-classic@0.5.3: - resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} - dev: false - /ms@0.7.1: resolution: {integrity: sha512-lRLiIR9fSNpnP6TC4v8+4OU7oStC01esuNowdQ34L+Gk8e5Puoc88IqJ+XAY/B3Mn2ZKis8l8HX90oU8ivzUHg==} dev: false @@ -1432,8 +1470,8 @@ packages: agent-base: 7.1.0 debug: 4.3.4 get-uri: 6.0.2 - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.4 pac-resolver: 7.0.0 socks-proxy-agent: 8.0.2 transitivePeerDependencies: @@ -1536,14 +1574,14 @@ packages: ipaddr.js: 1.4.0 dev: false - /proxy-agent@6.3.1: - resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==} + /proxy-agent@6.4.0: + resolution: {integrity: sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==} engines: {node: '>= 14'} dependencies: agent-base: 7.1.0 debug: 4.3.4 - http-proxy-agent: 7.0.0 - https-proxy-agent: 7.0.2 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.4 lru-cache: 7.18.3 pac-proxy-agent: 7.0.1 proxy-from-env: 1.1.0 @@ -1572,26 +1610,26 @@ packages: engines: {node: '>=6'} dev: false - /puppeteer-cluster@0.23.0(puppeteer@21.10.0): + /puppeteer-cluster@0.23.0(puppeteer@22.4.0): resolution: {integrity: sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==} peerDependencies: puppeteer: '>=1.5.0' dependencies: debug: 4.3.4 - puppeteer: 21.10.0 + puppeteer: 22.4.0 transitivePeerDependencies: - supports-color dev: false - /puppeteer-core@21.10.0: - resolution: {integrity: sha512-NVaqO3K462qwMuLO4Gurs/Mau1Wss+08QgNYzF0dIqZWMvpskrt/TbxbmHU+7zMTUOvPEq/lR4BLJmjMBgBGfQ==} - engines: {node: '>=16.13.2'} + /puppeteer-core@22.4.0: + resolution: {integrity: sha512-MZttAbttrxi6O/B//rY6zQihjFe/vXeCLb5YvKH2xG6yrcVESo0Hc5/Cv49omwZyZzAJ1BK8BnDeatDsj+3hMw==} + engines: {node: '>=18'} dependencies: - '@puppeteer/browsers': 1.9.1 - chromium-bidi: 0.5.6(devtools-protocol@0.0.1232444) + '@puppeteer/browsers': 2.1.0 + chromium-bidi: 0.5.12(devtools-protocol@0.0.1249869) cross-fetch: 4.0.0 debug: 4.3.4 - devtools-protocol: 0.0.1232444 + devtools-protocol: 0.0.1249869 ws: 8.16.0 transitivePeerDependencies: - bufferutil @@ -1600,15 +1638,15 @@ packages: - utf-8-validate dev: false - /puppeteer@21.10.0: - resolution: {integrity: sha512-Y1yQjcLE00hHTDAmv3M3A6hhW0Ytjdp6xr6nyjl7FZ7E7hzp/6Rsw80FbaTJzJHFCplBNi082wrgynbmD7RlYw==} - engines: {node: '>=16.13.2'} + /puppeteer@22.4.0: + resolution: {integrity: sha512-tR+JsDbA2qD1DqRX4F9k9SxQhk6UzcaCN+Qux7+WrDceS7wcR7tlFmMNB8+g8zE4Fmr/iRTOtf5wNnTW9cGUFQ==} + engines: {node: '>=18'} hasBin: true requiresBuild: true dependencies: - '@puppeteer/browsers': 1.9.1 + '@puppeteer/browsers': 2.1.0 cosmiconfig: 9.0.0 - puppeteer-core: 21.10.0 + puppeteer-core: 22.4.0 transitivePeerDependencies: - bufferutil - encoding @@ -1640,6 +1678,7 @@ packages: /queue-tick@1.0.1: resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} + requiresBuild: true dev: false /randombytes@2.1.0: @@ -1729,6 +1768,14 @@ packages: hasBin: true dev: false + /semver@7.6.0: + resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} + engines: {node: '>=10'} + hasBin: true + dependencies: + lru-cache: 6.0.0 + dev: false + /send@0.14.1: resolution: {integrity: sha512-1Ru269QpUVUgD32Y9jdyBXiX+pHYuYnTzR17w+DhyOWvGMPjJILrnLhl9c4LQjtIy2BSAa6Ykq0ZdGcAjaXlwQ==} engines: {node: '>= 0.8.0'} @@ -1950,12 +1997,14 @@ packages: engines: {node: '>= 0.4'} dev: false - /tar-fs@3.0.4: - resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==} + /tar-fs@3.0.5: + resolution: {integrity: sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==} dependencies: - mkdirp-classic: 0.5.3 pump: 3.0.0 tar-stream: 3.1.7 + optionalDependencies: + bare-fs: 2.2.1 + bare-path: 2.1.0 dev: false /tar-stream@3.1.7: @@ -2200,6 +2249,10 @@ packages: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} dev: false + /yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + dev: false + /yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} engines: {node: '>=6'} From 8b32a19233e04c61e6e248227708c4623d6c0f86 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 6 Mar 2024 09:01:08 +0100 Subject: [PATCH 248/250] fix: puppeteer --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ca7f5d19..821316c87 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,7 +71,6 @@ pipeline { stage('Back') { steps { sh 'pnpm install --prefer-offline' - sh 'pnpx puppeteer browsers install chrome' } } stage('Print') { From 492c6f4dd6aa596f2e2b10b0c96c1604fee3e2f7 Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 6 Mar 2024 12:50:44 +0100 Subject: [PATCH 249/250] refs #6969 test --- db/routines/vn/procedures/buyUltimateFromInterval.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/routines/vn/procedures/buyUltimateFromInterval.sql b/db/routines/vn/procedures/buyUltimateFromInterval.sql index f78174482..e264b500d 100644 --- a/db/routines/vn/procedures/buyUltimateFromInterval.sql +++ b/db/routines/vn/procedures/buyUltimateFromInterval.sql @@ -43,6 +43,7 @@ BEGIN LIMIT 10000000000000000000) sub GROUP BY itemFk, warehouseFk; + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed, isIgnored) SELECT b.itemFk, From c81749da78e6878afa400e35dfd22312a04a39ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 6 Mar 2024 16:38:34 +0100 Subject: [PATCH 250/250] feat: add column department.pbxQueue refs #6387 --- db/versions/10940-aquaLilium/00-firstScript.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 db/versions/10940-aquaLilium/00-firstScript.sql diff --git a/db/versions/10940-aquaLilium/00-firstScript.sql b/db/versions/10940-aquaLilium/00-firstScript.sql new file mode 100644 index 000000000..fb4fa33ff --- /dev/null +++ b/db/versions/10940-aquaLilium/00-firstScript.sql @@ -0,0 +1,8 @@ + + ALTER TABLE vn.department + ADD COLUMN pbxQueue varchar(128) CHARACTER + SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL; + + ALTER TABLE vn.department + ADD CONSTRAINT department_queue_FK + FOREIGN KEY (pbxQueue) REFERENCES pbx.queue(name) ON DELETE RESTRICT ON UPDATE CASCADE;