From 070613de643458e2ea8af353edd547a016564995 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 27 Aug 2024 12:58:08 +0200 Subject: [PATCH 01/31] feat: refs #7686 Added new alertLevel APPROVED and changes in vn.state.alertLevel --- .../11202-limeRuscus/00-addAlertLevel.sql | 6 ++++++ .../01-updateStateAlertLevel.sql | 21 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 db/versions/11202-limeRuscus/00-addAlertLevel.sql create mode 100644 db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql diff --git a/db/versions/11202-limeRuscus/00-addAlertLevel.sql b/db/versions/11202-limeRuscus/00-addAlertLevel.sql new file mode 100644 index 0000000000..1f667946bb --- /dev/null +++ b/db/versions/11202-limeRuscus/00-addAlertLevel.sql @@ -0,0 +1,6 @@ +UPDATE vn.alertLevel SET id = 5 WHERE id = 4; +UPDATE vn.alertLevel SET id = 4 WHERE id = 3; +UPDATE vn.alertLevel SET id = 3 WHERE id = 2; +UPDATE vn.alertLevel SET id = 2 WHERE id = 1; +INSERT INTO vn.alertLevel (code, id, hasToRecalcPrice) + VALUES ('APPROVED', 1, 1) \ No newline at end of file diff --git a/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql b/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql new file mode 100644 index 0000000000..f7261c08ac --- /dev/null +++ b/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql @@ -0,0 +1,21 @@ +UPDATE vn.state + SET alertLevel = 1 -- APPROVED + WHERE id IN ( + 3, -- Ok + 4 -- Impreso + ); + +UPDATE vn.state + SET alertLevel = 2 -- ON_PREVIOUS + WHERE id IN ( + 36, -- Previa Revisando + 37, -- Previa Revisado + 26, -- Prep Previa + 28, -- Previa OK + 29, -- Previa Impreso + 31, -- Polizon Impreso + 32, -- Polizon OK + 20, -- Asignado + 23, -- URGENTE + 33 -- Auto_Impreso + ); From 28c94b5f324fd40ce60a23677cb274cf8b3c4aa3 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 27 Aug 2024 12:58:48 +0200 Subject: [PATCH 02/31] feat: refs #7686 Changes in procs --- .../bs/procedures/inventoryDiscrepancyDetail_replace.sql | 5 ++--- db/routines/hedera/procedures/order_confirmWithUser.sql | 2 +- db/routines/vn/procedures/itemShelvingRadar.sql | 2 +- db/routines/vn/procedures/productionControl.sql | 2 +- db/routines/vn/procedures/ticketDown_PrintableSelection.sql | 2 +- db/routines/vn/procedures/ticketGetVisibleAvailable.sql | 2 +- db/routines/vn/procedures/ticket_DelayTruck.sql | 2 +- db/routines/vn/procedures/ticket_canMerge.sql | 4 ++-- db/routines/vn/procedures/ticket_canbePostponed.sql | 2 +- modules/monitor/back/methods/sales-monitor/salesFilter.js | 2 +- modules/ticket/back/methods/ticket/filter.js | 2 +- modules/ticket/back/methods/ticket/getTicketsFuture.js | 2 +- 12 files changed, 14 insertions(+), 15 deletions(-) diff --git a/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql b/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql index 8630053734..481082766c 100644 --- a/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql +++ b/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql @@ -65,15 +65,14 @@ BEGIN JOIN vn.ticketState ts ON ts.ticketFk = t.id JOIN vn.alertLevel al ON al.id = ts.alertLevel WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - AND s.isPicked = FALSE - AND al.code = 'FREE' + AND NOT s.isPicked + AND al.code IN ('FREE', 'APPROVED') AND t.warehouseFk = vWarehouseFk GROUP BY s.itemFk HAVING notPicked ) s ON s.itemFk = v.item_id WHERE v.calc_id = vCalc AND NOT v.visible <=> tv.totalVisible; - END LOOP; CLOSE cWarehouses; diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index 2b033b704b..e293427e88 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -134,7 +134,7 @@ BEGIN ) SELECT t.id INTO vTicketFk FROM vn.ticket t - JOIN vn.alertLevel al ON al.code = 'FREE' + JOIN vn.alertLevel al ON al.code IN ('FREE', 'APPROVED') LEFT JOIN tPrevia tp ON tp.ticketFk = t.id LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id JOIN hedera.`order` o ON o.address_id = t.addressFk diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql index aa95d05037..3c7ba577b1 100644 --- a/db/routines/vn/procedures/itemShelvingRadar.sql +++ b/db/routines/vn/procedures/itemShelvingRadar.sql @@ -106,7 +106,7 @@ BEGIN JOIN alertLevel al ON al.id = tst.alertLevel JOIN sale s ON s.ticketFk = t.id WHERE t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' + AND al.code IN ('FREE', 'APPROVED') GROUP BY s.itemFk ) sub ON sub.itemFk = ishr.itemFk ORDER BY i.typeFk, i.longName; diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql index 84717a19aa..16a2ada935 100644 --- a/db/routines/vn/procedures/productionControl.sql +++ b/db/routines/vn/procedures/productionControl.sql @@ -82,7 +82,7 @@ proc: BEGIN rm.bufferFk FROM tmp.productionTicket tt JOIN ticket t ON tt.ticketFk = t.id - JOIN alertLevel al ON al.code = 'FREE' + JOIN alertLevel al ON al.code = 'APPROVED' LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id LEFT JOIN `state` st ON st.id = tst.state LEFT JOIN client c ON c.id = t.clientFk diff --git a/db/routines/vn/procedures/ticketDown_PrintableSelection.sql b/db/routines/vn/procedures/ticketDown_PrintableSelection.sql index 45002dd1ff..22de6573a1 100644 --- a/db/routines/vn/procedures/ticketDown_PrintableSelection.sql +++ b/db/routines/vn/procedures/ticketDown_PrintableSelection.sql @@ -13,7 +13,7 @@ BEGIN JOIN vn.parking p ON p.id = sh.parkingFk WHERE p.sectorFk = vSectorFk ) sub ON sub.id = td.ticketFk - JOIN vn.ticketDown_SelectionType tdst ON tdst.description = 'FREE' + JOIN vn.ticketDown_SelectionType tdst ON tdst.description IN ('FREE', 'APPROVED') JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED' SET td.selected = tdst2.id WHERE td.selected = tdst.id; diff --git a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql index 3717d57e3a..7589e2702c 100644 --- a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql +++ b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql @@ -12,7 +12,7 @@ BEGIN SELECT t.warehouseFk, t.shipped, ts.alertLevel, al.id INTO vWarehouse, vShipped, vAlertLevel, vAlertLevelFree FROM ticket t - JOIN alertLevel al ON al.code = 'FREE' + JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED') LEFT JOIN ticketState ts ON ts.ticketFk = vTicket WHERE t.id = vTicket; diff --git a/db/routines/vn/procedures/ticket_DelayTruck.sql b/db/routines/vn/procedures/ticket_DelayTruck.sql index 81896dd8e4..64598646c4 100644 --- a/db/routines/vn/procedures/ticket_DelayTruck.sql +++ b/db/routines/vn/procedures/ticket_DelayTruck.sql @@ -13,7 +13,7 @@ BEGIN CREATE TEMPORARY TABLE tTicket SELECT ticketFk FROM tmp.productionBuffer - JOIN alertLevel al ON al.code = 'FREE' + JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED') WHERE shipped = util.VN_CURDATE() AND problem LIKE '%I:%' AND (HH <= vHour OR HH = vHour AND mm < vMinute) diff --git a/db/routines/vn/procedures/ticket_canMerge.sql b/db/routines/vn/procedures/ticket_canMerge.sql index c3f211027d..91b77296cb 100644 --- a/db/routines/vn/procedures/ticket_canMerge.sql +++ b/db/routines/vn/procedures/ticket_canMerge.sql @@ -48,14 +48,14 @@ BEGIN WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' + AND al.code IN ('FREE', 'APPROVED') GROUP BY t.id ) sub GROUP BY sub.addressFk ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' + AND al.code IN ('FREE', 'APPROVED') AND tp.ticketFk IS NULL GROUP BY sv.ticketFk HAVING liters <= vLitersMax diff --git a/db/routines/vn/procedures/ticket_canbePostponed.sql b/db/routines/vn/procedures/ticket_canbePostponed.sql index 442059b99a..f5065746bd 100644 --- a/db/routines/vn/procedures/ticket_canbePostponed.sql +++ b/db/routines/vn/procedures/ticket_canbePostponed.sql @@ -65,7 +65,7 @@ BEGIN ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated) AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' + AND al.code IN ('FREE', 'APPROVED') AND tp.ticketFk IS NULL GROUP BY sv.ticketFk HAVING futureId; diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index 33b37d8a4a..513efc4122 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -288,7 +288,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) + WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL) AND f.shipped >= ?`, [date]); stmts.push(stmt); diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 3e8b732afd..5ac72539ad 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -299,7 +299,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) + WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL) AND f.shipped >= ? `, [date]); diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js index 0fd21ea74e..41497062fb 100644 --- a/modules/ticket/back/methods/ticket/getTicketsFuture.js +++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js @@ -152,7 +152,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped, f.lines, f.liters FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) + WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL) `); stmts.push(stmt); From 477646ba311893f8a22e47785fdd5dbd7fff597e Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 20 Jan 2025 14:43:14 +0100 Subject: [PATCH 03/31] feat: refs #8227 Roadmap changes --- .../procedures/vehicle_checkNumberPlate.sql | 27 ++++++++++++++----- .../vn/triggers/roadmap_beforeInsert.sql | 2 ++ .../vn/triggers/roadmap_beforeUpdate.sql | 2 ++ .../11416-goldenTulip/00-firstScript.sql | 5 ++++ 4 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 db/versions/11416-goldenTulip/00-firstScript.sql diff --git a/db/routines/vn/procedures/vehicle_checkNumberPlate.sql b/db/routines/vn/procedures/vehicle_checkNumberPlate.sql index cbbcbec639..613dda3682 100644 --- a/db/routines/vn/procedures/vehicle_checkNumberPlate.sql +++ b/db/routines/vn/procedures/vehicle_checkNumberPlate.sql @@ -1,17 +1,30 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2)) +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`( + vNumberPlate VARCHAR(10), + vCountryCodeFk VARCHAR(2) +) BEGIN /** - * Comprueba si la matricula pasada tiene el formato correcto dependiendo del pais del vehiculo + * Comprueba si la matricula pasada tiene el formato + * correcto dependiendo del pais del vehiculo. + * + * @param vNumberPlate Número de matricula + * @param vCountryCodeFk Código de pais */ DECLARE vRegex VARCHAR(45); - SELECT vp.regex INTO vRegex - FROM vehiclePlateRegex vp - WHERE vp.countryCodeFk = vCountryCodeFk; - + IF vCountryCodeFk IS NULL THEN + SET vRegex = '^[A-Z0-9 -]{6,12}$'; + ELSE + SELECT regex INTO vRegex + FROM vehiclePlateRegex + WHERE countryCodeFk = vCountryCodeFk; + END IF; + IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN - CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk)); + CALL util.throw(CONCAT('La matricula ', vNumberPlate, + ' no es valida', IF(vCountryCodeFk IS NOT NULL, + CONCAT(' para ', vCountryCodeFk), ''))); END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 2f9481140a..0a4386e633 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert` BEFORE INSERT ON `roadmap` FOR EACH ROW BEGIN + CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); + CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); IF NEW.driver1Fk IS NOT NULL THEN SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk); ELSE diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index a2a02e96a5..b381854ed5 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate` BEFORE UPDATE ON `roadmap` FOR EACH ROW BEGIN + CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); + CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); IF NEW.driver1Fk IS NOT NULL THEN SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk); ELSE diff --git a/db/versions/11416-goldenTulip/00-firstScript.sql b/db/versions/11416-goldenTulip/00-firstScript.sql new file mode 100644 index 0000000000..9b89fcfa6f --- /dev/null +++ b/db/versions/11416-goldenTulip/00-firstScript.sql @@ -0,0 +1,5 @@ +ALTER TABLE vn.roadmap + MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque'; +ALTER TABLE vn.route + ADD roadmapStopFk int(11) NULL, + ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE; From 482fe77159f72144b3f733f7b86df44509586987 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 21 Jan 2025 14:03:50 +0100 Subject: [PATCH 04/31] feat: refs #8227 Roadmap changes --- db/dump/fixtures.before.sql | 4 ++-- db/routines/vn/triggers/roadmapStop_beforeInsert.sql | 3 +-- db/routines/vn/triggers/roadmapStop_beforeUpdate.sql | 3 +-- db/routines/vn/triggers/roadmap_beforeInsert.sql | 12 ++++++------ db/routines/vn/triggers/roadmap_beforeUpdate.sql | 12 ++++++------ db/versions/11416-goldenTulip/00-firstScript.sql | 8 ++++---- db/versions/11416-goldenTulip/01-firstScript.sql | 1 + db/versions/11416-goldenTulip/02-firstScript.sql | 4 ++++ 8 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 db/versions/11416-goldenTulip/01-firstScript.sql create mode 100644 db/versions/11416-goldenTulip/02-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 590fe34b67..cc1a9fc6f1 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2749,13 +2749,13 @@ INSERT INTO `vn`.`roadmapAddress` (`addressFk`) (3), (4); -INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `userFk`, `price`, `driverName`) +INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `editorFk`, `price`, `driverName`) VALUES (1, 'val-algemesi', '1234-BCD', '9876-BCD', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'), (2, 'alg-valencia', '2345-CDF', '8765-BCD', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'), (3, 'alz-algemesi', '3456-DFG', '7654-BCD', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman'); -INSERT INTO `vn`.`roadmapStop` (`id`, `roadmapFk`, `addressFk`, `eta`, `description`, `userFk`) +INSERT INTO `vn`.`roadmapStop` (`id`, `roadmapFk`, `addressFk`, `eta`, `description`, `editorFk`) VALUES (1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1), (2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1), diff --git a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql index d71942feab..b87a52bdc8 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql @@ -3,8 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeInser BEFORE INSERT ON `roadmapStop` FOR EACH ROW BEGIN - + SET NEW.editorFk = account.myUser_getId(); SET NEW.description = UCASE(NEW.description); - END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql index c3cbf25976..ec4dbe5baa 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql @@ -3,8 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdat BEFORE UPDATE ON `roadmapStop` FOR EACH ROW BEGIN - + SET NEW.editorFk = account.myUser_getId(); SET NEW.description = UCASE(NEW.description); - END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 0a4386e633..118653d44f 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -3,12 +3,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert` BEFORE INSERT ON `roadmap` FOR EACH ROW BEGIN - CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); - CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); - IF NEW.driver1Fk IS NOT NULL THEN - SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk); - ELSE - SET NEW.driverName = NULL; + SET NEW.editorFk = account.myUser_getId(); + IF NEW.tractorPlate IS NOT NULL THEN + CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); + END IF; + IF NEW.trailerPlate IS NOT NULL THEN + CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index b381854ed5..a60b1e892e 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -3,12 +3,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate` BEFORE UPDATE ON `roadmap` FOR EACH ROW BEGIN - CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); - CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); - IF NEW.driver1Fk IS NOT NULL THEN - SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk); - ELSE - SET NEW.driverName = NULL; + SET NEW.editorFk = account.myUser_getId(); + IF NEW.tractorPlate IS NOT NULL THEN + CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); + END IF; + IF NEW.trailerPlate IS NOT NULL THEN + CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/00-firstScript.sql b/db/versions/11416-goldenTulip/00-firstScript.sql index 9b89fcfa6f..d06f25493b 100644 --- a/db/versions/11416-goldenTulip/00-firstScript.sql +++ b/db/versions/11416-goldenTulip/00-firstScript.sql @@ -1,5 +1,5 @@ ALTER TABLE vn.roadmap - MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque'; -ALTER TABLE vn.route - ADD roadmapStopFk int(11) NULL, - ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE; + MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque', + CHANGE driver1Fk driverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Conductor principal' AFTER driverName, + CHANGE driver2Fk codriverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Copiloto' AFTER driverFk, + CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/01-firstScript.sql b/db/versions/11416-goldenTulip/01-firstScript.sql new file mode 100644 index 0000000000..76b69387c4 --- /dev/null +++ b/db/versions/11416-goldenTulip/01-firstScript.sql @@ -0,0 +1 @@ +ALTER TABLE vn.roadmapStop CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/02-firstScript.sql b/db/versions/11416-goldenTulip/02-firstScript.sql new file mode 100644 index 0000000000..89833fe8b4 --- /dev/null +++ b/db/versions/11416-goldenTulip/02-firstScript.sql @@ -0,0 +1,4 @@ +ALTER TABLE vn.route + ADD roadmapStopFk int(11) NULL, + ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE, + CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER roadmapStopFk; From 052630d268139c62573f0e5430fcc0c54277fade Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 22 Jan 2025 12:40:58 +0100 Subject: [PATCH 05/31] feat: refs #8227 Roadmap changes --- db/routines/vn/triggers/roadmapStop_beforeInsert.sql | 5 +++++ db/routines/vn/triggers/roadmapStop_beforeUpdate.sql | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql index b87a52bdc8..9ec8b72cfa 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql @@ -5,5 +5,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeInser BEGIN SET NEW.editorFk = account.myUser_getId(); SET NEW.description = UCASE(NEW.description); + IF NEW.roadmapFk IS NOT NULL THEN + IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN + CALL util.throw('Departure time can not be after arrival time'); + END IF; + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql index ec4dbe5baa..cff48846ae 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql @@ -5,5 +5,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdat BEGIN SET NEW.editorFk = account.myUser_getId(); SET NEW.description = UCASE(NEW.description); + IF (NOT (NEW.roadmapFk <=> OLD.roadmapFk) AND NEW.roadmapFk IS NOT NULL) + OR (NOT (NEW.eta <=> OLD.eta) AND NEW.eta IS NOT NULL) THEN + + IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN + CALL util.throw('Departure time can not be after arrival time'); + END IF; + END IF; END$$ DELIMITER ; From 162cd4d69ebe1dc4c803a636375e4e31de151fd2 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 23 Jan 2025 14:54:59 +0100 Subject: [PATCH 06/31] feat: refs #8227 Roadmap major changes --- .../getTimeBetweenRoadmapAddresses.sql | 35 +++++++++++++++++++ .../vn/triggers/roadmap_beforeInsert.sql | 4 +++ .../vn/triggers/roadmap_beforeUpdate.sql | 4 +++ .../11416-goldenTulip/00-firstScript.sql | 7 +++- .../11416-goldenTulip/01-firstScript.sql | 8 ++++- .../11416-goldenTulip/02-firstScript.sql | 7 ++-- .../11416-goldenTulip/03-firstScript.sql | 4 +++ .../11416-goldenTulip/04-firstScript.sql | 2 ++ 8 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql create mode 100644 db/versions/11416-goldenTulip/03-firstScript.sql create mode 100644 db/versions/11416-goldenTulip/04-firstScript.sql diff --git a/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql b/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql new file mode 100644 index 0000000000..5a647d51b7 --- /dev/null +++ b/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql @@ -0,0 +1,35 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getTimeBetweenRoadmapAddresses`( + vRoadmapAddressFrom INT, + vRoadmapAddressTo INT +) + RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Retorna el tiempo en segundos que se suele tardar en ir + * de un punto de distribución a otro en una ruta troncal. + * + * @param vRoadmapAddressFrom Punto de distribución de origen + * @param vRoadmapAddressTo Punto de distribución de destino + * @return Tiempo en segundos + */ + DECLARE vSeconds INT; + + WITH wRoadmap AS ( + SELECT ROW_NUMBER() OVER(PARTITION BY roadmapFk ORDER BY eta) `sequence`, + roadmapFk, + roadmapAddressFk, + eta + FROM vn.roadmapStop + ) + SELECT AVG(TIME_TO_SEC(TIMEDIFF(rTo.eta, rFrom.eta))) INTO vSeconds + FROM wRoadmap rFrom + JOIN wRoadmap rTo ON rTo.roadmapFk = rFrom.roadmapFk + WHERE rFrom.roadmapAddressFk = vRoadmapAddressFrom + AND rTo.roadmapAddressFk = vRoadmapAddressTo + AND rFrom.`sequence` + 1 = rTo.`sequence`; + + RETURN vSeconds; +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 118653d44f..884fe0bbcf 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -4,6 +4,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); + IF NEW.etd > NEW.eta THEN + CALL util.throw('Departure time can not be after arrival time'); + END IF; + IF NEW.tractorPlate IS NOT NULL THEN CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); END IF; diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index a60b1e892e..96eec2aaf9 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -4,6 +4,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); + IF NEW.etd > NEW.eta THEN + CALL util.throw('Departure time can not be after arrival time'); + END IF; + IF NEW.tractorPlate IS NOT NULL THEN CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); END IF; diff --git a/db/versions/11416-goldenTulip/00-firstScript.sql b/db/versions/11416-goldenTulip/00-firstScript.sql index d06f25493b..e2962592cf 100644 --- a/db/versions/11416-goldenTulip/00-firstScript.sql +++ b/db/versions/11416-goldenTulip/00-firstScript.sql @@ -1,5 +1,10 @@ ALTER TABLE vn.roadmap + COMMENT='Rutas troncales (trailers)', MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque', + MODIFY COLUMN trailerPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL, + MODIFY COLUMN etd datetime NOT NULL COMMENT 'Tiempo estimado de salida', CHANGE driver1Fk driverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Conductor principal' AFTER driverName, CHANGE driver2Fk codriverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Copiloto' AFTER driverFk, - CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3; \ No newline at end of file + CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3, + ADD eta datetime NOT NULL AFTER etd COMMENT 'Tiempo estimado de llegada', + ADD roadmapAddressFk int(11) NOT NULL AFTER `name`; diff --git a/db/versions/11416-goldenTulip/01-firstScript.sql b/db/versions/11416-goldenTulip/01-firstScript.sql index 76b69387c4..58cd44f0dd 100644 --- a/db/versions/11416-goldenTulip/01-firstScript.sql +++ b/db/versions/11416-goldenTulip/01-firstScript.sql @@ -1 +1,7 @@ -ALTER TABLE vn.roadmapStop CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL; \ No newline at end of file +UPDATE vn.roadmap + SET roadmapAddressFk = (SELECT MIN(addressFk) FROM vn.roadmapAddress), + eta = etd + INTERVAL 1 DAY; + +ALTER TABLE vn.roadmap + ADD CONSTRAINT roadmap_roadmapAddress_FK FOREIGN KEY (roadmapAddressFk) + REFERENCES vn.roadmapAddress(addressFk) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/11416-goldenTulip/02-firstScript.sql b/db/versions/11416-goldenTulip/02-firstScript.sql index 89833fe8b4..8713c50908 100644 --- a/db/versions/11416-goldenTulip/02-firstScript.sql +++ b/db/versions/11416-goldenTulip/02-firstScript.sql @@ -1,4 +1,3 @@ -ALTER TABLE vn.route - ADD roadmapStopFk int(11) NULL, - ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE, - CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER roadmapStopFk; +ALTER TABLE vn.roadmapStop + CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL, + CHANGE addressFk roadmapAddressFk int(11) DEFAULT NULL NULL; diff --git a/db/versions/11416-goldenTulip/03-firstScript.sql b/db/versions/11416-goldenTulip/03-firstScript.sql new file mode 100644 index 0000000000..89833fe8b4 --- /dev/null +++ b/db/versions/11416-goldenTulip/03-firstScript.sql @@ -0,0 +1,4 @@ +ALTER TABLE vn.route + ADD roadmapStopFk int(11) NULL, + ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE, + CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER roadmapStopFk; diff --git a/db/versions/11416-goldenTulip/04-firstScript.sql b/db/versions/11416-goldenTulip/04-firstScript.sql new file mode 100644 index 0000000000..588810ded9 --- /dev/null +++ b/db/versions/11416-goldenTulip/04-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.roadmapAddress + COMMENT='Direcciones de los troncales o también llamados puntos de distribución'; From 306eb6a0599490a82672be7ae8ab18aa377efab3 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 24 Jan 2025 07:26:25 +0100 Subject: [PATCH 07/31] feat: refs #8227 Roadmap fix version --- db/dump/fixtures.before.sql | 10 +++++----- .../11416-goldenTulip/00-firstScript.sql | 12 +++--------- .../11416-goldenTulip/01-firstScript.sql | 18 ++++++++++++------ .../11416-goldenTulip/02-firstScript.sql | 16 +++++++++++++--- .../11416-goldenTulip/03-firstScript.sql | 7 +++---- .../11416-goldenTulip/04-firstScript.sql | 6 ++++-- .../11416-goldenTulip/05-firstScript.sql | 2 ++ 7 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 db/versions/11416-goldenTulip/05-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index cc1a9fc6f1..eb11264e70 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2749,13 +2749,13 @@ INSERT INTO `vn`.`roadmapAddress` (`addressFk`) (3), (4); -INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `observations`, `editorFk`, `price`, `driverName`) +INSERT INTO `vn`.`roadmap` (`id`, `name`, `tractorPlate`, `trailerPlate`, `phone`, `supplierFk`, `etd`, `eta`, `observations`, `editorFk`, `price`, `driverName`) VALUES - (1, 'val-algemesi', '1234-BCD', '9876-BCD', '111111111', 1, util.VN_NOW(), 'this is test observation', 1, 15, 'Batman'), - (2, 'alg-valencia', '2345-CDF', '8765-BCD', '111111111', 1, util.VN_NOW(), 'test observation', 1, 20, 'Robin'), - (3, 'alz-algemesi', '3456-DFG', '7654-BCD', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'observations...', 2, 25, 'Driverman'); + (1, 'val-algemesi', '1234-BCD', '9876-BCD', '111111111', 1, util.VN_NOW(), DATE_ADD(util.VN_NOW(), INTERVAL 2 DAY), 'this is test observation', 1, 15, 'Batman'), + (2, 'alg-valencia', '2345-CDF', '8765-BCD', '111111111', 1, util.VN_NOW(), DATE_ADD(util.VN_NOW(), INTERVAL 5 DAY), 'test observation', 1, 20, 'Robin'), + (3, 'alz-algemesi', '3456-DFG', '7654-BCD', '222222222', 2, DATE_ADD(util.VN_NOW(), INTERVAL 3 DAY), DATE_ADD(util.VN_NOW(), INTERVAL 6 DAY), 'observations...', 2, 25, 'Driverman'); -INSERT INTO `vn`.`roadmapStop` (`id`, `roadmapFk`, `addressFk`, `eta`, `description`, `editorFk`) +INSERT INTO `vn`.`roadmapStop` (`id`, `roadmapFk`, `roadmapAddressFk`, `eta`, `description`, `editorFk`) VALUES (1, 1, 1, DATE_ADD(util.VN_NOW(), INTERVAL 1 DAY), 'Best truck in fleet', 1), (2, 1, 2, DATE_ADD(util.VN_NOW(), INTERVAL '1 2' DAY_HOUR), 'Second truck in fleet', 1), diff --git a/db/versions/11416-goldenTulip/00-firstScript.sql b/db/versions/11416-goldenTulip/00-firstScript.sql index e2962592cf..aa410c52f9 100644 --- a/db/versions/11416-goldenTulip/00-firstScript.sql +++ b/db/versions/11416-goldenTulip/00-firstScript.sql @@ -1,10 +1,4 @@ ALTER TABLE vn.roadmap - COMMENT='Rutas troncales (trailers)', - MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque', - MODIFY COLUMN trailerPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL, - MODIFY COLUMN etd datetime NOT NULL COMMENT 'Tiempo estimado de salida', - CHANGE driver1Fk driverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Conductor principal' AFTER driverName, - CHANGE driver2Fk codriverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Copiloto' AFTER driverFk, - CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3, - ADD eta datetime NOT NULL AFTER etd COMMENT 'Tiempo estimado de llegada', - ADD roadmapAddressFk int(11) NOT NULL AFTER `name`; + DROP FOREIGN KEY roadmap_worker_FK_2, + DROP FOREIGN KEY roadmap_worker_FK, + DROP FOREIGN KEY roadmap_ibfk_2; diff --git a/db/versions/11416-goldenTulip/01-firstScript.sql b/db/versions/11416-goldenTulip/01-firstScript.sql index 58cd44f0dd..68c369800f 100644 --- a/db/versions/11416-goldenTulip/01-firstScript.sql +++ b/db/versions/11416-goldenTulip/01-firstScript.sql @@ -1,7 +1,13 @@ -UPDATE vn.roadmap - SET roadmapAddressFk = (SELECT MIN(addressFk) FROM vn.roadmapAddress), - eta = etd + INTERVAL 1 DAY; - ALTER TABLE vn.roadmap - ADD CONSTRAINT roadmap_roadmapAddress_FK FOREIGN KEY (roadmapAddressFk) - REFERENCES vn.roadmapAddress(addressFk) ON DELETE RESTRICT ON UPDATE CASCADE; + COMMENT='Rutas troncales (trailers)', + MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque', + MODIFY COLUMN trailerPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL, + MODIFY COLUMN etd datetime NOT NULL COMMENT 'Tiempo estimado de salida', + ADD eta datetime NOT NULL COMMENT 'Tiempo estimado de llegada' AFTER etd, + ADD roadmapAddressFk int(11) NOT NULL AFTER `name`; + +-- Separamos los CHANGE por que si no arriba no se aplican +ALTER TABLE vn.roadmap + CHANGE driver1Fk driverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Conductor principal' AFTER driverName, + CHANGE driver2Fk codriverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Copiloto' AFTER driverFk, + CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/02-firstScript.sql b/db/versions/11416-goldenTulip/02-firstScript.sql index 8713c50908..f99334e9b9 100644 --- a/db/versions/11416-goldenTulip/02-firstScript.sql +++ b/db/versions/11416-goldenTulip/02-firstScript.sql @@ -1,3 +1,13 @@ -ALTER TABLE vn.roadmapStop - CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL, - CHANGE addressFk roadmapAddressFk int(11) DEFAULT NULL NULL; +UPDATE vn.roadmap + SET roadmapAddressFk = (SELECT MIN(addressFk) FROM vn.roadmapAddress), + eta = etd + INTERVAL 1 DAY; + +ALTER TABLE vn.roadmap + ADD CONSTRAINT roadmap_roadmapAddress_FK FOREIGN KEY (roadmapAddressFk) + REFERENCES vn.roadmapAddress(addressFk) ON DELETE RESTRICT ON UPDATE CASCADE, + ADD CONSTRAINT roadmap_driver_FK FOREIGN KEY (driverFk) + REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE, + ADD CONSTRAINT roadmap_driver_FK2 FOREIGN KEY (codriverFk) + REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE, + ADD CONSTRAINT roadmap_user_Fk FOREIGN KEY (editorFk) + REFERENCES account.user(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/11416-goldenTulip/03-firstScript.sql b/db/versions/11416-goldenTulip/03-firstScript.sql index 89833fe8b4..8713c50908 100644 --- a/db/versions/11416-goldenTulip/03-firstScript.sql +++ b/db/versions/11416-goldenTulip/03-firstScript.sql @@ -1,4 +1,3 @@ -ALTER TABLE vn.route - ADD roadmapStopFk int(11) NULL, - ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE, - CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER roadmapStopFk; +ALTER TABLE vn.roadmapStop + CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL, + CHANGE addressFk roadmapAddressFk int(11) DEFAULT NULL NULL; diff --git a/db/versions/11416-goldenTulip/04-firstScript.sql b/db/versions/11416-goldenTulip/04-firstScript.sql index 588810ded9..89833fe8b4 100644 --- a/db/versions/11416-goldenTulip/04-firstScript.sql +++ b/db/versions/11416-goldenTulip/04-firstScript.sql @@ -1,2 +1,4 @@ -ALTER TABLE vn.roadmapAddress - COMMENT='Direcciones de los troncales o también llamados puntos de distribución'; +ALTER TABLE vn.route + ADD roadmapStopFk int(11) NULL, + ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE, + CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER roadmapStopFk; diff --git a/db/versions/11416-goldenTulip/05-firstScript.sql b/db/versions/11416-goldenTulip/05-firstScript.sql new file mode 100644 index 0000000000..588810ded9 --- /dev/null +++ b/db/versions/11416-goldenTulip/05-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.roadmapAddress + COMMENT='Direcciones de los troncales o también llamados puntos de distribución'; From e9f1e28ac0dcadf5b93848e1623a04d5ed474147 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 24 Jan 2025 11:20:16 +0100 Subject: [PATCH 08/31] feat: refs #8227 Added roadmap_cloneDay --- .../vn/procedures/roadmap_cloneDay.sql | 71 +++++++++++++++++++ .../vn/triggers/roadmap_beforeInsert.sql | 1 + .../vn/triggers/roadmap_beforeUpdate.sql | 1 + .../11416-goldenTulip/01-firstScript.sql | 1 + .../11416-goldenTulip/03-firstScript.sql | 6 +- 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 db/routines/vn/procedures/roadmap_cloneDay.sql diff --git a/db/routines/vn/procedures/roadmap_cloneDay.sql b/db/routines/vn/procedures/roadmap_cloneDay.sql new file mode 100644 index 0000000000..51d6ba1aba --- /dev/null +++ b/db/routines/vn/procedures/roadmap_cloneDay.sql @@ -0,0 +1,71 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`roadmap_cloneDay`( + vDateToCopy DATE, + vDateToPaste DATE +) +BEGIN +/** + * Clona roadmaps de un día a otro, incluyendo las paradas y sin algunos + * campos de la tabla principal, como matrículas, conductores... + * + * @param vDateToCopy Fecha para copiar + * @param vDateToPaste Fecha para pegar + */ + DECLARE vDaysDiff INT; + DECLARE vNextRoadmapId INT; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + SET vDaysDiff = DATEDIFF(vDateToPaste, vDateToCopy); + + IF vDaysDiff IS NULL OR NOT vDaysDiff THEN + CALL util.throw("No valid dates"); + END IF; + + START TRANSACTION; + + SELECT AUTO_INCREMENT INTO vNextRoadmapId + FROM information_schema.tables + WHERE table_name = 'roadmap' + AND table_schema = 'vn'; + + CREATE OR REPLACE TEMPORARY TABLE tmp.roadmapsToCopy + ENGINE = MEMORY + SELECT ROW_NUMBER() OVER(ORDER BY id) rowOrder, + id, + `name`, + roadmapAddressFk, + etd, + eta, + observations, + price + FROM roadmap + WHERE etd BETWEEN vDateToCopy AND util.dayEnd(vDateToCopy); + + INSERT INTO roadmap (`name`, roadmapAddressFk, etd, eta, observations, price) + SELECT `name`, + roadmapAddressFk, + etd + INTERVAL vDaysDiff DAY, + eta + INTERVAL vDaysDiff DAY, + observations, + price + FROM tmp.roadmapsToCopy; + + INSERT INTO roadmapStop (roadmapFk, roadmapAddressFk, eta, `description`, bufferFk) + SELECT (rtc.rowOrder - 1) + vNextRoadmapId, + rs.roadmapAddressFk, + rs.eta + INTERVAL vDaysDiff DAY, + rs.description, + rs.bufferFk + FROM tmp.roadmapsToCopy rtc + JOIN roadmapStop rs ON rs.roadmapFk = rtc.id; + + COMMIT; + + DROP TEMPORARY TABLE tmp.roadmapsToCopy; +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 884fe0bbcf..4b0a1c847a 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -14,5 +14,6 @@ BEGIN IF NEW.trailerPlate IS NOT NULL THEN CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); END IF; + SET NEW.name = UCASE(NEW.name); END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index 96eec2aaf9..1ad547f556 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -14,5 +14,6 @@ BEGIN IF NEW.trailerPlate IS NOT NULL THEN CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); END IF; + SET NEW.name = UCASE(NEW.name); END$$ DELIMITER ; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/01-firstScript.sql b/db/versions/11416-goldenTulip/01-firstScript.sql index 68c369800f..0cd7942297 100644 --- a/db/versions/11416-goldenTulip/01-firstScript.sql +++ b/db/versions/11416-goldenTulip/01-firstScript.sql @@ -3,6 +3,7 @@ ALTER TABLE vn.roadmap MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque', MODIFY COLUMN trailerPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL, MODIFY COLUMN etd datetime NOT NULL COMMENT 'Tiempo estimado de salida', + MODIFY COLUMN `name` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL, ADD eta datetime NOT NULL COMMENT 'Tiempo estimado de llegada' AFTER etd, ADD roadmapAddressFk int(11) NOT NULL AFTER `name`; diff --git a/db/versions/11416-goldenTulip/03-firstScript.sql b/db/versions/11416-goldenTulip/03-firstScript.sql index 8713c50908..4df73139a6 100644 --- a/db/versions/11416-goldenTulip/03-firstScript.sql +++ b/db/versions/11416-goldenTulip/03-firstScript.sql @@ -1,3 +1,7 @@ ALTER TABLE vn.roadmapStop CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL, - CHANGE addressFk roadmapAddressFk int(11) DEFAULT NULL NULL; + CHANGE addressFk roadmapAddressFk int(11) DEFAULT NULL NULL, + DROP FOREIGN KEY expeditionTruck_FK_2; + +ALTER TABLE vn.roadmapStop ADD CONSTRAINT roadmapStop_roadmap_FK + FOREIGN KEY (roadmapFk) REFERENCES vn.roadmap(id) ON DELETE CASCADE ON UPDATE CASCADE; From 75b0589561a54024ec5f305cc9209e1f2d244ec6 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 24 Jan 2025 12:34:08 +0100 Subject: [PATCH 09/31] feat: refs #8227 Undo vehicle_checkNumberPlate change and triggers checks --- .../vn/procedures/vehicle_checkNumberPlate.sql | 16 +++++----------- db/routines/vn/triggers/roadmap_beforeInsert.sql | 7 ------- db/routines/vn/triggers/roadmap_beforeUpdate.sql | 7 ------- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/db/routines/vn/procedures/vehicle_checkNumberPlate.sql b/db/routines/vn/procedures/vehicle_checkNumberPlate.sql index 613dda3682..b7444cac89 100644 --- a/db/routines/vn/procedures/vehicle_checkNumberPlate.sql +++ b/db/routines/vn/procedures/vehicle_checkNumberPlate.sql @@ -13,18 +13,12 @@ BEGIN */ DECLARE vRegex VARCHAR(45); - IF vCountryCodeFk IS NULL THEN - SET vRegex = '^[A-Z0-9 -]{6,12}$'; - ELSE - SELECT regex INTO vRegex - FROM vehiclePlateRegex - WHERE countryCodeFk = vCountryCodeFk; - END IF; - + SELECT regex INTO vRegex + FROM vehiclePlateRegex + WHERE countryCodeFk = vCountryCodeFk; + IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN - CALL util.throw(CONCAT('La matricula ', vNumberPlate, - ' no es valida', IF(vCountryCodeFk IS NOT NULL, - CONCAT(' para ', vCountryCodeFk), ''))); + CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk)); END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 4b0a1c847a..9e783e711c 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -7,13 +7,6 @@ BEGIN IF NEW.etd > NEW.eta THEN CALL util.throw('Departure time can not be after arrival time'); END IF; - - IF NEW.tractorPlate IS NOT NULL THEN - CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); - END IF; - IF NEW.trailerPlate IS NOT NULL THEN - CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); - END IF; SET NEW.name = UCASE(NEW.name); END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index 1ad547f556..4824170ec4 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -7,13 +7,6 @@ BEGIN IF NEW.etd > NEW.eta THEN CALL util.throw('Departure time can not be after arrival time'); END IF; - - IF NEW.tractorPlate IS NOT NULL THEN - CALL vehicle_checkNumberPlate(NEW.tractorPlate, NULL); - END IF; - IF NEW.trailerPlate IS NOT NULL THEN - CALL vehicle_checkNumberPlate(NEW.trailerPlate, NULL); - END IF; SET NEW.name = UCASE(NEW.name); END$$ DELIMITER ; \ No newline at end of file From 609df986148c5e9e7e526cb8a076ea29d7247d0f Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 27 Jan 2025 09:02:37 +0100 Subject: [PATCH 10/31] feat: refs #8227 Added grants --- db/versions/11416-goldenTulip/06-firstScript.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 db/versions/11416-goldenTulip/06-firstScript.sql diff --git a/db/versions/11416-goldenTulip/06-firstScript.sql b/db/versions/11416-goldenTulip/06-firstScript.sql new file mode 100644 index 0000000000..58563cfd5b --- /dev/null +++ b/db/versions/11416-goldenTulip/06-firstScript.sql @@ -0,0 +1,10 @@ +GRANT SELECT ON TABLE vn.roadmap TO 'delivery'; +GRANT SELECT ON TABLE vn.roadmapStop TO 'delivery'; +GRANT SELECT ON TABLE vn.roadmapAddress TO 'delivery'; + +GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmap TO 'deliveryBoss'; +GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmapStop TO 'deliveryBoss'; +GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmapAddress TO 'deliveryBoss'; + +GRANT EXECUTE ON PROCEDURE vn.roadmap_cloneDay TO 'deliveryBoss'; +GRANT EXECUTE ON FUNCTION vn.getTimeBetweenRoadmapAddresses TO 'deliveryBoss'; From 75168eef91c723d99b369c7afe0dca174bad0d4d Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 27 Jan 2025 11:04:34 +0100 Subject: [PATCH 11/31] feat: refs #8227 Roadmap changes --- db/routines/vn/procedures/roadmap_cloneDay.sql | 2 +- db/routines/vn/triggers/roadmap_beforeInsert.sql | 3 +++ db/routines/vn/triggers/roadmap_beforeUpdate.sql | 3 +++ db/versions/11416-goldenTulip/01-firstScript.sql | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/roadmap_cloneDay.sql b/db/routines/vn/procedures/roadmap_cloneDay.sql index 51d6ba1aba..4247b881e8 100644 --- a/db/routines/vn/procedures/roadmap_cloneDay.sql +++ b/db/routines/vn/procedures/roadmap_cloneDay.sql @@ -22,7 +22,7 @@ BEGIN SET vDaysDiff = DATEDIFF(vDateToPaste, vDateToCopy); - IF vDaysDiff IS NULL OR NOT vDaysDiff THEN + IF vDaysDiff IS NULL THEN CALL util.throw("No valid dates"); END IF; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 9e783e711c..1f046ec143 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -8,5 +8,8 @@ BEGIN CALL util.throw('Departure time can not be after arrival time'); END IF; SET NEW.name = UCASE(NEW.name); + IF NEW.`trailerPlate` IS NOT NULL THEN + SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate); + END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index 4824170ec4..45b0d5e9e0 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -8,5 +8,8 @@ BEGIN CALL util.throw('Departure time can not be after arrival time'); END IF; SET NEW.name = UCASE(NEW.name); + IF NOT (NEW.`trailerPlate` <=> OLD.`trailerPlate`) THEN + SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate); + END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/01-firstScript.sql b/db/versions/11416-goldenTulip/01-firstScript.sql index 0cd7942297..9fa580ef90 100644 --- a/db/versions/11416-goldenTulip/01-firstScript.sql +++ b/db/versions/11416-goldenTulip/01-firstScript.sql @@ -11,4 +11,6 @@ ALTER TABLE vn.roadmap ALTER TABLE vn.roadmap CHANGE driver1Fk driverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Conductor principal' AFTER driverName, CHANGE driver2Fk codriverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Copiloto' AFTER driverFk, - CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3; \ No newline at end of file + CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3; + +CREATE INDEX roadmap_etd_IDX USING BTREE ON vn.roadmap (etd); From ba2333f1802be0fe01ea669dce417441c7c6127a Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 27 Jan 2025 15:05:27 +0100 Subject: [PATCH 12/31] refactor: refs #7686 remove unused stored procedures for item shelving and ticket delay --- .../vn/procedures/itemShelvingRadar.sql | 207 ------------------ .../vn/procedures/ticket_DelayTruck.sql | 36 --- .../vn/procedures/ticket_DelayTruckSplit.sql | 59 ----- 3 files changed, 302 deletions(-) delete mode 100644 db/routines/vn/procedures/itemShelvingRadar.sql delete mode 100644 db/routines/vn/procedures/ticket_DelayTruck.sql delete mode 100644 db/routines/vn/procedures/ticket_DelayTruckSplit.sql diff --git a/db/routines/vn/procedures/itemShelvingRadar.sql b/db/routines/vn/procedures/itemShelvingRadar.sql deleted file mode 100644 index 8db3eb09aa..0000000000 --- a/db/routines/vn/procedures/itemShelvingRadar.sql +++ /dev/null @@ -1,207 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`( - vSectorFk INT -) -BEGIN -/** - * Calcula la información detallada respecto un sector. - * - * @param vSectorFk Id de sector - */ - DECLARE vCalcVisibleFk INT; - DECLARE vCalcAvailableFk INT; - DECLARE hasFatherSector BOOLEAN; - DECLARE vBuyerFk INT DEFAULT 0; - DECLARE vWarehouseFk INT DEFAULT 0; - DECLARE vSonSectorFk INT; - DECLARE vWorkerFk INT; - - SELECT s.workerFk INTO vWorkerFk - FROM sector s - WHERE s.id = vSectorFk; - - SELECT COUNT(*) INTO hasFatherSector - FROM sector - WHERE sonFk = vSectorFk; - - SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk - FROM sector - WHERE id = vSectorFk; - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE()); - - IF hasFatherSector THEN - CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT * - FROM ( - SELECT iss.itemFk, - i.longName, - i.size, - i.subName producer, - IFNULL(a.available, 0) available, - SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible, 0), 0)) upstairs, - SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible, 0), 0)) downstairs, - IF(it.isPackaging, NULL, IFNULL(v.visible, 0)) visible, - vSectorFk sectorFk, - ish.isChecked, - sub.isAllChecked - FROM itemShelvingStock iss - JOIN itemShelving ish ON ish.id = iss.itemShelvingFk - LEFT JOIN ( - SELECT itemFk, - IF( - COUNT(*) = SUM(IF(isChecked >= 0, 1, 0)), - TRUE, - FALSE - ) isAllChecked - FROM itemShelving is2 - GROUP BY itemFk - ) sub ON sub.itemFk = ish.itemFk - JOIN sector s ON s.id = iss.sectorFk - JOIN item i ON i.id = iss.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN cache.available a ON a.item_id = iss.itemFk - AND a.calc_id = vCalcAvailableFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk - AND v.calc_id = vCalcVisibleFk - WHERE vSectorFk IN (iss.sectorFk, s.sonFk) - GROUP BY iss.itemFk - UNION ALL - SELECT v.item_id, - i.longName, - i.size, - i.subName, - IFNULL(a.available, 0), - 0, - 0, - IF(it.isPackaging, NULL, v.visible), - vSectorFk, - NULL, - NULL - FROM cache.visible v - JOIN item i ON i.id = v.item_id - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id - AND iss.warehouseFk = vWarehouseFk - LEFT JOIN cache.available a ON a.item_id = v.item_id - AND a.calc_id = vCalcAvailableFk - WHERE v.calc_id = vCalcVisibleFk - AND iss.itemFk IS NULL - AND it.isInventory - ) sub - GROUP BY itemFk; - - SELECT ishr.*, - CAST(visible - upstairs - downstairs AS DECIMAL(10, 0)) nicho, - CAST(downstairs - IFNULL(notPickedYed, 0) AS DECIMAL(10, 0)) pendiente - FROM tItemShelvingRadar ishr - JOIN item i ON i.id = ishr.itemFk - LEFT JOIN ( - SELECT s.itemFk, SUM(s.quantity) notPickedYed - FROM ticket t - JOIN ticketStateToday tst ON tst.ticketFk = t.id - JOIN alertLevel al ON al.id = tst.alertLevel - JOIN sale s ON s.ticketFk = t.id - WHERE t.warehouseFk = vWarehouseFk - AND al.code IN ('FREE', 'APPROVED') - GROUP BY s.itemFk - ) sub ON sub.itemFk = ishr.itemFk - ORDER BY i.typeFk, i.longName; - ELSE - CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT iss.itemFk, - 0 `hour`, - 0 `minute`, - '--' itemPlacementCode, - i.longName, - i.size, - i.subName producer, - i.upToDown, - IFNULL(a.available, 0) available, - IFNULL(v.visible - iss.visible, 0) dayEndVisible, - IFNULL(v.visible - iss.visible, 0) firstNegative, - IFNULL(v.visible - iss.visible, 0) itemPlacementVisible, - IFNULL(i.minimum * b.packing, 0) itemPlacementSize, - ips.onTheWay, - iss.visible itemShelvingStock, - IFNULL(v.visible, 0) visible, - b.isPickedOff, - iss.sectorFk - FROM itemShelvingStock iss - JOIN item i ON i.id = iss.itemFk - LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk - AND lb.warehouse_id = vWarehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id - LEFT JOIN cache.available a ON a.item_id = iss.itemFk - AND a.calc_id = vCalcAvailableFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk - AND v.calc_id = vCalcVisibleFk - LEFT JOIN ( - SELECT itemFk, SUM(saldo) onTheWay - FROM itemPlacementSupplyList - WHERE saldo > 0 - GROUP BY itemFk - ) ips ON ips.itemFk = i.id - WHERE iss.sectorFk = vSectorFk - OR iss.sectorFk IS NULL; - - CREATE OR REPLACE TEMPORARY TABLE tmp.itemOutTime - SELECT *, SUM(amount) quantity - FROM ( - SELECT io.itemFk, - io.quantity amount, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) `hours`, - IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) `minutes` - FROM itemTicketOut `io` - JOIN tItemShelvingRadar isr ON isr.itemFk = io.itemFk - JOIN ticket t ON t.id= io.ticketFk - JOIN ticketState ts ON ts.ticketFk = io.ticketFk - JOIN `state` s ON s.id = ts.stateFk - LEFT JOIN `zone` z ON z.id = t.zoneFk - LEFT JOIN ( - SELECT DISTINCT saleFk - FROM saleTracking st - WHERE st.created > util.VN_CURDATE() - AND st.isChecked - ) stPrevious ON stPrevious.saleFk = io.saleFk - WHERE t.warehouseFk = vWarehouseFk - AND NOT s.isPicked - AND NOT io.reserved - AND stPrevious.saleFk IS NULL - AND io.shipped >= util.VN_CURDATE() - AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY - ) sub - GROUP BY itemFk, `hours`, `minutes`; - - INSERT INTO tItemShelvingRadar (itemFk) - SELECT itemFk FROM tmp.itemOutTime - ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, - firstNegative = IF(firstNegative < 0, firstNegative, firstNegative + quantity), - `hour` = IFNULL(IF(firstNegative > 0 , `hour`, `hours`), 0), - `minute` = IFNULL(IF(firstNegative > 0, `minute`, `minutes`), 0); - - UPDATE tItemShelvingRadar isr - JOIN ( - SELECT s.itemFk, SUM(s.quantity) amount - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN ticketState ts ON ts.ticketFk = t.id - WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) - AND ts.code = 'COOLER_PREPARATION' - GROUP BY s.itemFk - ) sub ON sub.itemFk = isr.itemFk - SET isr.dayEndVisible = dayEndVisible + sub.amount, - firstNegative = firstNegative + sub.amount; - - SELECT * FROM tItemShelvingRadar; - END IF; - - DROP TEMPORARY TABLE tItemShelvingRadar; - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/ticket_DelayTruck.sql b/db/routines/vn/procedures/ticket_DelayTruck.sql deleted file mode 100644 index 29d13ca0d0..0000000000 --- a/db/routines/vn/procedures/ticket_DelayTruck.sql +++ /dev/null @@ -1,36 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT) -BEGIN - DECLARE done INT DEFAULT FALSE; - DECLARE vTicketFk INT; - DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - CALL vn.productionControl(vWarehouserFk,0) ; - - DROP TEMPORARY TABLE IF EXISTS tTicket; - CREATE TEMPORARY TABLE tTicket - SELECT ticketFk - FROM tmp.productionBuffer - JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED') - WHERE shipped = util.VN_CURDATE() - AND problem LIKE '%I:%' - AND (HH <= vHour OR HH = vHour AND mm < vMinute) - AND alertLevel = al.id; - - OPEN cur1; - - read_loop: LOOP - FETCH cur1 INTO vTicketFk; - IF done THEN - LEAVE read_loop; - END IF; - - CALL vn.ticket_DelayTruckSplit(vTicketFk); - END LOOP; - - CLOSE cur1; - DROP TEMPORARY TABLE tTicket, tmp.productionBuffer; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/ticket_DelayTruckSplit.sql b/db/routines/vn/procedures/ticket_DelayTruckSplit.sql deleted file mode 100644 index 3d22207f3c..0000000000 --- a/db/routines/vn/procedures/ticket_DelayTruckSplit.sql +++ /dev/null @@ -1,59 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`( - vTicketFk INT -) -BEGIN -/** - * Splita las lineas de ticket que no estan ubicadas - * - * @param vTicketFk Id ticket - */ - DECLARE vNewTicketFk INT; - DECLARE vTotalLines INT; - DECLARE vLinesToSplit INT; - - DROP TEMPORARY TABLE IF EXISTS tmp.SalesToSplit; - - SELECT COUNT(*) INTO vTotalLines - FROM sale - WHERE ticketFk = vTicketFk; - - CREATE TEMPORARY TABLE tmp.SalesToSplit - SELECT s.id saleFk - FROM ticket t - JOIN sale s ON t.id = s.ticketFk - LEFT JOIN ( - SELECT ish.itemFk itemFk, - SUM(ish.visible) visible, - s.warehouseFk warehouseFk - FROM itemShelving ish - JOIN shelving sh ON sh.id = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - JOIN sector s ON s.id = p.sectorFk - GROUP BY ish.itemFk, - s.warehouseFk - ) issw ON issw.itemFk = s.itemFk - AND issw.warehouseFk = t.warehouseFk - WHERE s.quantity > IFNULL(issw.visible, 0) - AND s.quantity > 0 - AND NOT s.isPicked - AND NOT s.reserved - AND t.id = vTicketFk; - - SELECT COUNT(*) INTO vLinesToSplit - FROM tmp.SalesToSplit; - - IF vLinesToSplit = vTotalLines AND vLinesToSplit > 0 THEN - SET vNewTicketFk = vTicketFk; - ELSE - CALL ticket_Clone(vTicketFk, vNewTicketFk); - UPDATE sale s - JOIN tmp.SalesToSplit sts ON sts.saleFk = s.id - SET s.ticketFk = vNewTicketFk; - END IF; - - CALL ticket_setState(vNewTicketFk, 'FIXING'); - - DROP TEMPORARY TABLE tmp.SalesToSplit; -END$$ -DELIMITER ; From 857874c4c6cfda3984482a3ecea91f06ec4004e8 Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 27 Jan 2025 15:43:26 +0100 Subject: [PATCH 13/31] refactor: refs #7686 remove obsolete alert level updates and adjust state alert level logic --- db/versions/11202-limeRuscus/00-addAlertLevel.sql | 6 ------ .../11202-limeRuscus/01-updateStateAlertLevel.sql | 9 +-------- modules/ticket/back/methods/state/isEditable.js | 4 ++-- 3 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 db/versions/11202-limeRuscus/00-addAlertLevel.sql diff --git a/db/versions/11202-limeRuscus/00-addAlertLevel.sql b/db/versions/11202-limeRuscus/00-addAlertLevel.sql deleted file mode 100644 index 1f667946bb..0000000000 --- a/db/versions/11202-limeRuscus/00-addAlertLevel.sql +++ /dev/null @@ -1,6 +0,0 @@ -UPDATE vn.alertLevel SET id = 5 WHERE id = 4; -UPDATE vn.alertLevel SET id = 4 WHERE id = 3; -UPDATE vn.alertLevel SET id = 3 WHERE id = 2; -UPDATE vn.alertLevel SET id = 2 WHERE id = 1; -INSERT INTO vn.alertLevel (code, id, hasToRecalcPrice) - VALUES ('APPROVED', 1, 1) \ No newline at end of file diff --git a/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql b/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql index f7261c08ac..c49ad71ed8 100644 --- a/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql +++ b/db/versions/11202-limeRuscus/01-updateStateAlertLevel.sql @@ -1,12 +1,5 @@ UPDATE vn.state - SET alertLevel = 1 -- APPROVED - WHERE id IN ( - 3, -- Ok - 4 -- Impreso - ); - -UPDATE vn.state - SET alertLevel = 2 -- ON_PREVIOUS + SET alertLevel = 1 -- ON_PREVIOUS WHERE id IN ( 36, -- Previa Revisando 37, -- Previa Revisado diff --git a/modules/ticket/back/methods/state/isEditable.js b/modules/ticket/back/methods/state/isEditable.js index ec246c61f5..6961838278 100644 --- a/modules/ticket/back/methods/state/isEditable.js +++ b/modules/ticket/back/methods/state/isEditable.js @@ -34,8 +34,8 @@ module.exports = Self => { state.code == 'PICKER_DESIGNED' || state.code == 'PRINTED' ) ); - - const isAllowed = isAllEditable || isSomeEditable || state.alertLevel == 0; + const alertLevel = await models.AlertLevel.findOne({where: {code: 'FREE'}}, myOptions); + const isAllowed = isAllEditable || isSomeEditable || state.alertLevel == alertLevel.id; return isAllowed; }; }; From 08d241436320e3a66bdf974df595e65fe030b8ef Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 28 Jan 2025 09:16:19 +0100 Subject: [PATCH 14/31] refactor: refs #7686 update editableStates tests to check for 'OK' and 'Bloqueado' states --- .../ticket/back/methods/state/specs/editableState.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/state/specs/editableState.spec.js b/modules/ticket/back/methods/state/specs/editableState.spec.js index 2e1ce0c199..0c4024bbc0 100644 --- a/modules/ticket/back/methods/state/specs/editableState.spec.js +++ b/modules/ticket/back/methods/state/specs/editableState.spec.js @@ -35,9 +35,9 @@ describe('ticket editableStates()', () => { const editableStates = await models.State.editableStates(ctx, filter, options); - const pickerDesignedState = editableStates.some(state => state.code == 'PICKER_DESIGNED'); + const okState = editableStates.some(state => state.code == 'OK'); - expect(pickerDesignedState).toBeTruthy(); + expect(okState).toBeTruthy(); await tx.rollback(); } catch (e) { @@ -54,11 +54,11 @@ describe('ticket editableStates()', () => { const employeeRole = 1; const ctx = {req: {accessToken: {userId: employeeRole}}}; - const filter = {where: {name: {like: '%Previa OK%'}}}; + const filter = {where: {name: {like: '%Bloqueado%'}}}; const [editableStates] = await models.State.editableStates(ctx, filter, options); - expect(editableStates.name).toBe('Previa OK'); + expect(editableStates.name).toBe('Bloqueado'); await tx.rollback(); } catch (e) { From 56b0baebaa28e4b6054044e9493e3b0d0aeaea33 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 29 Jan 2025 07:53:41 +0100 Subject: [PATCH 15/31] feat: refs #8227 Roadmap changes --- db/dump/fixtures.before.sql | 16 ++++++++-------- db/versions/11416-goldenTulip/06-firstScript.sql | 5 +++-- db/versions/11416-goldenTulip/07-firstScript.sql | 2 ++ modules/route/back/models/route.json | 7 +------ 4 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 db/versions/11416-goldenTulip/07-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index eb11264e70..a1e6fbcc3a 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -745,15 +745,15 @@ INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`) INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1'); -INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`, `dated`) +INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `dated`) VALUES - (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1, util.VN_CURDATE()), - (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 9, util.VN_CURDATE()), - (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 10, util.VN_CURDATE()), - (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 12, util.VN_CURDATE()), - (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 13, util.VN_CURDATE()), - (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 3, util.VN_CURDATE()), - (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 5, util.VN_CURDATE()); + (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()); INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`, `cmrFk`, `problem`, `risk`) VALUES diff --git a/db/versions/11416-goldenTulip/06-firstScript.sql b/db/versions/11416-goldenTulip/06-firstScript.sql index 58563cfd5b..82de52c674 100644 --- a/db/versions/11416-goldenTulip/06-firstScript.sql +++ b/db/versions/11416-goldenTulip/06-firstScript.sql @@ -6,5 +6,6 @@ GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmap TO 'deliveryBoss'; GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmapStop TO 'deliveryBoss'; GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmapAddress TO 'deliveryBoss'; -GRANT EXECUTE ON PROCEDURE vn.roadmap_cloneDay TO 'deliveryBoss'; -GRANT EXECUTE ON FUNCTION vn.getTimeBetweenRoadmapAddresses TO 'deliveryBoss'; +-- Comentado debido a que da error porque ejecuta primero el script de la versión +-- GRANT EXECUTE ON PROCEDURE vn.roadmap_cloneDay TO 'deliveryBoss'; +-- GRANT EXECUTE ON FUNCTION vn.getTimeBetweenRoadmapAddresses TO 'deliveryBoss'; diff --git a/db/versions/11416-goldenTulip/07-firstScript.sql b/db/versions/11416-goldenTulip/07-firstScript.sql new file mode 100644 index 0000000000..13cb9df894 --- /dev/null +++ b/db/versions/11416-goldenTulip/07-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.route DROP FOREIGN KEY fk_route_1; +ALTER TABLE vn.route DROP COLUMN zoneFk; diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json index 8f4eab7611..9483525718 100644 --- a/modules/route/back/models/route.json +++ b/modules/route/back/models/route.json @@ -75,11 +75,6 @@ "type": "hasMany", "model": "Ticket", "foreignKey": "routeFk" - }, - "zone": { - "type": "belongsTo", - "model": "Zone", - "foreignKey": "zoneFk" - } + } } } From ad29b265536264cdeef682ed608ca7e4459c2497 Mon Sep 17 00:00:00 2001 From: jtubau Date: Wed, 29 Jan 2025 12:43:03 +0100 Subject: [PATCH 16/31] refactor: refs #7414 update Spanish translation for 'total' to 'importe' --- modules/ticket/back/locale/sale/es.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/locale/sale/es.yml b/modules/ticket/back/locale/sale/es.yml index e6a984a5d6..eefd05d83d 100644 --- a/modules/ticket/back/locale/sale/es.yml +++ b/modules/ticket/back/locale/sale/es.yml @@ -15,4 +15,4 @@ columns: priceFixed: precio fijado isPriceFixed: tiene precio fijado isAdded: añadida - total: total + total: importe From a14d6227a11d7384483eb28c5a1d382b470203c3 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 29 Jan 2025 14:15:22 +0100 Subject: [PATCH 17/31] feat: refs #8227 Roadmap changes --- .../getTimeBetweenRoadmapAddresses.sql | 41 ++++++++++++++--- .../vn/triggers/roadmap_afterUpdate.sql | 17 +++++++ .../vn/triggers/roadmap_beforeInsert.sql | 26 +++++++++-- .../vn/triggers/roadmap_beforeUpdate.sql | 45 +++++++++++++++++-- .../11416-goldenTulip/01-firstScript.sql | 12 +++-- .../11416-goldenTulip/02-firstScript.sql | 6 ++- .../11416-goldenTulip/08-firstScript.sql | 2 + 7 files changed, 130 insertions(+), 19 deletions(-) create mode 100644 db/routines/vn/triggers/roadmap_afterUpdate.sql create mode 100644 db/versions/11416-goldenTulip/08-firstScript.sql diff --git a/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql b/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql index 5a647d51b7..354aeb835f 100644 --- a/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql +++ b/db/routines/vn/functions/getTimeBetweenRoadmapAddresses.sql @@ -16,19 +16,46 @@ BEGIN */ DECLARE vSeconds INT; - WITH wRoadmap AS ( + WITH wRoadmapStop AS ( SELECT ROW_NUMBER() OVER(PARTITION BY roadmapFk ORDER BY eta) `sequence`, roadmapFk, roadmapAddressFk, eta FROM vn.roadmapStop + WHERE roadmapFk IS NOT NULL + AND roadmapAddressFk IS NOT NULL + AND eta IS NOT NULL ) - SELECT AVG(TIME_TO_SEC(TIMEDIFF(rTo.eta, rFrom.eta))) INTO vSeconds - FROM wRoadmap rFrom - JOIN wRoadmap rTo ON rTo.roadmapFk = rFrom.roadmapFk - WHERE rFrom.roadmapAddressFk = vRoadmapAddressFrom - AND rTo.roadmapAddressFk = vRoadmapAddressTo - AND rFrom.`sequence` + 1 = rTo.`sequence`; + SELECT AVG(TIME_TO_SEC(TIMEDIFF(rsTo.eta, rsFrom.eta))) INTO vSeconds + FROM wRoadmapStop rsFrom + JOIN wRoadmapStop rsTo ON rsTo.roadmapFk = rsFrom.roadmapFk + WHERE rsFrom.roadmapAddressFk = vRoadmapAddressFrom + AND rsTo.roadmapAddressFk = vRoadmapAddressTo + AND rsFrom.`sequence` + 1 = rsTo.`sequence`; + + IF NOT IFNULL(vSeconds, 0) THEN + WITH wRoadmap AS ( + SELECT id, + roadmapAddressFk, + etd + FROM vn.roadmap + WHERE roadmapAddressFk = vRoadmapAddressFrom + AND etd IS NOT NULL + ), wRoadmapStop AS ( + SELECT ROW_NUMBER() OVER(PARTITION BY roadmapFk ORDER BY eta) `sequence`, + roadmapFk, + roadmapAddressFk, + eta + FROM vn.roadmapStop + WHERE roadmapFk IS NOT NULL + AND roadmapAddressFk = vRoadmapAddressTo + AND eta IS NOT NULL + ) + SELECT AVG(TIME_TO_SEC(TIMEDIFF(rsTo.eta, rFrom.etd))) INTO vSeconds + FROM wRoadmap rFrom + JOIN wRoadmapStop rsTo ON rsTo.roadmapFk = rFrom.id + AND rsTo.`sequence` = 1; + END IF; RETURN vSeconds; END$$ diff --git a/db/routines/vn/triggers/roadmap_afterUpdate.sql b/db/routines/vn/triggers/roadmap_afterUpdate.sql new file mode 100644 index 0000000000..7fcc31d922 --- /dev/null +++ b/db/routines/vn/triggers/roadmap_afterUpdate.sql @@ -0,0 +1,17 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_afterUpdate` + AFTER UPDATE ON `roadmap` + FOR EACH ROW +BEGIN + DECLARE vSeconds INT; + + IF NOT (NEW.etd <=> OLD.etd) THEN + SET vSeconds = TIME_TO_SEC(TIMEDIFF(NEW.etd, OLD.etd)); + IF vSeconds IS NOT NULL AND vSeconds <> 0 THEN + UPDATE roadmapStop + SET eta = eta + INTERVAL vSeconds SECOND + WHERE roadmapFk = NEW.id; + END IF; + END IF; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index 1f046ec143..a9b837e6b9 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -4,12 +4,32 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - IF NEW.etd > NEW.eta THEN + + IF NEW.name IS NOT NULL THEN + SET NEW.name = UCASE(NEW.name); + END IF; + + IF NEW.etd > NEW.eta AND NEW.etd IS NOT NULL AND NEW.eta IS NOT NULL THEN CALL util.throw('Departure time can not be after arrival time'); END IF; - SET NEW.name = UCASE(NEW.name); - IF NEW.`trailerPlate` IS NOT NULL THEN + + IF NEW.trailerPlate IS NOT NULL THEN SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate); END IF; + + IF NEW.tugPlate IS NOT NULL THEN + SET NEW.m3 = NEW.m3 + (SELECT m3 FROM vehicle WHERE numberPlate = NEW.tugPlate); + END IF; + + IF NEW.driver1Fk IS NOT NULL THEN + SET NEW.driverName = (SELECT CONCAT(w.firstName, ' ', w.lastName) + FROM worker w + WHERE w.id = NEW.driver1Fk); + + SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile) + FROM worker w + LEFT JOIN client c ON c.id = w.id + WHERE w.id = NEW.driver1Fk); + END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index 45b0d5e9e0..46065129d1 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -4,12 +4,51 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); - IF NEW.etd > NEW.eta THEN + + IF NOT (NEW.name <=> OLD.name) THEN + SET NEW.name = UCASE(NEW.name); + END IF; + + IF NEW.etd > NEW.eta AND NEW.etd IS NOT NULL AND NEW.eta IS NOT NULL THEN CALL util.throw('Departure time can not be after arrival time'); END IF; - SET NEW.name = UCASE(NEW.name); - IF NOT (NEW.`trailerPlate` <=> OLD.`trailerPlate`) THEN + + IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) THEN SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate); END IF; + + IF NOT (NEW.tugPlate <=> OLD.tugPlate) THEN + SET NEW.m3 = NEW.m3 + (SELECT m3 FROM vehicle WHERE numberPlate = NEW.tugPlate); + END IF; + + IF NOT (NEW.driverName <=> OLD.driverName) THEN + SET NEW.driver1Fk = NULL; + END IF; + + IF NOT (NEW.driver1Fk <=> OLD.driver1Fk) AND NEW.driver1Fk IS NOT NULL THEN + SET NEW.driverName = (SELECT CONCAT(w.firstName, ' ', w.lastName) + FROM worker w + WHERE w.id = NEW.driver1Fk); + + SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile) + FROM worker w + LEFT JOIN client c ON c.id = w.id + WHERE w.id = NEW.driver1Fk); + END IF; + + IF NOT (NEW.driverChangeName <=> OLD.driverChangeName) THEN + SET NEW.driverChangeFk = NULL; + END IF; + + IF NOT (NEW.driverChangeFk <=> OLD.driverChangeFk) AND NEW.driverChangeFk IS NOT NULL THEN + SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName) + FROM worker w + WHERE w.id = NEW.driverChangeFk); + + SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile) + FROM worker w + LEFT JOIN client c ON c.id = w.id + WHERE w.id = NEW.driverChangeFk); + END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/versions/11416-goldenTulip/01-firstScript.sql b/db/versions/11416-goldenTulip/01-firstScript.sql index 9fa580ef90..565bf0f555 100644 --- a/db/versions/11416-goldenTulip/01-firstScript.sql +++ b/db/versions/11416-goldenTulip/01-firstScript.sql @@ -4,13 +4,17 @@ ALTER TABLE vn.roadmap MODIFY COLUMN trailerPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL, MODIFY COLUMN etd datetime NOT NULL COMMENT 'Tiempo estimado de salida', MODIFY COLUMN `name` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL, - ADD eta datetime NOT NULL COMMENT 'Tiempo estimado de llegada' AFTER etd, - ADD roadmapAddressFk int(11) NOT NULL AFTER `name`; + MODIFY COLUMN driver1Fk int(10) unsigned DEFAULT NULL NULL AFTER driverName, + MODIFY COLUMN driver2Fk int(10) unsigned DEFAULT NULL NULL AFTER driver1Fk, + ADD eta datetime DEFAULT NULL NULL COMMENT 'Tiempo estimado de llegada' AFTER etd, + ADD roadmapAddressFk int(11) DEFAULT NULL NULL AFTER `name`, + ADD dollyPlate varchar(10) DEFAULT NULL AFTER trailerPlate, + ADD tugPlate varchar(10) DEFAULT NULL AFTER dollyPlate, + ADD driverChangeName varchar(45) DEFAULT NULL AFTER driver2Fk, + ADD driverChangeFk int(10) unsigned DEFAULT NULL NULL AFTER driverChangeName; -- Separamos los CHANGE por que si no arriba no se aplican ALTER TABLE vn.roadmap - CHANGE driver1Fk driverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Conductor principal' AFTER driverName, - CHANGE driver2Fk codriverFk int(10) unsigned DEFAULT NULL NULL COMMENT 'Copiloto' AFTER driverFk, CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3; CREATE INDEX roadmap_etd_IDX USING BTREE ON vn.roadmap (etd); diff --git a/db/versions/11416-goldenTulip/02-firstScript.sql b/db/versions/11416-goldenTulip/02-firstScript.sql index f99334e9b9..c729c3de2f 100644 --- a/db/versions/11416-goldenTulip/02-firstScript.sql +++ b/db/versions/11416-goldenTulip/02-firstScript.sql @@ -5,9 +5,11 @@ UPDATE vn.roadmap ALTER TABLE vn.roadmap ADD CONSTRAINT roadmap_roadmapAddress_FK FOREIGN KEY (roadmapAddressFk) REFERENCES vn.roadmapAddress(addressFk) ON DELETE RESTRICT ON UPDATE CASCADE, - ADD CONSTRAINT roadmap_driver_FK FOREIGN KEY (driverFk) + ADD CONSTRAINT roadmap_driver_FK FOREIGN KEY (driver1Fk) REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE, - ADD CONSTRAINT roadmap_driver_FK2 FOREIGN KEY (codriverFk) + ADD CONSTRAINT roadmap_driver_FK2 FOREIGN KEY (driver2Fk) + REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE, + ADD CONSTRAINT roadmap_driverChange_FK FOREIGN KEY (driverChangeFk) REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE, ADD CONSTRAINT roadmap_user_Fk FOREIGN KEY (editorFk) REFERENCES account.user(id) ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/db/versions/11416-goldenTulip/08-firstScript.sql b/db/versions/11416-goldenTulip/08-firstScript.sql new file mode 100644 index 0000000000..a7fdd5b86e --- /dev/null +++ b/db/versions/11416-goldenTulip/08-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.vehicle + ADD typeFk enum('car','van','truck','trailer','tug', 'tugDolly','dolly') DEFAULT 'van' NOT NULL; From 2a7795d432c07c60b215a4b63b72ccd5756e49c9 Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 29 Jan 2025 19:24:49 +0100 Subject: [PATCH 18/31] feat: refs #8477 add fee column to awb table --- db/versions/11429-brownBamboo/00-firstScript.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/versions/11429-brownBamboo/00-firstScript.sql diff --git a/db/versions/11429-brownBamboo/00-firstScript.sql b/db/versions/11429-brownBamboo/00-firstScript.sql new file mode 100644 index 0000000000..152d4b2e38 --- /dev/null +++ b/db/versions/11429-brownBamboo/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE `vn`.`awb` + ADD COLUMN `fee` DECIMAL(10, 2) UNSIGNED DEFAULT NULL; \ No newline at end of file From 123f28055e265645c70b2ef65210a113d0295834 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 30 Jan 2025 09:28:44 +0100 Subject: [PATCH 19/31] feat: refs #8227 Roadmap changes --- db/routines/vn/triggers/roadmap_beforeInsert.sql | 14 ++++++++------ db/routines/vn/triggers/roadmap_beforeUpdate.sql | 13 ++----------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index a9b837e6b9..bfbb4f8792 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -13,12 +13,8 @@ BEGIN CALL util.throw('Departure time can not be after arrival time'); END IF; - IF NEW.trailerPlate IS NOT NULL THEN - SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate); - END IF; - - IF NEW.tugPlate IS NOT NULL THEN - SET NEW.m3 = NEW.m3 + (SELECT m3 FROM vehicle WHERE numberPlate = NEW.tugPlate); + IF NEW.trailerPlate IS NOT NULL OR NEW.tugPlate IS NOT NULL THEN + SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate)); END IF; IF NEW.driver1Fk IS NOT NULL THEN @@ -31,5 +27,11 @@ BEGIN LEFT JOIN client c ON c.id = w.id WHERE w.id = NEW.driver1Fk); END IF; + + IF NEW.driverChangeFk IS NOT NULL THEN + SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName) + FROM worker w + WHERE w.id = NEW.driverChangeFk); + END IF; END$$ DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index 46065129d1..f888d3a6f0 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -13,12 +13,8 @@ BEGIN CALL util.throw('Departure time can not be after arrival time'); END IF; - IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) THEN - SET NEW.m3 = (SELECT m3 FROM vehicle WHERE numberPlate = NEW.trailerPlate); - END IF; - - IF NOT (NEW.tugPlate <=> OLD.tugPlate) THEN - SET NEW.m3 = NEW.m3 + (SELECT m3 FROM vehicle WHERE numberPlate = NEW.tugPlate); + IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) OR NOT (NEW.tugPlate <=> OLD.tugPlate) THEN + SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate)); END IF; IF NOT (NEW.driverName <=> OLD.driverName) THEN @@ -44,11 +40,6 @@ BEGIN SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName) FROM worker w WHERE w.id = NEW.driverChangeFk); - - SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile) - FROM worker w - LEFT JOIN client c ON c.id = w.id - WHERE w.id = NEW.driverChangeFk); END IF; END$$ DELIMITER ; \ No newline at end of file From 855600811e15a752a1df1c4f629f5a3ab6bacdc5 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 30 Jan 2025 15:00:19 +0100 Subject: [PATCH 20/31] feat: refs #8227 Roadmap changes --- .../vn/triggers/roadmapStop_beforeDelete.sql | 21 ++++++++++++++++++ .../vn/triggers/roadmapStop_beforeInsert.sql | 22 +++++++++++++++++-- .../vn/triggers/roadmapStop_beforeUpdate.sql | 18 ++++++++++++++- .../vn/triggers/roadmap_beforeInsert.sql | 4 ---- .../vn/triggers/roadmap_beforeUpdate.sql | 4 ---- 5 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 db/routines/vn/triggers/roadmapStop_beforeDelete.sql diff --git a/db/routines/vn/triggers/roadmapStop_beforeDelete.sql b/db/routines/vn/triggers/roadmapStop_beforeDelete.sql new file mode 100644 index 0000000000..3449e56218 --- /dev/null +++ b/db/routines/vn/triggers/roadmapStop_beforeDelete.sql @@ -0,0 +1,21 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeDelete` + BEFORE DELETE ON `roadmapStop` + FOR EACH ROW +BEGIN + DECLARE vMaxEta DATETIME; + + IF OLD.roadmapFk IS NOT NULL THEN + SELECT MAX(eta) INTO vMaxEta + FROM roadmapStop + WHERE roadmapFk = OLD.roadmapFk + AND id <> OLD.id; + + IF OLD.eta > vMaxEta OR vMaxEta IS NULL THEN + UPDATE roadmap + SET eta = COALESCE(vMaxEta, OLD.eta) + WHERE id = OLD.roadmapFk; + END IF; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql index 9ec8b72cfa..00d17fcced 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql @@ -3,12 +3,30 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeInser BEFORE INSERT ON `roadmapStop` FOR EACH ROW BEGIN + DECLARE vMaxEta DATETIME; + SET NEW.editorFk = account.myUser_getId(); - SET NEW.description = UCASE(NEW.description); + + IF NEW.description IS NOT NULL THEN + SET NEW.description = UCASE(NEW.description); + END IF; + IF NEW.roadmapFk IS NOT NULL THEN IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN CALL util.throw('Departure time can not be after arrival time'); END IF; END IF; + + IF NEW.roadmapFk IS NOT NULL AND NEW.eta IS NOT NULL THEN + SELECT MAX(eta) INTO vMaxEta + FROM roadmapStop + WHERE roadmapFk = NEW.roadmapFk; + + IF NEW.eta > vMaxEta OR vMaxEta IS NOT NULL THEN + UPDATE roadmap + SET eta = GREATEST(COALESCE(vMaxEta, NEW.eta), NEW.eta) + WHERE id = NEW.roadmapFk; + END IF; + END IF; END$$ -DELIMITER ; +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql index cff48846ae..0560ed5eb1 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql @@ -3,14 +3,30 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdat BEFORE UPDATE ON `roadmapStop` FOR EACH ROW BEGIN + DECLARE vMaxEta DATETIME; + SET NEW.editorFk = account.myUser_getId(); - SET NEW.description = UCASE(NEW.description); + + IF NOT (NEW.description <=> OLD.description) THEN + SET NEW.description = UCASE(NEW.description); + END IF; + IF (NOT (NEW.roadmapFk <=> OLD.roadmapFk) AND NEW.roadmapFk IS NOT NULL) OR (NOT (NEW.eta <=> OLD.eta) AND NEW.eta IS NOT NULL) THEN IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN CALL util.throw('Departure time can not be after arrival time'); END IF; + + SELECT MAX(eta) INTO vMaxEta + FROM roadmapStop + WHERE roadmapFk = NEW.roadmapFk; + + IF NEW.eta > vMaxEta OR vMaxEta IS NULL THEN + UPDATE roadmap + SET eta = COALESCE(vMaxEta, NEW.eta) + WHERE id = NEW.roadmapFk; + END IF; END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/roadmap_beforeInsert.sql b/db/routines/vn/triggers/roadmap_beforeInsert.sql index bfbb4f8792..4dd9e686ce 100644 --- a/db/routines/vn/triggers/roadmap_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmap_beforeInsert.sql @@ -9,10 +9,6 @@ BEGIN SET NEW.name = UCASE(NEW.name); END IF; - IF NEW.etd > NEW.eta AND NEW.etd IS NOT NULL AND NEW.eta IS NOT NULL THEN - CALL util.throw('Departure time can not be after arrival time'); - END IF; - IF NEW.trailerPlate IS NOT NULL OR NEW.tugPlate IS NOT NULL THEN SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate)); END IF; diff --git a/db/routines/vn/triggers/roadmap_beforeUpdate.sql b/db/routines/vn/triggers/roadmap_beforeUpdate.sql index f888d3a6f0..4f355915bc 100644 --- a/db/routines/vn/triggers/roadmap_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmap_beforeUpdate.sql @@ -9,10 +9,6 @@ BEGIN SET NEW.name = UCASE(NEW.name); END IF; - IF NEW.etd > NEW.eta AND NEW.etd IS NOT NULL AND NEW.eta IS NOT NULL THEN - CALL util.throw('Departure time can not be after arrival time'); - END IF; - IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) OR NOT (NEW.tugPlate <=> OLD.tugPlate) THEN SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate)); END IF; From 148072b39ddb08108fc7a659b2e4dd67f8e6eb19 Mon Sep 17 00:00:00 2001 From: ivanm Date: Thu, 30 Jan 2025 17:58:39 +0100 Subject: [PATCH 21/31] feat: refs #8477 change column name and add comment --- db/versions/11429-brownBamboo/00-firstScript.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/versions/11429-brownBamboo/00-firstScript.sql b/db/versions/11429-brownBamboo/00-firstScript.sql index 152d4b2e38..726856e767 100644 --- a/db/versions/11429-brownBamboo/00-firstScript.sql +++ b/db/versions/11429-brownBamboo/00-firstScript.sql @@ -1,2 +1,2 @@ ALTER TABLE `vn`.`awb` - ADD COLUMN `fee` DECIMAL(10, 2) UNSIGNED DEFAULT NULL; \ No newline at end of file + ADD COLUMN `costPerKg` DECIMAL(10, 2) UNSIGNED DEFAULT NULL COMMENT 'Tarifa que indica a cuanto cuesta el kilo en ese vuelo'; \ No newline at end of file From 5c4f31e6af867f2182e962d61d48ef33c5e2fa00 Mon Sep 17 00:00:00 2001 From: jtubau Date: Fri, 31 Jan 2025 10:25:43 +0100 Subject: [PATCH 22/31] refactor: refs #7537 address display all digits in black in driver route report --- print/templates/reports/driver-route/driver-route.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index e3a206656e..8e69d6c658 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -90,8 +90,7 @@ {{ticket.id}} {{ticket.clientFk}} {{ticket.addressName}} - {{ticket.addressFk.toString().substr(0, ticket.addressFk.toString().length - 3)}} - {{ticket.addressFk.toString().substr(-3, 3)}} + {{ticket.addressFk.toString()}} {{ticket.packages}} {{ticket.itemPackingTypes}} From b40f145613220e92635de22a4739eeaae91c4b14 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 31 Jan 2025 10:57:44 +0100 Subject: [PATCH 23/31] feat: refs #8227 Roadmap changes --- .../vn/triggers/roadmapStop_beforeDelete.sql | 13 +++++++++---- .../vn/triggers/roadmapStop_beforeInsert.sql | 12 ++++++------ .../vn/triggers/roadmapStop_beforeUpdate.sql | 18 ++++++++++++++---- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/db/routines/vn/triggers/roadmapStop_beforeDelete.sql b/db/routines/vn/triggers/roadmapStop_beforeDelete.sql index 3449e56218..f0faeb8bef 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeDelete.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeDelete.sql @@ -4,18 +4,23 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeDelet FOR EACH ROW BEGIN DECLARE vMaxEta DATETIME; + DECLARE vRoadmapEta DATETIME; IF OLD.roadmapFk IS NOT NULL THEN - SELECT MAX(eta) INTO vMaxEta + SELECT MAX(eta) INTO vMaxEta FROM roadmapStop WHERE roadmapFk = OLD.roadmapFk AND id <> OLD.id; - IF OLD.eta > vMaxEta OR vMaxEta IS NULL THEN + SELECT eta INTO vRoadmapEta + FROM roadmap + WHERE id = OLD.roadmapFk; + + IF vMaxEta <> vRoadmapEta OR vMaxEta IS NULL THEN UPDATE roadmap - SET eta = COALESCE(vMaxEta, OLD.eta) + SET eta = vMaxEta WHERE id = OLD.roadmapFk; END IF; END IF; END$$ -DELIMITER ; +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql index 00d17fcced..012702f3ed 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeInsert.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeInsert.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeInser BEFORE INSERT ON `roadmapStop` FOR EACH ROW BEGIN - DECLARE vMaxEta DATETIME; + DECLARE vRoadmapEta DATETIME; SET NEW.editorFk = account.myUser_getId(); @@ -18,13 +18,13 @@ BEGIN END IF; IF NEW.roadmapFk IS NOT NULL AND NEW.eta IS NOT NULL THEN - SELECT MAX(eta) INTO vMaxEta - FROM roadmapStop - WHERE roadmapFk = NEW.roadmapFk; + SELECT eta INTO vRoadmapEta + FROM roadmap + WHERE id = NEW.roadmapFk; - IF NEW.eta > vMaxEta OR vMaxEta IS NOT NULL THEN + IF vRoadmapEta < NEW.eta OR vRoadmapEta IS NULL THEN UPDATE roadmap - SET eta = GREATEST(COALESCE(vMaxEta, NEW.eta), NEW.eta) + SET eta = NEW.eta WHERE id = NEW.roadmapFk; END IF; END IF; diff --git a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql index 0560ed5eb1..d9016a1708 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql @@ -4,6 +4,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdat FOR EACH ROW BEGIN DECLARE vMaxEta DATETIME; + DECLARE vCurrentEta DATETIME; SET NEW.editorFk = account.myUser_getId(); @@ -18,13 +19,22 @@ BEGIN CALL util.throw('Departure time can not be after arrival time'); END IF; - SELECT MAX(eta) INTO vMaxEta + SELECT MAX(eta) INTO vMaxEta FROM roadmapStop - WHERE roadmapFk = NEW.roadmapFk; + WHERE roadmapFk = NEW.roadmapFk + AND id <> OLD.id; - IF NEW.eta > vMaxEta OR vMaxEta IS NULL THEN + IF vMaxEta IS NULL OR NEW.eta > vMaxEta THEN + SET vMaxEta = NEW.eta; + END IF; + + SELECT eta INTO vCurrentEta + FROM roadmap + WHERE id = NEW.roadmapFk; + + IF vMaxEta <> vCurrentEta THEN UPDATE roadmap - SET eta = COALESCE(vMaxEta, NEW.eta) + SET eta = vMaxEta WHERE id = NEW.roadmapFk; END IF; END IF; From 2e4c5fe40173352479ce17f2a985952b588ebfb1 Mon Sep 17 00:00:00 2001 From: ivanm Date: Fri, 31 Jan 2025 12:10:19 +0100 Subject: [PATCH 24/31] feat: refs #8477 add costPerKg to awb view --- db/routines/vn2008/views/awb.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/routines/vn2008/views/awb.sql b/db/routines/vn2008/views/awb.sql index 0105962880..a325718888 100644 --- a/db/routines/vn2008/views/awb.sql +++ b/db/routines/vn2008/views/awb.sql @@ -29,5 +29,6 @@ AS SELECT `a`.`id` AS `id`, `a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`, `a`.`observation` AS `observation`, `a`.`hasFreightPrepaid` AS `hasFreightPrepaid`, - `a`.`propertyNumber` AS `propertyNumber` + `a`.`propertyNumber` AS `propertyNumber`, + `a`.`costPerKg` AS `costPerKg` FROM `vn`.`awb` `a` From 8dc803b5df54167009735596fc59e2d434c913dd Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 31 Jan 2025 14:25:23 +0100 Subject: [PATCH 25/31] feat: refs #8227 Roadmap changes --- db/routines/vn/triggers/roadmapStop_beforeUpdate.sql | 6 +++--- db/versions/11416-goldenTulip/09-firstScript.sql | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 db/versions/11416-goldenTulip/09-firstScript.sql diff --git a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql index d9016a1708..c3142c8acc 100644 --- a/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql +++ b/db/routines/vn/triggers/roadmapStop_beforeUpdate.sql @@ -13,7 +13,7 @@ BEGIN END IF; IF (NOT (NEW.roadmapFk <=> OLD.roadmapFk) AND NEW.roadmapFk IS NOT NULL) - OR (NOT (NEW.eta <=> OLD.eta) AND NEW.eta IS NOT NULL) THEN + OR (NOT (NEW.eta <=> OLD.eta)) THEN IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN CALL util.throw('Departure time can not be after arrival time'); @@ -24,7 +24,7 @@ BEGIN WHERE roadmapFk = NEW.roadmapFk AND id <> OLD.id; - IF vMaxEta IS NULL OR NEW.eta > vMaxEta THEN + IF vMaxEta < NEW.eta OR vMaxEta IS NULL THEN SET vMaxEta = NEW.eta; END IF; @@ -32,7 +32,7 @@ BEGIN FROM roadmap WHERE id = NEW.roadmapFk; - IF vMaxEta <> vCurrentEta THEN + IF (vMaxEta <> vCurrentEta OR vMaxEta IS NULL) OR vMaxEta IS NOT NULL THEN UPDATE roadmap SET eta = vMaxEta WHERE id = NEW.roadmapFk; diff --git a/db/versions/11416-goldenTulip/09-firstScript.sql b/db/versions/11416-goldenTulip/09-firstScript.sql new file mode 100644 index 0000000000..5e61de07a7 --- /dev/null +++ b/db/versions/11416-goldenTulip/09-firstScript.sql @@ -0,0 +1 @@ +CREATE INDEX route_dated_IDX USING BTREE ON vn.route (dated); From adba4765ed59662ae480f170dab684599906ebbd Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 3 Feb 2025 09:07:08 +0100 Subject: [PATCH 26/31] refactor: refs #7686 update alert level conditions to only check for 'FREE' --- .../inventoryDiscrepancyDetail_replace.sql | 12 ++++++------ .../hedera/procedures/order_confirmWithUser.sql | 2 +- db/routines/vn/procedures/productionControl.sql | 6 +++--- .../vn/procedures/ticketDown_PrintableSelection.sql | 2 +- .../vn/procedures/ticketGetVisibleAvailable.sql | 2 +- db/routines/vn/procedures/ticket_canMerge.sql | 6 +++--- db/routines/vn/procedures/ticket_canbePostponed.sql | 2 +- .../back/methods/sales-monitor/salesFilter.js | 2 +- modules/ticket/back/methods/ticket/filter.js | 2 +- .../ticket/back/methods/ticket/getTicketsFuture.js | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql b/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql index a30e47be35..6894b29289 100644 --- a/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql +++ b/db/routines/bs/procedures/inventoryDiscrepancyDetail_replace.sql @@ -9,7 +9,7 @@ BEGIN DECLARE vCalc INT; DECLARE vWarehouseFk INT; - DECLARE cWarehouses CURSOR FOR + DECLARE cWarehouses CURSOR FOR SELECT id FROM vn.warehouse WHERE isInventory; @@ -22,13 +22,13 @@ BEGIN read_loop: LOOP SET vDone = FALSE; FETCH cWarehouses INTO vWarehouseFk; - + IF vDone THEN LEAVE read_loop; END IF; - + CALL cache.visible_refresh(vCalc, FALSE, vWarehouseFk); - + CREATE OR REPLACE TEMPORARY TABLE tVisible SELECT itemFk, SUM(visible) totalVisible FROM vn.itemShelving ish @@ -37,7 +37,7 @@ BEGIN JOIN vn.sector sc ON sc.id = p.sectorFk WHERE sc.warehouseFk = vWarehouseFk GROUP BY itemFk; - + INSERT INTO inventoryDiscrepancyDetail( warehouseFk, itemFk, @@ -66,7 +66,7 @@ BEGIN JOIN vn.alertLevel al ON al.id = ts.alertLevel WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE()) AND NOT s.isPicked - AND al.code IN ('FREE', 'APPROVED') + AND al.code = 'FREE' AND t.warehouseFk = vWarehouseFk GROUP BY s.itemFk HAVING notPicked diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index 39da09a96b..db83cba5c3 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -147,7 +147,7 @@ BEGIN ) SELECT t.id INTO vTicketFk FROM vn.ticket t - JOIN vn.alertLevel al ON al.code IN ('FREE', 'APPROVED') + JOIN vn.alertLevel al ON al.code = 'FREE' LEFT JOIN tPrevia tp ON tp.ticketFk = t.id LEFT JOIN vn.ticketState tls ON tls.ticketFk = t.id JOIN hedera.`order` o ON o.address_id = t.addressFk diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql index 8d85062ba4..aa52a52c55 100644 --- a/db/routines/vn/procedures/productionControl.sql +++ b/db/routines/vn/procedures/productionControl.sql @@ -80,7 +80,7 @@ proc: BEGIN rm.bufferFk FROM tmp.productionTicket tt JOIN ticket t ON tt.ticketFk = t.id - JOIN alertLevel al ON al.code = 'APPROVED' + JOIN alertLevel al ON al.code = 'FREE' LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id LEFT JOIN `state` st ON st.id = tst.state LEFT JOIN client c ON c.id = t.clientFk @@ -266,14 +266,14 @@ proc: BEGIN UPDATE tmp.productionBuffer pb JOIN sale s ON s.ticketFk = pb.ticketFk JOIN item i ON i.id = s.itemFk - JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk + JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk AND lb.item_id = s.itemFk JOIN buy b ON b.id = lb.buy_id JOIN packaging p ON p.id = b.packagingFk SET pb.hasPlantTray = TRUE WHERE p.isPlantTray AND s.quantity >= b.packing - AND pb.isOwn; + AND pb.isOwn; DROP TEMPORARY TABLE tmp.productionTicket, diff --git a/db/routines/vn/procedures/ticketDown_PrintableSelection.sql b/db/routines/vn/procedures/ticketDown_PrintableSelection.sql index 619c8b20f8..8f448d647a 100644 --- a/db/routines/vn/procedures/ticketDown_PrintableSelection.sql +++ b/db/routines/vn/procedures/ticketDown_PrintableSelection.sql @@ -13,7 +13,7 @@ BEGIN JOIN vn.parking p ON p.id = sh.parkingFk WHERE p.sectorFk = vSectorFk ) sub ON sub.id = td.ticketFk - JOIN vn.ticketDown_SelectionType tdst ON tdst.description IN ('FREE', 'APPROVED') + JOIN vn.ticketDown_SelectionType tdst ON tdst.description = 'FREE' JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED' SET td.selected = tdst2.id WHERE td.selected = tdst.id; diff --git a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql index cb7fe20e91..01010f5483 100644 --- a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql +++ b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql @@ -12,7 +12,7 @@ BEGIN SELECT t.warehouseFk, t.shipped, ts.alertLevel, al.id INTO vWarehouse, vShipped, vAlertLevel, vAlertLevelFree FROM ticket t - JOIN alertLevel al ON al.code IN ('FREE', 'APPROVED') + JOIN alertLevel al ON al.code = 'FREE' LEFT JOIN ticketState ts ON ts.ticketFk = vTicket WHERE t.id = vTicket; diff --git a/db/routines/vn/procedures/ticket_canMerge.sql b/db/routines/vn/procedures/ticket_canMerge.sql index 82ce5f2010..d0737f00fc 100644 --- a/db/routines/vn/procedures/ticket_canMerge.sql +++ b/db/routines/vn/procedures/ticket_canMerge.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_canMerge`(vDat BEGIN /** * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * + * * @param vDated Fecha en cuestión * @param vScopeDays Dias en el futuro a sondear * @param vLitersMax Volumen máximo de los tickets a catapultar @@ -48,14 +48,14 @@ BEGIN WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) AND t.warehouseFk = vWarehouseFk - AND al.code IN ('FREE', 'APPROVED') + AND al.code = 'FREE' GROUP BY t.id ) sub GROUP BY sub.addressFk ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) AND t.warehouseFk = vWarehouseFk - AND al.code IN ('FREE', 'APPROVED') + AND al.code = 'FREE' AND tp.ticketFk IS NULL GROUP BY sv.ticketFk HAVING liters <= vLitersMax diff --git a/db/routines/vn/procedures/ticket_canbePostponed.sql b/db/routines/vn/procedures/ticket_canbePostponed.sql index b4b0871cec..a21e171cfa 100644 --- a/db/routines/vn/procedures/ticket_canbePostponed.sql +++ b/db/routines/vn/procedures/ticket_canbePostponed.sql @@ -69,7 +69,7 @@ BEGIN ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated) AND t.warehouseFk = vWarehouseFk - AND al.code IN ('FREE', 'APPROVED') + AND al.code = 'FREE' AND tp.ticketFk IS NULL GROUP BY sv.ticketFk HAVING futureId; diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index ab2a64293e..4947edeafb 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -264,7 +264,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL) + WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) AND f.shipped >= ?`, [date]); stmts.push(stmt); diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 32b2197ad5..f125ac586f 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -294,7 +294,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL) + WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) AND f.shipped >= ? `, [date]); diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js index 88bbd6f30a..2479245912 100644 --- a/modules/ticket/back/methods/ticket/getTicketsFuture.js +++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js @@ -152,7 +152,7 @@ module.exports = Self => { SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped, f.lines, f.liters FROM tmp.filter f LEFT JOIN alertLevel al ON al.id = f.alertLevel - WHERE (al.code IN ('FREE', 'APPROVED') OR f.alertLevel IS NULL) + WHERE (al.code = 'FREE' OR f.alertLevel IS NULL) `); stmts.push(stmt); From c1dd0eeb32b22d6619634aa7dd4b4f510b5e457d Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 3 Feb 2025 10:54:17 +0100 Subject: [PATCH 27/31] refactor: refs #8512 Add 'master' branch check in description condition --- modules/mdb/back/methods/mdbVersion/upload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mdb/back/methods/mdbVersion/upload.js b/modules/mdb/back/methods/mdbVersion/upload.js index 64de726791..ee67e35d03 100644 --- a/modules/mdb/back/methods/mdbVersion/upload.js +++ b/modules/mdb/back/methods/mdbVersion/upload.js @@ -146,7 +146,7 @@ module.exports = Self => { await fs.symlink(rootRelative, destinationRoot); } } - if (description) { + if (description && branch == 'master') { let formatDesc; const mainBranches = new Set(['master', 'test', 'dev']); if (mainBranches.has(branch)) From 6b9c8300fb3509e7f7c5fd89b354488eefb3a5b6 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 3 Feb 2025 12:41:56 +0100 Subject: [PATCH 28/31] feat: refs #7412 notificationMisAllocation --- db/dump/fixtures.before.sql | 6 ++++-- db/versions/11430-salmonRaphis/00-firstScript.sql | 5 +++++ .../misallocation-warehouse/assets/css/import.js | 11 +++++++++++ .../email/misallocation-warehouse/locale/en.yml | 3 +++ .../email/misallocation-warehouse/locale/es.yml | 3 +++ .../email/misallocation-warehouse/locale/fr.yml | 3 +++ .../email/misallocation-warehouse/locale/pt.yml | 3 +++ .../misallocation-warehouse.html | 9 +++++++++ .../misallocation-warehouse.js | 15 +++++++++++++++ 9 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 db/versions/11430-salmonRaphis/00-firstScript.sql create mode 100644 print/templates/email/misallocation-warehouse/assets/css/import.js create mode 100644 print/templates/email/misallocation-warehouse/locale/en.yml create mode 100644 print/templates/email/misallocation-warehouse/locale/es.yml create mode 100644 print/templates/email/misallocation-warehouse/locale/fr.yml create mode 100644 print/templates/email/misallocation-warehouse/locale/pt.yml create mode 100644 print/templates/email/misallocation-warehouse/misallocation-warehouse.html create mode 100755 print/templates/email/misallocation-warehouse/misallocation-warehouse.js diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index c08938f043..afcacbcc4d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -2926,7 +2926,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`) (7, 'zone-included','An email to notify zoneCollisions'), (8, 'backup-printer-selected','A backup printer has been selected'), (9, 'mrw-deadline','The MRW deadline has passed'), - (10,'invoice-ticket-closure','Tickets not invoiced during the nightly closure ticket process'); + (10,'invoice-ticket-closure','Tickets not invoiced during the nightly closure ticket process'), + (11,'misallocation-warehouse','Misallocation of items in the warehouse.'); TRUNCATE `util`.`notificationAcl`; INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) @@ -2940,7 +2941,8 @@ INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`) (6, 9), (7, 9), (8, 66), - (9, 56); + (9, 56), + (11, 9); TRUNCATE `util`.`notificationQueue`; INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`) diff --git a/db/versions/11430-salmonRaphis/00-firstScript.sql b/db/versions/11430-salmonRaphis/00-firstScript.sql new file mode 100644 index 0000000000..65f8fa43b1 --- /dev/null +++ b/db/versions/11430-salmonRaphis/00-firstScript.sql @@ -0,0 +1,5 @@ + + +INSERT IGNORE INTO util.notification + SET name = 'misallocation-warehouse', + description = 'Misallocation in warehouse'; diff --git a/print/templates/email/misallocation-warehouse/assets/css/import.js b/print/templates/email/misallocation-warehouse/assets/css/import.js new file mode 100644 index 0000000000..4b4bb70869 --- /dev/null +++ b/print/templates/email/misallocation-warehouse/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/misallocation-warehouse/locale/en.yml b/print/templates/email/misallocation-warehouse/locale/en.yml new file mode 100644 index 0000000000..b16d9bd50a --- /dev/null +++ b/print/templates/email/misallocation-warehouse/locale/en.yml @@ -0,0 +1,3 @@ +subject: Misallocation of articles +title: Misallocation of articles +body: Misallocated articles have been placed in the warehouse that do not correspond to the entry location. diff --git a/print/templates/email/misallocation-warehouse/locale/es.yml b/print/templates/email/misallocation-warehouse/locale/es.yml new file mode 100644 index 0000000000..fbb1c74f16 --- /dev/null +++ b/print/templates/email/misallocation-warehouse/locale/es.yml @@ -0,0 +1,3 @@ +subject: Artículos mal ubicados +title: Artículos mal ubicados +body: Artículos mal ubicados han sido colocados en el almacén que no corresponden a la ubicación de la entrada. diff --git a/print/templates/email/misallocation-warehouse/locale/fr.yml b/print/templates/email/misallocation-warehouse/locale/fr.yml new file mode 100644 index 0000000000..0c8f155d6b --- /dev/null +++ b/print/templates/email/misallocation-warehouse/locale/fr.yml @@ -0,0 +1,3 @@ +subject: Artículos mal placés +title: Artículos mal placés +body: Artículos mal placés ont été stockés dans l’entrepôt qui ne correspond pas à l’emplacement de l’entrée. diff --git a/print/templates/email/misallocation-warehouse/locale/pt.yml b/print/templates/email/misallocation-warehouse/locale/pt.yml new file mode 100644 index 0000000000..129960ba69 --- /dev/null +++ b/print/templates/email/misallocation-warehouse/locale/pt.yml @@ -0,0 +1,3 @@ +subject: Artículos mal colocados +title: Artículos mal colocados +body: Artículos mal colocados foram armazenados no armazém que não corresponde à localização da entrada. diff --git a/print/templates/email/misallocation-warehouse/misallocation-warehouse.html b/print/templates/email/misallocation-warehouse/misallocation-warehouse.html new file mode 100644 index 0000000000..ad68ae0b63 --- /dev/null +++ b/print/templates/email/misallocation-warehouse/misallocation-warehouse.html @@ -0,0 +1,9 @@ + +
+
+

{{ $t('title') }}

+

{{$t('body')}}

+

{{action}}

+
+
+
diff --git a/print/templates/email/misallocation-warehouse/misallocation-warehouse.js b/print/templates/email/misallocation-warehouse/misallocation-warehouse.js new file mode 100755 index 0000000000..f61cef8192 --- /dev/null +++ b/print/templates/email/misallocation-warehouse/misallocation-warehouse.js @@ -0,0 +1,15 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component('email-body'); + +module.exports = { + name: 'misallocation-warehouse', + components: { + 'email-body': emailBody.build(), + }, + props: { + action: { + type: String, + required: true + } + } +}; From 9adb160f2da8d12ef193303d0cdb835495e97a67 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 3 Feb 2025 16:14:48 +0100 Subject: [PATCH 29/31] feat: refs #7412 refs#7569 sendEmailNotificationChangeText --- loopback/locale/es.json | 796 ++++++++++++++++++++-------------------- 1 file changed, 398 insertions(+), 398 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index f79dad236e..b8c3d6a564 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,400 +1,400 @@ { - "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 {{changes}} del ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changes in sales": "la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}*", - "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}}*, con el tipo de recogida *{{claimPickup}}*", - "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", - "agency": "Agencia", - "delivery": "Reparto", - "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º %s", - "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}} {{defaulterId}} ({{{defaulterUrl}}})", - "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", - "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", - "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 que cumplan los requisitos de facturación", - "this warehouse has not dms": "El Almacén no acepta documentos", - "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", - "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", - "No invoice series found for these parameters": "No se encontró una serie para estos parámetros", - "The line could not be marked": "La linea no puede ser marcada", - "Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado", - "They're not your subordinate": "No es tu subordinado/a.", - "No results found": "No se han encontrado resultados", - "InvoiceIn is already booked": "La factura recibida está contabilizada", - "This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia", - "Select ticket or client": "Elija un ticket o un client", - "It was not able to create the invoice": "No se pudo crear la factura", - "Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE", - "You can not use the same password": "No puedes usar la misma contraseña", - "This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario", - "You can only have one PDA": "Solo puedes tener un PDA", - "The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF", - "It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono", - "Payment method is required": "El método de pago es obligatorio", - "Cannot send mail": "Não é possível enviar o email", - "CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos", - "The sale not exists in the item shelving": "La venta no existe en la estantería del artículo", - "The entry not have stickers": "La entrada no tiene etiquetas", - "Too many records": "Demasiados registros", - "Original invoice not found": "Factura original no encontrada", - "The entry has no lines or does not exist": "La entrada no tiene lineas o no existe", - "Weight already set": "El peso ya está establecido", - "This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento", - "There is already a tray with the same height": "Ya existe una bandeja con la misma altura", - "The height must be greater than 50cm": "La altura debe ser superior a 50cm", - "The maximum height of the wagon is 200cm": "La altura máxima es 200cm", - "The entry does not have stickers": "La entrada no tiene etiquetas", - "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", - "No valid travel thermograph found": "No se encontró un termógrafo válido", - "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea", - "type cannot be blank": "Se debe rellenar el tipo", - "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", - "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", - "You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada", - "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", - "The web user's email already exists": "El correo del usuario web ya existe", - "Sales already moved": "Ya han sido transferidas", - "The raid information is not correct": "La información de la redada no es correcta", - "An item type with the same code already exists": "Un tipo con el mismo código ya existe", - "Holidays to past days not available": "Las vacaciones a días pasados no están disponibles", - "All tickets have a route order": "Todos los tickets tienen orden de ruta", - "There are tickets to be invoiced": "La zona tiene tickets por facturar", - "Incorrect delivery order alert on route": "Alerta de orden de entrega incorrecta en ruta: {{ route }} zona: {{ zone }}", - "Ticket has been delivered out of order": "El ticket {{ticket}} {{{fullUrl}}} no ha sigo entregado en su orden.", - "Price cannot be blank": "El precio no puede estar en blanco" + "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 {{changes}} del ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changes in sales": "la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}*", + "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}}*, con el tipo de recogida *{{claimPickup}}*", + "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", + "agency": "Agencia", + "delivery": "Reparto", + "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º %s", + "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}} {{defaulterId}} ({{{defaulterUrl}}})", + "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", + "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", + "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 que cumplan los requisitos de facturación", + "this warehouse has not dms": "El Almacén no acepta documentos", + "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", + "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", + "No invoice series found for these parameters": "No se encontró una serie para estos parámetros", + "The line could not be marked": "La linea no puede ser marcada", + "Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado", + "They're not your subordinate": "No es tu subordinado/a.", + "No results found": "No se han encontrado resultados", + "InvoiceIn is already booked": "La factura recibida está contabilizada", + "This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia", + "Select ticket or client": "Elija un ticket o un client", + "It was not able to create the invoice": "No se pudo crear la factura", + "Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE", + "You can not use the same password": "No puedes usar la misma contraseña", + "This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario", + "You can only have one PDA": "Solo puedes tener un PDA", + "The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF", + "It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono", + "Payment method is required": "El método de pago es obligatorio", + "Cannot send mail": "Não é possível enviar o email", + "CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos", + "The sale not exists in the item shelving": "La venta no existe en la estantería del artículo", + "The entry not have stickers": "La entrada no tiene etiquetas", + "Too many records": "Demasiados registros", + "Original invoice not found": "Factura original no encontrada", + "The entry has no lines or does not exist": "La entrada no tiene lineas o no existe", + "Weight already set": "El peso ya está establecido", + "This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento", + "There is already a tray with the same height": "Ya existe una bandeja con la misma altura", + "The height must be greater than 50cm": "La altura debe ser superior a 50cm", + "The maximum height of the wagon is 200cm": "La altura máxima es 200cm", + "The entry does not have stickers": "La entrada no tiene etiquetas", + "This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha", + "No valid travel thermograph found": "No se encontró un termógrafo válido", + "The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea", + "type cannot be blank": "Se debe rellenar el tipo", + "There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero", + "There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén", + "You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada", + "ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}", + "The web user's email already exists": "El correo del usuario web ya existe", + "Sales already moved": "Ya han sido transferidas", + "The raid information is not correct": "La información de la redada no es correcta", + "An item type with the same code already exists": "Un tipo con el mismo código ya existe", + "Holidays to past days not available": "Las vacaciones a días pasados no están disponibles", + "All tickets have a route order": "Todos los tickets tienen orden de ruta", + "There are tickets to be invoiced": "La zona tiene tickets por facturar", + "Incorrect delivery order alert on route": "Alerta de orden de entrega incorrecta en ruta: {{ route }} zona: {{ zone }}", + "Ticket has been delivered out of order": "El ticket {{ticket}} {{{fullUrl}}} no ha sido entregado en su orden.", + "Price cannot be blank": "El precio no puede estar en blanco" } From 9cecdab5a823c2d45d50beb9771c93d94ba32478 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 4 Feb 2025 07:17:11 +0100 Subject: [PATCH 30/31] refactor: refs #8227 Fix tests --- db/dump/fixtures.before.sql | 6 +++--- .../back/methods/agency-term/specs/filter.spec.js | 10 +++++----- modules/route/back/methods/route/specs/filter.spec.js | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 5e23178ecd..98c7f42f85 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -752,11 +752,11 @@ INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1'); INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `dated`) VALUES - (1, '1899-12-30 12:15:00', 56, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (1, '1899-12-30 12:15:00', 133, util.VN_CURDATE(), 1, 1, 'first route', 1.8, 10, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), (2, '1899-12-30 13:20:00', 56, util.VN_CURDATE(), 1, 2, 'second route', 0.2, 20, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), - (3, '1899-12-30 14:30:00', 56, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (3, '1899-12-30 14:30:00', 133, util.VN_CURDATE(), 2, 3, 'third route', 0.5, 30, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), (4, '1899-12-30 15:45:00', 56, util.VN_CURDATE(), 3, 4, 'fourth route', 0, 40, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), - (5, '1899-12-30 16:00:00', 56, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), + (5, '1899-12-30 16:00:00', 133, util.VN_CURDATE(), 4, 5, 'fifth route', 0.1, 50, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), (6, NULL, 57, util.VN_CURDATE(), 5, 7, 'sixth route', 1.7, 60, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()), (7, NULL, 57, util.VN_CURDATE(), 6, 8, 'seventh route', 0, 70, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), util.VN_CURDATE()); diff --git a/modules/route/back/methods/agency-term/specs/filter.spec.js b/modules/route/back/methods/agency-term/specs/filter.spec.js index aa27438688..41e696157d 100644 --- a/modules/route/back/methods/agency-term/specs/filter.spec.js +++ b/modules/route/back/methods/agency-term/specs/filter.spec.js @@ -18,7 +18,7 @@ describe('AgencyTerm filter()', () => { const firstAgencyTerm = agencyTerms[0]; expect(firstAgencyTerm.routeFk).toEqual(1); - expect(agencyTerms.length).toEqual(7); + expect(agencyTerms.length).toEqual(5); await tx.rollback(); } catch (e) { @@ -49,7 +49,7 @@ describe('AgencyTerm filter()', () => { let result = await app.models.AgencyTerm.filter(ctx); - expect(result.length).toEqual(4); + expect(result.length).toEqual(2); }); it('should return results matching "from" and "to"', async() => { @@ -72,7 +72,7 @@ describe('AgencyTerm filter()', () => { const results = await models.AgencyTerm.filter(ctx, options); - expect(results.length).toBe(7); + expect(results.length).toBe(5); await tx.rollback(); } catch (e) { @@ -90,7 +90,7 @@ describe('AgencyTerm filter()', () => { let result = await app.models.AgencyTerm.filter(ctx); - expect(result.length).toEqual(2); + expect(result.length).toEqual(1); expect(result[0].routeFk).toEqual(1); }); @@ -103,7 +103,7 @@ describe('AgencyTerm filter()', () => { let result = await app.models.AgencyTerm.filter(ctx); - expect(result.length).toEqual(2); + expect(result.length).toEqual(1); expect(result[0].routeFk).toEqual(2); }); }); diff --git a/modules/route/back/methods/route/specs/filter.spec.js b/modules/route/back/methods/route/specs/filter.spec.js index 11bf0b7b0a..ddc2fe893d 100644 --- a/modules/route/back/methods/route/specs/filter.spec.js +++ b/modules/route/back/methods/route/specs/filter.spec.js @@ -59,7 +59,7 @@ describe('Route filter()', () => { }; const results = await models.Route.filter(ctx, options); - expect(results.length).toBe(9); + expect(results.length).toBe(7); await tx.rollback(); } catch (e) { @@ -115,7 +115,7 @@ describe('Route filter()', () => { }; const result = await app.models.Route.filter(ctx); - expect(result.length).toEqual(4); + expect(result.length).toEqual(2); }); it('should return the routes matching "warehouseFk"', async() => { @@ -132,7 +132,7 @@ describe('Route filter()', () => { let result = await app.models.Route.filter(ctx); - expect(result.length).toEqual(9); + expect(result.length).toEqual(7); ctx.args.warehouseFk = 2; From eb9d3a7b21b8371e9ae14115fc3282e859d05242 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 4 Feb 2025 08:27:21 +0100 Subject: [PATCH 31/31] refactor: refs #8227 Requested changes --- .../vn/procedures/roadmap_cloneDay.sql | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/db/routines/vn/procedures/roadmap_cloneDay.sql b/db/routines/vn/procedures/roadmap_cloneDay.sql index 4247b881e8..8c38039473 100644 --- a/db/routines/vn/procedures/roadmap_cloneDay.sql +++ b/db/routines/vn/procedures/roadmap_cloneDay.sql @@ -12,8 +12,15 @@ BEGIN * @param vDateToPaste Fecha para pegar */ DECLARE vDaysDiff INT; - DECLARE vNextRoadmapId INT; + DECLARE vRoadmapFk INT; + DECLARE vNewRoadmapFk INT; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vRoadmaps CURSOR FOR + SELECT id + FROM roadmap + WHERE etd BETWEEN vDateToCopy AND util.dayEnd(vDateToCopy); + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; @@ -28,23 +35,14 @@ BEGIN START TRANSACTION; - SELECT AUTO_INCREMENT INTO vNextRoadmapId - FROM information_schema.tables - WHERE table_name = 'roadmap' - AND table_schema = 'vn'; + OPEN vRoadmaps; + l: LOOP + SET vDone = FALSE; + FETCH vRoadmaps INTO vRoadmapFk; - CREATE OR REPLACE TEMPORARY TABLE tmp.roadmapsToCopy - ENGINE = MEMORY - SELECT ROW_NUMBER() OVER(ORDER BY id) rowOrder, - id, - `name`, - roadmapAddressFk, - etd, - eta, - observations, - price - FROM roadmap - WHERE etd BETWEEN vDateToCopy AND util.dayEnd(vDateToCopy); + IF vDone THEN + LEAVE l; + END IF; INSERT INTO roadmap (`name`, roadmapAddressFk, etd, eta, observations, price) SELECT `name`, @@ -53,19 +51,22 @@ BEGIN eta + INTERVAL vDaysDiff DAY, observations, price - FROM tmp.roadmapsToCopy; + FROM roadmap + WHERE id = vRoadmapFk; + + SET vNewRoadmapFk = LAST_INSERT_ID(); INSERT INTO roadmapStop (roadmapFk, roadmapAddressFk, eta, `description`, bufferFk) - SELECT (rtc.rowOrder - 1) + vNextRoadmapId, - rs.roadmapAddressFk, - rs.eta + INTERVAL vDaysDiff DAY, - rs.description, - rs.bufferFk - FROM tmp.roadmapsToCopy rtc - JOIN roadmapStop rs ON rs.roadmapFk = rtc.id; + SELECT vNewRoadmapFk, + roadmapAddressFk, + eta + INTERVAL vDaysDiff DAY, + `description`, + bufferFk + FROM roadmapStop + WHERE roadmapFk = vRoadmapFk; + END LOOP; + CLOSE vRoadmaps; COMMIT; - - DROP TEMPORARY TABLE tmp.roadmapsToCopy; END$$ DELIMITER ;