From 03e2b984858d6b4378eaa408ba2ec0f924c93a0e Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 24 May 2023 15:50:59 +0200 Subject: [PATCH 01/24] hotFix(closeAll): fix where --- modules/ticket/back/methods/ticket/closeAll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 3726d85b7..6690126b9 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -52,7 +52,7 @@ module.exports = Self => { JOIN province p ON p.id = c.provinceFk JOIN country co ON co.id = p.countryFk LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk - 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 DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND t.refFk IS NULL From 02c331ddd6ff1bbfc22f3af66a337618b4b711c7 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 25 May 2023 08:37:06 +0200 Subject: [PATCH 02/24] refs # fix(SQL): wagon --- db/changes/231201/00-wagon.sql | 3 +-- db/changes/232001/00-wagon.sql | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 db/changes/232001/00-wagon.sql diff --git a/db/changes/231201/00-wagon.sql b/db/changes/231201/00-wagon.sql index 3e4d225d7..9e817bac4 100644 --- a/db/changes/231201/00-wagon.sql +++ b/db/changes/231201/00-wagon.sql @@ -56,8 +56,6 @@ CREATE TABLE `vn`.`collectionWagonTicket` ( ALTER TABLE `vn`.`wagon` ADD `typeFk` int(11) unsigned NOT NULL; ALTER TABLE `vn`.`wagon` ADD `label` int(11) unsigned NOT NULL; -ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE; - INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WagonType', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), @@ -70,3 +68,4 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri ('WagonType', 'createWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'), ('WagonType', 'deleteWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'), ('WagonType', 'editWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'); + diff --git a/db/changes/232001/00-wagon.sql b/db/changes/232001/00-wagon.sql new file mode 100644 index 000000000..bdb384db5 --- /dev/null +++ b/db/changes/232001/00-wagon.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE; From 33928aa406bc5644108ecd24c8b4767ee5c65cd3 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 25 May 2023 09:29:46 +0200 Subject: [PATCH 03/24] refs #5730 correct folder --- db/changes/{232001 => 232201}/00-procedurecanAdvance.sql | 0 db/changes/{232001 => 232201}/00-procedurecanbePostponed.sql | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename db/changes/{232001 => 232201}/00-procedurecanAdvance.sql (100%) rename db/changes/{232001 => 232201}/00-procedurecanbePostponed.sql (100%) diff --git a/db/changes/232001/00-procedurecanAdvance.sql b/db/changes/232201/00-procedurecanAdvance.sql similarity index 100% rename from db/changes/232001/00-procedurecanAdvance.sql rename to db/changes/232201/00-procedurecanAdvance.sql diff --git a/db/changes/232001/00-procedurecanbePostponed.sql b/db/changes/232201/00-procedurecanbePostponed.sql similarity index 100% rename from db/changes/232001/00-procedurecanbePostponed.sql rename to db/changes/232201/00-procedurecanbePostponed.sql From dfac44a87b33a3955c063c1743b0566804bbdfd7 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 25 May 2023 11:35:25 +0200 Subject: [PATCH 04/24] hotfix 3rd parameter to null --- modules/item/back/methods/item/getBalance.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/item/back/methods/item/getBalance.js b/modules/item/back/methods/item/getBalance.js index 50372652d..c22d2a2d9 100644 --- a/modules/item/back/methods/item/getBalance.js +++ b/modules/item/back/methods/item/getBalance.js @@ -26,8 +26,8 @@ module.exports = Self => { Object.assign(myOptions, options); const where = filter.where; - const query = 'CALL vn.item_getBalance(?, ?)'; - const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk], myOptions); + const query = 'CALL vn.item_getBalance(?, ?, ?)'; + const [diary] = await Self.rawSql(query, [where.itemFk, where.warehouseFk, null], myOptions); for (const entry of diary) if (entry.clientType === 'loses') entry.highlighted = true; From cd508e970d42b0c677b2f9db25e2e0caa11436c7 Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 25 May 2023 12:42:49 +0200 Subject: [PATCH 05/24] changed structure like prod --- db/dump/structure.sql | 320 +++++++++++++++++++++++++----------------- 1 file changed, 191 insertions(+), 129 deletions(-) diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 90e4c4bc9..089cb00ec 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -59861,141 +59861,203 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`(IN vItemId int, IN vWarehouse int) +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getBalance`(vItemFk int, vWarehouseFk int, vDate DATETIME) BEGIN - DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT util.VN_CURDATE(); - DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); +/** + * @vItemFk item a buscar + * @vWarehouseFk almacen donde buscar + * @vDate Si la fecha es null, muestra el histórico desde el inventario. Si la fecha no es null, muestra histórico desde la fecha pasada. + */ - SELECT inventoried INTO vDateInventory FROM config; - SET @a = 0; - SET @currentLineFk = 0; - SET @shipped = ''; + DECLARE vDateInventory DATETIME; + DECLARE vInvCalculated INT; - SELECT DATE(@shipped:= shipped) shipped, - alertLevel, - stateName, - origin, - reference, - clientFk, - name, - `in` AS invalue, - `out`, - @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - @currentLineFk := IF (@shipped < util.VN_CURDATE() - OR (@shipped = util.VN_CURDATE() AND (isPicked OR alertLevel >= 2)), - lineFk,@currentLineFk) lastPreparedLineFk, - isTicket, - lineFk, - isPicked, - clientType, - claimFk - FROM - ( SELECT tr.landed AS shipped, - b.quantity AS `in`, - NULL AS `out`, - al.id AS alertLevel, - st.name AS stateName, - s.name AS name, - e.invoiceNumber AS reference, - e.id AS origin, - s.id AS clientFk, - IF(al.id = 3, TRUE, FALSE) isPicked, - FALSE AS isTicket, - b.id lineFk, - NULL `order`, - NULL AS clientType, - NULL AS claimFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.landed < util.VN_CURDATE() THEN 3 - WHEN tr.landed = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 3 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.landed >= vDateInventory - AND vWarehouse = tr.warehouseInFk - AND b.itemFk = vItemId - AND e.isExcludedFromAvailable = FALSE - AND e.isRaid = FALSE - UNION ALL + IF vDate IS NULL THEN + SELECT inventoried INTO vDateInventory + FROM config; + ELSE + SELECT mockUtcTime INTO vDateInventory + FROM util.config; + END IF; - SELECT tr.shipped, - NULL, - b.quantity, - al.id, - st.name, - s.name, - e.invoiceNumber, - e.id, - s.id, - IF(al.id = 3, TRUE, FALSE), - FALSE, - b.id, - NULL, - NULL, - NULL - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.shipped < util.VN_CURDATE() THEN 3 - WHEN tr.shipped = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 3 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.shipped >= vDateInventory - AND vWarehouse =tr.warehouseOutFk - AND s.id <> 4 - AND b.itemFk = vItemId - AND e.isExcludedFromAvailable = FALSE - AND w.isFeedStock = FALSE - AND e.isRaid = FALSE - UNION ALL + CREATE OR REPLACE TEMPORARY TABLE itemDiary( + shipped DATE, + `in` INT(11), + `out` INT(11), + alertLevel INT(11), + stateName VARCHAR(20), + `name` VARCHAR(50), + reference VARCHAR(50), + origin INT(11), + clientFk INT(11), + isPicked INT(11), + isTicket TINYINT(1), + lineFk INT(11), + `order` TINYINT(3) UNSIGNED, + clientType VARCHAR(20), + claimFk INT(10) UNSIGNED + ); - SELECT DATE(t.shipped), - NULL, - s.quantity, - al.id, - st.name, - t.nickname, - t.refFk, - t.id, - t.clientFk, - stk.id, - TRUE, - s.id, - st.`order`, - ct.code, - cb.claimFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN ticketState ts ON ts.ticket = 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 alertLevel al ON al.id = - CASE - WHEN t.shipped < util.VN_CURDATE() THEN 3 - WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN 0 - ELSE IFNULL(ts.alertLevel, 0) - END - LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' - LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id - LEFT JOIN claimBeginning cb ON s.id = cb.saleFk - WHERE t.shipped >= vDateInventory - AND s.itemFk = vItemId - AND vWarehouse =t.warehouseFk - ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC - ) AS itemDiary; + INSERT INTO itemDiary + SELECT tr.landed shipped, + b.quantity `in`, + NULL `out`, + al.id alertLevel, + st.name stateName, + s.name `name`, + e.invoiceNumber reference, + e.id origin, + s.id clientFk, + IF(al.code = 'DELIVERED', TRUE, FALSE) isPicked, + FALSE isTicket, + b.id lineFk, + NULL `order`, + NULL clientType, + NULL claimFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.code = + CASE + WHEN tr.landed < util.VN_CURDATE() THEN 'DELIVERED' + WHEN tr.landed = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 'DELIVERED' + ELSE 'FREE' + END + JOIN state st ON st.code = al.code + WHERE tr.landed >= vDateInventory + AND vWarehouseFk = tr.warehouseInFk + AND b.itemFk = vItemFk + AND e.isExcludedFromAvailable = FALSE + AND e.isRaid = FALSE + UNION ALL + SELECT tr.shipped, + NULL, + b.quantity, + al.id, + st.name, + s.name, + e.invoiceNumber, + e.id, + s.id, + IF(al.code = 'DELIVERED', TRUE, FALSE), + FALSE, + b.id, + NULL, + NULL, + NULL + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.code = + CASE + WHEN tr.shipped < util.VN_CURDATE() THEN 'DELIVERED' + WHEN tr.shipped = util.VN_CURDATE() AND tr.isReceived = TRUE THEN 'DELIVERED' + ELSE 'FREE' + END + JOIN state st ON st.code = al.code + JOIN entryConfig ec + WHERE tr.shipped >= vDateInventory + AND vWarehouseFk =tr.warehouseOutFk + AND s.id <> ec.inventorySupplierFk + AND b.itemFk = vItemFk + AND e.isExcludedFromAvailable = FALSE + AND w.isFeedStock = FALSE + AND e.isRaid = FALSE + UNION ALL + SELECT DATE(t.shipped), + NULL, + s.quantity, + al.id, + st.name, + t.nickname, + t.refFk, + t.id, + t.clientFk, + stk.id, + TRUE, + s.id, + st.`order`, + ct.code, + cb.claimFk + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = 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 alertLevel al ON al.code = + CASE + WHEN t.shipped < util.VN_CURDATE() THEN 'DELIVERED' + WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN 'FREE' + ELSE IFNULL(ts.alertLevel, 0) + END + LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id + LEFT JOIN claimBeginning cb ON s.id = cb.saleFk + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemFk + AND vWarehouseFk =t.warehouseFk + ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC; + IF vDate IS NULL THEN + SET @a = 0; + SET @currentLineFk = 0; + SET @shipped = ''; + + SELECT DATE(@shipped:= shipped) shipped, + alertLevel, + stateName, + origin, + reference, + clientFk, + name, + `in` AS invalue, + `out`, + @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + @currentLineFk := IF (@shipped < util.VN_CURDATE() + OR (@shipped = util.VN_CURDATE() AND (isPicked OR a.code >= 'ON_PREPARATION')), + lineFk, @currentLineFk) lastPreparedLineFk, + isTicket, + lineFk, + isPicked, + clientType, + claimFk + FROM itemDiary + JOIN alertLevel a ON a.id = itemDiary.alertLevel; + ELSE + SELECT sum(`in`) - sum(`out`) INTO vInvCalculated + FROM itemDiary + WHERE shipped < vDate; + + SELECT p1.* + FROM( + SELECT vDate shipped, + 0 alertLevel, + 0 stateName, + 0 origin, + '' reference, + 0 clientFk, + 'Inventario calculado', + vInvCalculated invalue, + NULL `out`, + 0 balance, + 0 lastPreparedLineFk, + 0 isTicket, + 0 lineFk, + 0 isPicked, + 0 clientType, + 0 claimFk + UNION ALL + SELECT shipped, alertlevel, stateName, origin, reference, clientFk, name, `in`, `out`, 0,0, isTicket, lineFk, isPicked, clientType, claimFk + FROM itemDiary + WHERE shipped >= vDate + )as p1; + END IF; + + DROP TEMPORARY TABLE itemDiary; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; From 7e5fcc73adeefa1b804e8341023fb340a5a4a7fc Mon Sep 17 00:00:00 2001 From: alexandre Date: Thu, 25 May 2023 13:10:05 +0200 Subject: [PATCH 06/24] modified fixed structure --- db/dump/structure.sql | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/db/dump/structure.sql b/db/dump/structure.sql index caac02d3d..380202eeb 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -59970,7 +59970,7 @@ BEGIN SELECT DATE(t.shipped), NULL, s.quantity, - al.id, + al3.id, st.name, t.nickname, t.refFk, @@ -59988,12 +59988,14 @@ BEGIN 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 alertLevel al ON al.code = - CASE - WHEN t.shipped < util.VN_CURDATE() THEN 'DELIVERED' - WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN 'FREE' - ELSE IFNULL(ts.alertLevel, 0) - END + JOIN alertLevel al ON al.code = 'DELIVERED' + JOIN alertLevel al2 ON al2.code = 'FREE' + JOIN alertLevel al3 ON al3.id = + CASE + WHEN t.shipped < util.VN_CURDATE() THEN al.code + WHEN t.shipped > util.dayEnd(util.VN_CURDATE()) THEN al2.code + ELSE IFNULL(ts.alertLevel, al2.code) + END LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id LEFT JOIN claimBeginning cb ON s.id = cb.saleFk From 375fdf2a211c5da67a43733737b7975018b4d3b6 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 25 May 2023 14:31:28 +0200 Subject: [PATCH 07/24] fix item_getBalance --- db/changes/231201/00-wagon.sql | 3 +-- db/changes/232001/00-wagon.sql | 1 + db/dump/structure.sql | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 db/changes/232001/00-wagon.sql diff --git a/db/changes/231201/00-wagon.sql b/db/changes/231201/00-wagon.sql index 3e4d225d7..9e817bac4 100644 --- a/db/changes/231201/00-wagon.sql +++ b/db/changes/231201/00-wagon.sql @@ -56,8 +56,6 @@ CREATE TABLE `vn`.`collectionWagonTicket` ( ALTER TABLE `vn`.`wagon` ADD `typeFk` int(11) unsigned NOT NULL; ALTER TABLE `vn`.`wagon` ADD `label` int(11) unsigned NOT NULL; -ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE; - INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('WagonType', '*', '*', 'ALLOW', 'ROLE', 'productionAssi'), @@ -70,3 +68,4 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri ('WagonType', 'createWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'), ('WagonType', 'deleteWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'), ('WagonType', 'editWagonType', '*', 'ALLOW', 'ROLE', 'productionAssi'); + diff --git a/db/changes/232001/00-wagon.sql b/db/changes/232001/00-wagon.sql new file mode 100644 index 000000000..bdb384db5 --- /dev/null +++ b/db/changes/232001/00-wagon.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`wagon` ADD CONSTRAINT `wagon_type` FOREIGN KEY (`typeFk`) REFERENCES `wagonType` (`id`) ON UPDATE CASCADE; diff --git a/db/dump/structure.sql b/db/dump/structure.sql index cbb1e39c8..3ce7f7bb5 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -61950,7 +61950,6 @@ BEGIN * @vWarehouseFk almacen donde buscar * @vDate Si la fecha es null, muestra el histórico desde el inventario. Si la fecha no es null, muestra histórico desde la fecha pasada. */ - DECLARE vDateInventory DATETIME; DECLARE vInvCalculated INT; From 2e0721b1013f659f804ddbde0e3e01c87705d958 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 25 May 2023 18:22:46 +0200 Subject: [PATCH 08/24] refs #5667 Fixes: Id filter, translations --- front/salix/components/log/index.js | 8 ++++---- modules/item/back/locale/item-botanical/en.yml | 2 +- modules/item/back/locale/item-botanical/es.yml | 2 +- modules/item/back/locale/item/en.yml | 2 +- modules/item/back/locale/item/es.yml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/front/salix/components/log/index.js b/front/salix/components/log/index.js index 7452c6636..ef1b370b5 100644 --- a/front/salix/components/log/index.js +++ b/front/salix/components/log/index.js @@ -150,10 +150,10 @@ export default class Controller extends Section { if (value == null || value == '') return null; switch (prop) { case 'search': - const or = [{changedModelId: value}]; - if (!/^[0-9]+$/.test(value)) - or.push({changedModelValue: {like: `%${value}%`}}); - return {or}; + if (/^[0-9]+$/.test(value)) + return {changedModelId: value}; + else + return {changedModelValue: {like: `%${value}%`}}; case 'changes': return {or: [ {oldInstance: {like: `%${value}%`}}, diff --git a/modules/item/back/locale/item-botanical/en.yml b/modules/item/back/locale/item-botanical/en.yml index 03c66a097..9e3d7cad5 100644 --- a/modules/item/back/locale/item-botanical/en.yml +++ b/modules/item/back/locale/item-botanical/en.yml @@ -1,4 +1,4 @@ -name: botanical +name: botanical data columns: itemFk: item genusFk: genus diff --git a/modules/item/back/locale/item-botanical/es.yml b/modules/item/back/locale/item-botanical/es.yml index ca7fd5bf1..75b1587a5 100644 --- a/modules/item/back/locale/item-botanical/es.yml +++ b/modules/item/back/locale/item-botanical/es.yml @@ -1,4 +1,4 @@ -name: botánico +name: datos botánicos columns: itemFk: artículo genusFk: género diff --git a/modules/item/back/locale/item/en.yml b/modules/item/back/locale/item/en.yml index 39e465300..ea40fd34b 100644 --- a/modules/item/back/locale/item/en.yml +++ b/modules/item/back/locale/item/en.yml @@ -35,7 +35,7 @@ columns: packingOut: packing out hasMinPrice: has min price isFragile: fragile - isFloramondo: is floramondo + isFloramondo: floramondo packingShelve: packing shelve isLaid: laid inkFk: ink diff --git a/modules/item/back/locale/item/es.yml b/modules/item/back/locale/item/es.yml index 4b75b4704..973f5e94f 100644 --- a/modules/item/back/locale/item/es.yml +++ b/modules/item/back/locale/item/es.yml @@ -35,7 +35,7 @@ columns: packingOut: empaquetar hasMinPrice: tiene precio mínimo isFragile: frágil - isFloramondo: es floramondo + isFloramondo: floramondo packingShelve: estantería embalaje isLaid: puesto inkFk: tinta From 27d4d1047268003962c3016b650a9b77ba09a82b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 25 May 2023 18:32:03 +0200 Subject: [PATCH 09/24] refs #5667 Expedition translation fixes --- modules/ticket/back/locale/expedition/en.yml | 2 ++ modules/ticket/back/locale/expedition/es.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/modules/ticket/back/locale/expedition/en.yml b/modules/ticket/back/locale/expedition/en.yml index 5ec5d5ecd..455cf78a2 100644 --- a/modules/ticket/back/locale/expedition/en.yml +++ b/modules/ticket/back/locale/expedition/en.yml @@ -12,3 +12,5 @@ columns: hostFk: PC isBox: box itemPackingTypeFk: packing type + externalId: external id + stateTypeFk: status diff --git a/modules/ticket/back/locale/expedition/es.yml b/modules/ticket/back/locale/expedition/es.yml index cda577f18..5f9d4f0a5 100644 --- a/modules/ticket/back/locale/expedition/es.yml +++ b/modules/ticket/back/locale/expedition/es.yml @@ -12,3 +12,5 @@ columns: hostFk: PC isBox: caja itemPackingTypeFk: tipo empaquetado + externalId: id externo + stateTypeFk: estado From a232e9eceaa84b1b72cf750fea7f25ddf41a2a5c Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 29 May 2023 09:26:36 +0200 Subject: [PATCH 10/24] refs #5153 --- modules/client/back/methods/client/getCard.js | 6 ++++++ modules/client/back/models/pay-method.json | 2 +- modules/client/front/descriptor/index.html | 4 ++++ modules/client/front/descriptor/locale/es.yml | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js index 414cbe058..b52678b39 100644 --- a/modules/client/back/methods/client/getCard.js +++ b/modules/client/back/methods/client/getCard.js @@ -59,6 +59,12 @@ module.exports = function(Self) { fields: ['id', 'name'] } }, + { + relation: 'businessType', + scope: { + fields: ['code', 'description'] + } + }, { relation: 'account', scope: { diff --git a/modules/client/back/models/pay-method.json b/modules/client/back/models/pay-method.json index c83c21e2f..6eeb2b0ee 100644 --- a/modules/client/back/models/pay-method.json +++ b/modules/client/back/models/pay-method.json @@ -3,7 +3,7 @@ "base": "VnModel", "options": { "mysql": { - "table": "payMethod" + "table": "payMethod" } }, "properties": { diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index 5aaecbdb0..f2dbd64b6 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -43,6 +43,10 @@ {{$ctrl.client.salesPersonUser.name}} + +
Date: Tue, 30 May 2023 11:23:07 +0200 Subject: [PATCH 11/24] refs #5153 --- modules/client/back/methods/client/getCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js index b52678b39..48840b036 100644 --- a/modules/client/back/methods/client/getCard.js +++ b/modules/client/back/methods/client/getCard.js @@ -62,7 +62,7 @@ module.exports = function(Self) { { relation: 'businessType', scope: { - fields: ['code', 'description'] + fields: ['description'] } }, { From a4d7988591c04e8093a51fdf8def9319a5c918a6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 30 May 2023 19:39:11 +0200 Subject: [PATCH 12/24] refs #5517 Translations fixes --- modules/shelving/back/locale/shelving/en.yml | 11 +++++++++++ modules/shelving/back/locale/shelving/es.yml | 11 +++++++++++ modules/worker/back/locale/business/en.yml | 11 +++++++++++ modules/worker/back/locale/business/es.yml | 11 +++++++++++ modules/worker/back/locale/worker-document/en.yml | 6 ++++++ modules/worker/back/locale/worker-document/es.yml | 6 ++++++ 6 files changed, 56 insertions(+) create mode 100644 modules/shelving/back/locale/shelving/en.yml create mode 100644 modules/shelving/back/locale/shelving/es.yml create mode 100644 modules/worker/back/locale/worker-document/en.yml create mode 100644 modules/worker/back/locale/worker-document/es.yml diff --git a/modules/shelving/back/locale/shelving/en.yml b/modules/shelving/back/locale/shelving/en.yml new file mode 100644 index 000000000..d89ddc871 --- /dev/null +++ b/modules/shelving/back/locale/shelving/en.yml @@ -0,0 +1,11 @@ +name: shelving +columns: + id: id + code: code + parkingFk: parking + isPrinted: printed + priority: priority + parked: parked + userFk: user + isSpam: SPAM + isRecyclable: recyclable diff --git a/modules/shelving/back/locale/shelving/es.yml b/modules/shelving/back/locale/shelving/es.yml new file mode 100644 index 000000000..dee96139c --- /dev/null +++ b/modules/shelving/back/locale/shelving/es.yml @@ -0,0 +1,11 @@ +name: estantería +columns: + id: id + code: código + parkingFk: parking + isPrinted: impreso + priority: prioridad + parked: aparcado + userFk: usuario + isSpam: SPAM + isRecyclable: reciclable diff --git a/modules/worker/back/locale/business/en.yml b/modules/worker/back/locale/business/en.yml index f0642fbe4..0f18a9ce8 100644 --- a/modules/worker/back/locale/business/en.yml +++ b/modules/worker/back/locale/business/en.yml @@ -4,9 +4,20 @@ columns: companyCodeFk: company started: started ended: ended + workerBusiness: business + reasonEndFk: ending reason payedHolidays: payed holidays + occupationCodeFk: occupation workerFk: worker + notes: notes + departmentFk: department + workerBusinessProfessionalCategoryFk: professional category calendarTypeFk: calendar type isHourlyLabor: hourly labor workcenterFk: workcenter + rate: rate + workerBusinessCategoryFk: category + workerBusinessTypeFk: type amount: amount + workerBusinessAgreementFk: agreement + basicSalary: salary diff --git a/modules/worker/back/locale/business/es.yml b/modules/worker/back/locale/business/es.yml index 13ecfdb19..3367c1b78 100644 --- a/modules/worker/back/locale/business/es.yml +++ b/modules/worker/back/locale/business/es.yml @@ -4,9 +4,20 @@ columns: companyCodeFk: empresa started: iniciado ended: finalizado + workerBusiness: negocio + reasonEndFk: motivo finalización payedHolidays: vacaciones pagadas + occupationCodeFk: ocupación workerFk: trabajador + notes: notas + departmentFk: departamento + workerBusinessProfessionalCategoryFk: categoría profesional calendarTypeFk: tipo calendario isHourlyLabor: horario laboral workcenterFk: centro de trabajo + rate: tarifa + workerBusinessCategoryFk: categoría + workerBusinessTypeFk: tipo amount: salario + workerBusinessAgreementFk: acuerdo + basicSalary: salario base diff --git a/modules/worker/back/locale/worker-document/en.yml b/modules/worker/back/locale/worker-document/en.yml new file mode 100644 index 000000000..0f644bf37 --- /dev/null +++ b/modules/worker/back/locale/worker-document/en.yml @@ -0,0 +1,6 @@ +name: document +columns: + id: id + worker: worker + document: document + isReadableByWorker: readable by worker diff --git a/modules/worker/back/locale/worker-document/es.yml b/modules/worker/back/locale/worker-document/es.yml new file mode 100644 index 000000000..721acd3d1 --- /dev/null +++ b/modules/worker/back/locale/worker-document/es.yml @@ -0,0 +1,6 @@ +name: documento +columns: + id: id + worker: trabajador + document: documento + isReadableByWorker: accesible por trabajador From d02ee2fd122918efb3b6f79b319623b70a432211 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 1 Jun 2023 07:16:06 +0200 Subject: [PATCH 13/24] deploy(232201) --- db/changes/232201/00-workerConfigPayMethod.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/232201/00-workerConfigPayMethod.sql b/db/changes/232201/00-workerConfigPayMethod.sql index 91f477bec..8896f636d 100644 --- a/db/changes/232201/00-workerConfigPayMethod.sql +++ b/db/changes/232201/00-workerConfigPayMethod.sql @@ -1,7 +1,7 @@ ALTER TABLE `vn`.`workerConfig` ADD payMethodFk tinyint(3) unsigned NULL; ALTER TABLE `vn`.`workerConfig` ADD CONSTRAINT workerConfig_FK FOREIGN KEY (roleFk) REFERENCES account.`role`(id) ON DELETE RESTRICT ON UPDATE CASCADE; ALTER TABLE `vn`.`workerConfig` ADD CONSTRAINT workerConfig_FK_1 FOREIGN KEY (payMethodFk) REFERENCES `vn`.`payMethod`(id) ON DELETE SET NULL ON UPDATE CASCADE; --- Cuando se apruebe el PR quitar y poner en redmine para hacerse manualmente + UPDATE `vn`.`workerConfig` SET payMethodFk = 4 WHERE id=1; From de91e016e9eeae46dd4d38a7fbc0dcb9b971306d Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 1 Jun 2023 07:22:09 +0200 Subject: [PATCH 14/24] update changelLg --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6adcf94f3..2d87773c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,18 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2322.01] - 2023-06-08 +## [2322.01] - 2023-06-01 ### Added - (Tickets -> Crear Factura) Al facturar se envia automáticamente el pdf al cliente - (Artículos -> Histórico) Filtro para mostrar lo anterior al inventario - +- (Trabajadores -> Nuevo trabajador) Permite elegir el método de pago ### Changed - (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador' ### Fixed - (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket +- (Tickets -> Cambiar estado) Ahora muestra la lista completa de todos los estados From 69bf26433d8aac6650ef9ce00f6348eaef0597ec Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 1 Jun 2023 13:19:34 +0200 Subject: [PATCH 15/24] fix(workerLog): acl to hr --- modules/worker/front/routes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index 25a0ffbcf..61093a456 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -72,7 +72,7 @@ "state": "worker.card.workerLog", "component": "vn-worker-log", "description": "Log", - "acl": ["salesAssistant"] + "acl": ["hr"] }, { "url": "/note", "state": "worker.card.note", From 5b0a1d10bb3172570a7feb28c8b9cbdb2339d05f Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 2 Jun 2023 07:51:01 +0200 Subject: [PATCH 16/24] refs #5684 edi/updateData fix --- back/methods/edi/sql/item.sql | 5 +- back/methods/edi/updateData.js | 369 +++++++++++++++++---------------- 2 files changed, 188 insertions(+), 186 deletions(-) diff --git a/back/methods/edi/sql/item.sql b/back/methods/edi/sql/item.sql index 8d794c7cf..cd1bef88d 100644 --- a/back/methods/edi/sql/item.sql +++ b/back/methods/edi/sql/item.sql @@ -1,9 +1,9 @@ LOAD DATA LOCAL INFILE ? INTO TABLE `edi`.`item` + CHARACTER SET ascii FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12) - SET - id = @col2, + SET id = @col2, product_name = @col4, name = @col5, plant_id = @col7, @@ -11,3 +11,4 @@ LOAD DATA LOCAL INFILE ? entry_date = STR_TO_DATE(@col10, '%Y%m%d'), expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')), change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i') + \ No newline at end of file diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js index 232695f4e..1057be39b 100644 --- a/back/methods/edi/updateData.js +++ b/back/methods/edi/updateData.js @@ -3,236 +3,237 @@ const path = require('path'); const fs = require('fs-extra'); module.exports = Self => { - Self.remoteMethodCtx('updateData', { - description: 'Updates schema data from external provider', - accessType: 'WRITE', - returns: { - type: 'object', - root: true - }, - http: { - path: `/updateData`, - verb: 'POST' - } - }); + Self.remoteMethodCtx('updateData', { + description: 'Updates schema data from external provider', + accessType: 'WRITE', + returns: { + type: 'object', + root: true + }, + http: { + path: `/updateData`, + verb: 'POST' + } + }); - Self.updateData = async() => { - const models = Self.app.models; + Self.updateData = async() => { + const models = Self.app.models; - // Get files checksum - const tx = await Self.beginTransaction({}); + // Get files checksum + const tx = await Self.beginTransaction({}); - try { - const options = {transaction: tx}; - const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options); + try { + const options = {transaction: tx}; + const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options); - const updatableFiles = []; - for (const file of files) { - const fileChecksum = await getChecksum(file); + const updatableFiles = []; + for (const file of files) { + const fileChecksum = await getChecksum(file); - if (file.checksum != fileChecksum) { - updatableFiles.push({ - name: file.name, - checksum: fileChecksum - }); - } else - console.debug(`File already updated, skipping...`); - } + if (file.checksum != fileChecksum) { + updatableFiles.push({ + name: file.name, + checksum: fileChecksum + }); + } else + console.debug(`File already updated, skipping...`); + } - if (updatableFiles.length === 0) - return false; + if (updatableFiles.length === 0) + return false; - // Download files - const container = await models.TempContainer.container('edi'); - const tempPath = path.join(container.client.root, container.name); + // Download files + const container = await models.TempContainer.container('edi'); + const tempPath = path.join(container.client.root, container.name); - let remoteFile; - let tempDir; - let tempFile; + let remoteFile; + let tempDir; + let tempFile; - const fileNames = updatableFiles.map(file => file.name); + const fileNames = updatableFiles.map(file => file.name); - const tables = await Self.rawSql(` - SELECT fileName, toTable, file - FROM edi.tableConfig - WHERE file IN (?)`, [fileNames], options); + const tables = await Self.rawSql(` + SELECT fileName, toTable, file + FROM edi.tableConfig + WHERE file IN (?)`, [fileNames], options); - for (const table of tables) { - const fileName = table.file; + for (const table of tables) { + const fileName = table.file; - remoteFile = `codes/${fileName}.ZIP`; - tempDir = `${tempPath}/${fileName}`; - tempFile = `${tempPath}/${fileName}.zip`; + remoteFile = `codes/${fileName}.ZIP`; + tempDir = `${tempPath}/${fileName}`; + tempFile = `${tempPath}/${fileName}.zip`; - try { - await fs.readFile(tempFile); - } catch (error) { - if (error.code === 'ENOENT') { - console.debug(`Downloading file ${fileName}...`); - const downloadOutput = await downloadFile(remoteFile, tempFile); - if (downloadOutput.error) - continue; - } - } + try { + await fs.readFile(tempFile); + } catch (error) { + if (error.code === 'ENOENT') { + console.debug(`Downloading file ${fileName}...`); + const downloadOutput = await downloadFile(remoteFile, tempFile); + if (downloadOutput.error) + continue; + } + } - await extractFile(fileName, tempFile, tempDir); + await extractFile(fileName, tempFile, tempDir); - console.debug(`Updating table ${table.toTable}...`); - await dumpData(tempDir, table, options); - } + console.debug(`Updating table ${table.toTable}...`); + await dumpData(tempDir, table, options); + } - // Update files checksum - for (const file of updatableFiles) { - console.log(`Updating file ${file.name} checksum...`); - await Self.rawSql(` - UPDATE edi.fileConfig - SET checksum = ? - WHERE name = ?`, - [file.checksum, file.name], options); - } + // Update files checksum + for (const file of updatableFiles) { + console.log(`Updating file ${file.name} checksum...`); + await Self.rawSql(` + UPDATE edi.fileConfig + SET checksum = ? + WHERE name = ?`, + [file.checksum, file.name], options); + } - await tx.commit(); + await tx.commit(); - // Clean files - try { - console.debug(`Cleaning files...`); - await fs.remove(tempPath); - } catch (error) { - if (error.code !== 'ENOENT') - throw e; - } + // Clean files + try { + console.debug(`Cleaning files...`); + await fs.remove(tempPath); + } catch (error) { + if (error.code !== 'ENOENT') + throw e; + } - return true; - } catch (error) { - await tx.rollback(); - throw error; - } - }; + return true; + } catch (error) { + await tx.rollback(); + throw error; + } + }; - let ftpClient; - async function getFtpClient() { - if (!ftpClient) { - const [ftpConfig] = await Self.rawSql('SELECT host, user, password FROM edi.ftpConfig'); - console.debug(`Openning FTP connection to ${ftpConfig.host}...\n`); + let ftpClient; + async function getFtpClient() { + if (!ftpClient) { + const [ftpConfig] = await Self.rawSql('SELECT host, user, password FROM edi.ftpConfig'); + console.debug(`Openning FTP connection to ${ftpConfig.host}...\n`); - const FtpClient = require('ftps'); + const FtpClient = require('ftps'); - ftpClient = new FtpClient({ - host: ftpConfig.host, - username: ftpConfig.user, - password: ftpConfig.password, - procotol: 'ftp' - }); - } + ftpClient = new FtpClient({ + host: ftpConfig.host, + username: ftpConfig.user, + password: ftpConfig.password, + procotol: 'ftp', + additionalLftpCommands: 'set ssl:verify-certificate no' + }); + } - return ftpClient; - } + return ftpClient; + } - async function getChecksum(file) { - const ftpClient = await getFtpClient(); - console.debug(`Checking checksum for file ${file.name}...`); + async function getChecksum(file) { + const ftpClient = await getFtpClient(); + console.debug(`Checking checksum for file ${file.name}...`); - ftpClient.cat(`codes/${file.name}.txt`); + ftpClient.cat(`codes/${file.name}.TXT`); - const response = await new Promise((resolve, reject) => { - ftpClient.exec((err, response) => { - if (err || response.error) { - console.debug(`Error downloading checksum file... ${response.error}`); - return reject(err); - } + const response = await new Promise((resolve, reject) => { + ftpClient.exec((err, response) => { + if (err || response.error) { + console.debug(`Error downloading checksum file... ${response.error}`); + return reject(err); + } - resolve(response); - }); - }); + resolve(response); + }); + }); - if (response && response.data) { - const fileContents = response.data; - const rows = fileContents.split('\n'); - const row = rows[4]; - const columns = row.split(/\s+/); + if (response && response.data) { + const fileContents = response.data; + const rows = fileContents.split('\n'); + const row = rows[4]; + const columns = row.split(/\s+/); - let fileChecksum; - if (file.keyValue) - fileChecksum = columns[1]; + let fileChecksum; + if (file.keyValue) + fileChecksum = columns[1]; - if (!file.keyValue) - fileChecksum = columns[0]; + if (!file.keyValue) + fileChecksum = columns[0]; - return fileChecksum; - } - } + return fileChecksum; + } + } - async function downloadFile(remoteFile, tempFile) { - const ftpClient = await getFtpClient(); + async function downloadFile(remoteFile, tempFile) { + const ftpClient = await getFtpClient(); - ftpClient.get(remoteFile, tempFile); + ftpClient.get(remoteFile, tempFile); - return new Promise((resolve, reject) => { - ftpClient.exec((err, response) => { - if (err || response.error) { - console.debug(`Error downloading file... ${response.error}`); - return reject(err); - } + return new Promise((resolve, reject) => { + ftpClient.exec((err, response) => { + if (err || response.error) { + console.debug(`Error downloading file... ${response.error}`); + return reject(err); + } - resolve(response); - }); - }); - } + resolve(response); + }); + }); + } - async function extractFile(fileName, tempFile, tempDir) { - const JSZip = require('jszip'); + async function extractFile(fileName, tempFile, tempDir) { + const JSZip = require('jszip'); - try { - await fs.mkdir(tempDir); - console.debug(`Extracting file ${fileName}...`); - } catch (error) { - if (error.code !== 'EEXIST') - throw e; - } + try { + await fs.mkdir(tempDir); + console.debug(`Extracting file ${fileName}...`); + } catch (error) { + if (error.code !== 'EEXIST') + throw e; + } - const fileStream = await fs.readFile(tempFile); - if (fileStream) { - const zip = new JSZip(); - const zipContents = await zip.loadAsync(fileStream); + const fileStream = await fs.readFile(tempFile); + if (fileStream) { + const zip = new JSZip(); + const zipContents = await zip.loadAsync(fileStream); - if (!zipContents) return; + if (!zipContents) return; - const fileNames = Object.keys(zipContents.files); + const fileNames = Object.keys(zipContents.files); - for (const fileName of fileNames) { - const fileContent = await zip.file(fileName).async('nodebuffer'); - const dest = path.join(tempDir, fileName); - await fs.writeFile(dest, fileContent); - } - } - } + for (const fileName of fileNames) { + const fileContent = await zip.file(fileName).async('nodebuffer'); + const dest = path.join(tempDir, fileName); + await fs.writeFile(dest, fileContent); + } + } + } - async function dumpData(tempDir, table, options) { - const toTable = table.toTable; - const baseName = table.fileName; + async function dumpData(tempDir, table, options) { + const toTable = table.toTable; + const baseName = table.fileName; - console.log(`Emptying table ${toTable}...`); - const tableName = `edi.${toTable}`; - await Self.rawSql(`DELETE FROM ??`, [tableName]); + console.log(`Emptying table ${toTable}...`); + const tableName = `edi.${toTable}`; + await Self.rawSql(`DELETE FROM ??`, [tableName]); - const dirFiles = await fs.readdir(tempDir); - const files = dirFiles.filter(file => file.startsWith(baseName)); + const dirFiles = await fs.readdir(tempDir); + const files = dirFiles.filter(file => file.startsWith(baseName)); - for (const file of files) { - console.log(`Dumping data from file ${file}...`); + for (const file of files) { + console.log(`Dumping data from file ${file}...`); - const templatePath = path.join(__dirname, `./sql/${toTable}.sql`); - const sqlTemplate = await fs.readFile(templatePath, 'utf8'); - const filePath = path.join(tempDir, file); + const templatePath = path.join(__dirname, `./sql/${toTable}.sql`); + const sqlTemplate = await fs.readFile(templatePath, 'utf8'); + const filePath = path.join(tempDir, file); - await Self.rawSql(sqlTemplate, [filePath], options); - await Self.rawSql(` - UPDATE edi.tableConfig - SET updated = ? - WHERE fileName = ? - `, [Date.vnNew(), baseName], options); - } + await Self.rawSql(sqlTemplate, [filePath], options); + await Self.rawSql(` + UPDATE edi.tableConfig + SET updated = ? + WHERE fileName = ? + `, [Date.vnNew(), baseName], options); + } - console.log(`Updated table ${toTable}\n`); - } + console.log(`Updated table ${toTable}\n`); + } }; From 95715763a1277d2e4480d01b25186fa96d119f74 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2023 08:57:22 +0200 Subject: [PATCH 17/24] refs #5667 Worker translations added/fixed --- modules/worker/back/locale/worker/en.yml | 26 ++++++++++++++++------ modules/worker/back/locale/worker/es.yml | 28 +++++++++++++++++------- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/modules/worker/back/locale/worker/en.yml b/modules/worker/back/locale/worker/en.yml index f46aed678..8438c15cf 100644 --- a/modules/worker/back/locale/worker/en.yml +++ b/modules/worker/back/locale/worker/en.yml @@ -1,20 +1,32 @@ name: worker columns: id: id + code: code firstName: first name lastName: last name + sub: buyer number + photo: photo phone: phone + mobileExtension: mobile extension userFk: user bossFk: boss + fiDueDate: FI due date + hasMachineryAuthorized: machinery authorized + seniority: seniority + isTodayRelative: today relative + isF11Allowed: F11 allowed + sectorFk: sector maritalStatus: marital status + labelerFk: labeler originCountryFk: origin country educationLevelFk: education level SSN: SSN - labelerFk: labeler - mobileExtension: mobile extension - code: code + fi: fiscal identifier + birth: birth date + isDisable: disabled + isFreelance: freelance + isSsDiscounted: SS discounted + sex: sex + businessFk: current contract + balance: balance locker: locker - workerFk: worker - sectorFk: sector - - diff --git a/modules/worker/back/locale/worker/es.yml b/modules/worker/back/locale/worker/es.yml index 182bc5f53..96616d7d2 100644 --- a/modules/worker/back/locale/worker/es.yml +++ b/modules/worker/back/locale/worker/es.yml @@ -1,20 +1,32 @@ name: trabajador columns: id: id + code: código firstName: nombre lastName: apellido + sub: número comprador + photo: foto phone: teléfono + mobileExtension: extensión móvil userFk: usuario bossFk: jefe + fiDueDate: caducidad DNI + hasMachineryAuthorized: maquinaria autorizada + seniority: antigüedad + isTodayRelative: relativo hoy + isF11Allowed: F11 autorizado + sectorFk: sector maritalStatus: estado civil + labelerFk: etiquetadora originCountryFk: país origen educationLevelFk: nivel educativo SSN: SSN - labelerFk: etiquetadora - mobileExtension: extensión móvil - code: código - locker: casillero - workerFk: trabajador - sectorFk: sector - - + fi: identificador fiscal + birth: nacimiento + isDisable: deshabilitado + isFreelance: autónomo + isSsDiscounted: descuento SS + sex: sexo + businessFk: contrato actual + balance: saldo + locker: taquilla From c05d6bb9a1f6406c033c2185dd7c61b5c58570a5 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2023 11:43:44 +0200 Subject: [PATCH 18/24] refs #5563 WorkerDocument translation fixes --- modules/worker/back/locale/worker-dms/en.yml | 4 ++-- modules/worker/back/locale/worker-dms/es.yml | 6 +++--- modules/worker/back/locale/worker-document/en.yml | 6 ------ modules/worker/back/locale/worker-document/es.yml | 6 ------ 4 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 modules/worker/back/locale/worker-document/en.yml delete mode 100644 modules/worker/back/locale/worker-document/es.yml diff --git a/modules/worker/back/locale/worker-dms/en.yml b/modules/worker/back/locale/worker-dms/en.yml index b1b7b6ce4..0f644bf37 100644 --- a/modules/worker/back/locale/worker-dms/en.yml +++ b/modules/worker/back/locale/worker-dms/en.yml @@ -1,6 +1,6 @@ name: document columns: id: id - dmsFk: dms - workerFk: worker + worker: worker + document: document isReadableByWorker: readable by worker diff --git a/modules/worker/back/locale/worker-dms/es.yml b/modules/worker/back/locale/worker-dms/es.yml index 878669181..721acd3d1 100644 --- a/modules/worker/back/locale/worker-dms/es.yml +++ b/modules/worker/back/locale/worker-dms/es.yml @@ -1,6 +1,6 @@ name: documento columns: id: id - dmsFk: dms - workerFk: trabajador - isReadableByWorker: legible por trabajador + worker: trabajador + document: documento + isReadableByWorker: accesible por trabajador diff --git a/modules/worker/back/locale/worker-document/en.yml b/modules/worker/back/locale/worker-document/en.yml deleted file mode 100644 index 0f644bf37..000000000 --- a/modules/worker/back/locale/worker-document/en.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: document -columns: - id: id - worker: worker - document: document - isReadableByWorker: readable by worker diff --git a/modules/worker/back/locale/worker-document/es.yml b/modules/worker/back/locale/worker-document/es.yml deleted file mode 100644 index 721acd3d1..000000000 --- a/modules/worker/back/locale/worker-document/es.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: documento -columns: - id: id - worker: trabajador - document: documento - isReadableByWorker: accesible por trabajador From 186ec2ea41c459097b21973bd546e17e6736a15b Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Jun 2023 12:22:27 +0200 Subject: [PATCH 19/24] fix sendMail: sustituido modelo Journey por BusinessSchedule --- .../methods/worker-time-control/sendMail.js | 18 +++++++++--------- modules/worker/back/model-config.json | 6 +++--- .../{journey.json => business-schedule.json} | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) rename modules/worker/back/models/{journey.json => business-schedule.json} (64%) diff --git a/modules/worker/back/methods/worker-time-control/sendMail.js b/modules/worker/back/methods/worker-time-control/sendMail.js index 2c827e320..3d57ebbbd 100644 --- a/modules/worker/back/methods/worker-time-control/sendMail.js +++ b/modules/worker/back/methods/worker-time-control/sendMail.js @@ -230,21 +230,21 @@ module.exports = Self => { }, myOptions); } else { const weekDay = day.dated.getDay(); - const journeys = await models.Journey.find({ + const journeys = await models.BusinessSchedule.find({ where: { - business_id: day.businessFk, - day_id: weekDay + businessFk: day.businessFk, + weekday: weekDay } }, myOptions); let timeTableDecimalInSeconds = 0; for (let journey of journeys) { const start = Date.vnNew(); - const [startHours, startMinutes, startSeconds] = getTime(journey.start); + const [startHours, startMinutes, startSeconds] = getTime(journey.started); start.setHours(startHours, startMinutes, startSeconds, 0); const end = Date.vnNew(); - const [endHours, endMinutes, endSeconds] = getTime(journey.end); + const [endHours, endMinutes, endSeconds] = getTime(journey.ended); end.setHours(endHours, endMinutes, endSeconds, 0); const result = (end - start) / 1000; @@ -255,7 +255,7 @@ module.exports = Self => { const timeTableDecimal = timeTableDecimalInSeconds / 3600; if (day.timeWorkDecimal == timeTableDecimal) { const timed = new Date(day.dated); - const [startHours, startMinutes, startSeconds] = getTime(journey.start); + const [startHours, startMinutes, startSeconds] = getTime(journey.started); await models.WorkerTimeControl.create({ userFk: day.workerFk, timed: timed.setHours(startHours, startMinutes, startSeconds), @@ -263,7 +263,7 @@ module.exports = Self => { isSendMail: true }, myOptions); - const [endHours, endMinutes, endSeconds] = getTime(journey.end); + const [endHours, endMinutes, endSeconds] = getTime(journey.ended); await models.WorkerTimeControl.create({ userFk: day.workerFk, timed: timed.setHours(endHours, endMinutes, endSeconds), @@ -276,7 +276,7 @@ module.exports = Self => { }); if (journey == minStart) { const timed = new Date(day.dated); - const [startHours, startMinutes, startSeconds] = getTime(journey.start); + const [startHours, startMinutes, startSeconds] = getTime(journey.started); await models.WorkerTimeControl.create({ userFk: day.workerFk, timed: timed.setHours(startHours, startMinutes, startSeconds), @@ -304,7 +304,7 @@ module.exports = Self => { }); if (journey == minStart) { const timed = new Date(day.dated); - const [startHours, startMinutes, startSeconds] = getTime(journey.start); + const [startHours, startMinutes, startSeconds] = getTime(journey.started); await models.WorkerTimeControl.create({ userFk: day.workerFk, timed: timed.setHours(startHours + 1, startMinutes, startSeconds), diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index fd34c013b..60ec273a5 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -2,6 +2,9 @@ "AbsenceType": { "dataSource": "vn" }, + "BusinessSchedule": { + "dataSource": "vn" + }, "Calendar": { "dataSource": "vn" }, @@ -38,9 +41,6 @@ "EducationLevel": { "dataSource": "vn" }, - "Journey": { - "dataSource": "vn" - }, "ProfileType":{ "dataSource": "vn" }, diff --git a/modules/worker/back/models/journey.json b/modules/worker/back/models/business-schedule.json similarity index 64% rename from modules/worker/back/models/journey.json rename to modules/worker/back/models/business-schedule.json index b7d5f2817..8329d9291 100644 --- a/modules/worker/back/models/journey.json +++ b/modules/worker/back/models/business-schedule.json @@ -1,26 +1,26 @@ { - "name": "Journey", + "name": "BusinessSchedule", "base": "VnModel", "options": { "mysql": { - "table": "postgresql.journey" + "table": "vn.businessSchedule" } }, "properties": { - "journey_id": { + "id": { "id": true, "type": "number" }, - "day_id": { + "weekday": { "type": "number" }, - "start": { + "started": { "type": "date" }, - "end": { + "ended": { "type": "date" }, - "business_id": { + "businessFk": { "type": "number" } } From 01175a4c6c1d3ecfed42a7868422f4b005794f3f Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Jun 2023 12:32:34 +0200 Subject: [PATCH 20/24] quitado vn --- modules/worker/back/models/business-schedule.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/back/models/business-schedule.json b/modules/worker/back/models/business-schedule.json index 8329d9291..0cc17c844 100644 --- a/modules/worker/back/models/business-schedule.json +++ b/modules/worker/back/models/business-schedule.json @@ -3,7 +3,7 @@ "base": "VnModel", "options": { "mysql": { - "table": "vn.businessSchedule" + "table": "businessSchedule" } }, "properties": { From 35cf48314a0f72a91cf60f78a76e05154bb8e271 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2023 13:51:26 +0200 Subject: [PATCH 21/24] refs #4090 back memory limit increased because of pupeteer --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 13a7bc751..0d2db1a63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: - node.role == worker resources: limits: - memory: 4G + memory: 8G configs: datasources: external: true From 5be79bbdef6bc3eacd58cf018189131c8906df83 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2023 15:31:36 +0200 Subject: [PATCH 22/24] refs #5667 VnUser translations added --- modules/account/back/locale/vn-user/en.yml | 3 +++ modules/account/back/locale/vn-user/es.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/account/back/locale/vn-user/en.yml b/modules/account/back/locale/vn-user/en.yml index 135cf75b4..cb6a34ec5 100644 --- a/modules/account/back/locale/vn-user/en.yml +++ b/modules/account/back/locale/vn-user/en.yml @@ -15,3 +15,6 @@ columns: image: image hasGrant: has grant userFk: user + recoverPass: recover password + role: role + sync: pending sync diff --git a/modules/account/back/locale/vn-user/es.yml b/modules/account/back/locale/vn-user/es.yml index 53086ae2d..c11655598 100644 --- a/modules/account/back/locale/vn-user/es.yml +++ b/modules/account/back/locale/vn-user/es.yml @@ -15,3 +15,6 @@ columns: image: imagen hasGrant: puede delegar userFk: usuario + recoverPass: recuperar contraseña + role: rol + sync: Pendiente de sincronizar From 45eba4533a260297c54270d1d4dfd976216212a8 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2023 15:47:45 +0200 Subject: [PATCH 23/24] refs #5667 VnUser translation added --- modules/account/back/locale/vn-user/en.yml | 1 + modules/account/back/locale/vn-user/es.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/account/back/locale/vn-user/en.yml b/modules/account/back/locale/vn-user/en.yml index cb6a34ec5..0525a27af 100644 --- a/modules/account/back/locale/vn-user/en.yml +++ b/modules/account/back/locale/vn-user/en.yml @@ -18,3 +18,4 @@ columns: recoverPass: recover password role: role sync: pending sync + lastPassChange: password changed diff --git a/modules/account/back/locale/vn-user/es.yml b/modules/account/back/locale/vn-user/es.yml index c11655598..648c43ed5 100644 --- a/modules/account/back/locale/vn-user/es.yml +++ b/modules/account/back/locale/vn-user/es.yml @@ -18,3 +18,4 @@ columns: recoverPass: recuperar contraseña role: rol sync: Pendiente de sincronizar + lastPassChange: contraseña modificada From 47c6ad6a7135f7d000d1053b74669f7944539724 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2023 15:48:27 +0200 Subject: [PATCH 24/24] refs #5667 Translation fix --- modules/account/back/locale/vn-user/en.yml | 2 +- modules/account/back/locale/vn-user/es.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/account/back/locale/vn-user/en.yml b/modules/account/back/locale/vn-user/en.yml index 0525a27af..51de7c40d 100644 --- a/modules/account/back/locale/vn-user/en.yml +++ b/modules/account/back/locale/vn-user/en.yml @@ -18,4 +18,4 @@ columns: recoverPass: recover password role: role sync: pending sync - lastPassChange: password changed + lastPassChange: password changed diff --git a/modules/account/back/locale/vn-user/es.yml b/modules/account/back/locale/vn-user/es.yml index 648c43ed5..85e8bc0dc 100644 --- a/modules/account/back/locale/vn-user/es.yml +++ b/modules/account/back/locale/vn-user/es.yml @@ -18,4 +18,4 @@ columns: recoverPass: recuperar contraseña role: rol sync: Pendiente de sincronizar - lastPassChange: contraseña modificada + lastPassChange: contraseña modificada