From 4f6ae220e1773141b8edf34ca96c3535627999c4 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 19 Feb 2024 15:10:34 +0100 Subject: [PATCH 01/62] feat: refs #6738 crear las Fk de la tabla flight --- db/versions/10894-crimsonEucalyptus/00-firstScript.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 db/versions/10894-crimsonEucalyptus/00-firstScript.sql diff --git a/db/versions/10894-crimsonEucalyptus/00-firstScript.sql b/db/versions/10894-crimsonEucalyptus/00-firstScript.sql new file mode 100644 index 000000000..167c38f70 --- /dev/null +++ b/db/versions/10894-crimsonEucalyptus/00-firstScript.sql @@ -0,0 +1,3 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS vn.flight ADD CONSTRAINT flight_airline_FK FOREIGN KEY (airlineFk) + REFERENCES vn.airline(id) ON DELETE CASCADE ON UPDATE CASCADE; \ No newline at end of file From 9c6c5140566c8409c8eb6dff3e8ce4791c3f0776 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 27 Feb 2024 11:48:49 +0100 Subject: [PATCH 02/62] feat: refs #6738 --- db/versions/10894-crimsonEucalyptus/01-Tramos.sql | 3 +++ db/versions/10894-crimsonEucalyptus/02-dock.sql | 2 ++ .../10894-crimsonEucalyptus/03-Proveedores_cargueras.sql | 2 ++ 3 files changed, 7 insertions(+) create mode 100644 db/versions/10894-crimsonEucalyptus/01-Tramos.sql create mode 100644 db/versions/10894-crimsonEucalyptus/02-dock.sql create mode 100644 db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql diff --git a/db/versions/10894-crimsonEucalyptus/01-Tramos.sql b/db/versions/10894-crimsonEucalyptus/01-Tramos.sql new file mode 100644 index 000000000..f2ac17ad1 --- /dev/null +++ b/db/versions/10894-crimsonEucalyptus/01-Tramos.sql @@ -0,0 +1,3 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.``; + diff --git a/db/versions/10894-crimsonEucalyptus/02-dock.sql b/db/versions/10894-crimsonEucalyptus/02-dock.sql new file mode 100644 index 000000000..1816ce18b --- /dev/null +++ b/db/versions/10894-crimsonEucalyptus/02-dock.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn`.``; \ No newline at end of file diff --git a/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql b/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql new file mode 100644 index 000000000..45bac972c --- /dev/null +++ b/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.``; From 09923d2509146c9b9ac42f20b6fac3f0ba90a397 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 4 Mar 2024 18:35:36 +0100 Subject: [PATCH 03/62] refs #6964 feat:advice for olderItem --- .../methods/item-shelving/hasItemOlder.js | 44 +++++++++++++++++++ modules/item/back/models/item-shelving.js | 1 + 2 files changed, 45 insertions(+) create mode 100644 modules/item/back/methods/item-shelving/hasItemOlder.js diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js new file mode 100644 index 000000000..48b3b357a --- /dev/null +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -0,0 +1,44 @@ +module.exports = Self => { + Self.remoteMethod('hasItemOlder', { + description: 'Get boolean if any item of the shelving has older created in another shelving ', + accessType: 'WRITE', + accepts: [{ + arg: 'shelvingFk', + type: 'string', + required: true, + description: 'Shelving code' + }, + { + arg: 'parking', + type: 'string', + required: true, + description: 'Parking code' + }], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/hasItemOlder`, + verb: 'GET' + } + }); + + Self.hasItemOlder = async(shelvingFk, parking, options) => { + const result = await Self.rawSql(` + SELECT COUNT(ish.id) + FROM vn.itemShelving ish + JOIN ( + SELECT ish.itemFk, created,shelvingFk, p.code + FROM vn.itemShelving ish + JOIN vn.shelving s ON ish.shelvingFk = s.code + JOIN vn.parking p ON p.id = s.parkingFk + WHERE ish.shelvingFk = ? + )sub ON sub.itemFK = ish.itemFk + JOIN vn.shelving s ON s.code = ish.shelvingFk + JOIN vn.parking p ON p.id = s.parkingFk + WHERE ish.shelvingFk <> ? AND sub.created > ish.created AND p.code <> ?`, + [shelvingFk, shelvingFk, parking]); + return result[0]['COUNT(ish.id)'] > 0; + }; +}; diff --git a/modules/item/back/models/item-shelving.js b/modules/item/back/models/item-shelving.js index c031d8271..563dffe66 100644 --- a/modules/item/back/models/item-shelving.js +++ b/modules/item/back/models/item-shelving.js @@ -2,4 +2,5 @@ module.exports = Self => { require('../methods/item-shelving/deleteItemShelvings')(Self); require('../methods/item-shelving/upsertItem')(Self); require('../methods/item-shelving/getInventory')(Self); + require('../methods/item-shelving/hasItemOlder')(Self); }; From 9a0b4ef6744640b00dca8f6bdfb4bac1dd7812c5 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 5 Mar 2024 08:36:19 +0100 Subject: [PATCH 04/62] feat: refs #6738 change table vn2008 to vn --- .../vn2008/views/Proveedores_cargueras.sql | 5 ++++ db/routines/vn2008/views/Tramos.sql | 6 +++++ db/routines/vn2008/views/dock.sql | 8 ++++++ .../10894-crimsonEucalyptus/01-Tramos.sql | 4 ++- .../10894-crimsonEucalyptus/02-dock.sql | 3 ++- .../03-Proveedores_cargueras.sql | 5 +++- .../10894-crimsonEucalyptus/04-Permisos.sql | 25 +++++++++++++++++++ 7 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 db/routines/vn2008/views/Proveedores_cargueras.sql create mode 100644 db/routines/vn2008/views/Tramos.sql create mode 100644 db/routines/vn2008/views/dock.sql create mode 100644 db/versions/10894-crimsonEucalyptus/04-Permisos.sql diff --git a/db/routines/vn2008/views/Proveedores_cargueras.sql b/db/routines/vn2008/views/Proveedores_cargueras.sql new file mode 100644 index 000000000..a1aa2f7f4 --- /dev/null +++ b/db/routines/vn2008/views/Proveedores_cargueras.sql @@ -0,0 +1,5 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Proveedores_cargueras` +AS SELECT `fs`.`id` AS `Id_Proveedor` +FROM `vn`.`freightSupplier` `fs` diff --git a/db/routines/vn2008/views/Tramos.sql b/db/routines/vn2008/views/Tramos.sql new file mode 100644 index 000000000..eda3ff0db --- /dev/null +++ b/db/routines/vn2008/views/Tramos.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Tramos` +AS SELECT `s`.`id` AS `id`, + `s`.`isFree` AS `Tramo` +FROM `vn`.`section` `s` \ No newline at end of file diff --git a/db/routines/vn2008/views/dock.sql b/db/routines/vn2008/views/dock.sql new file mode 100644 index 000000000..753e38a6c --- /dev/null +++ b/db/routines/vn2008/views/dock.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`dock` +AS SELECT `d`.`id` AS `id`, + `d`.`code` AS `code`, + `d`.`xPos` AS `xPos`, + `d`.`yPos` AS `yPos` +FROM `vn`.`dock` `d` diff --git a/db/versions/10894-crimsonEucalyptus/01-Tramos.sql b/db/versions/10894-crimsonEucalyptus/01-Tramos.sql index f2ac17ad1..ad8e2f9c4 100644 --- a/db/versions/10894-crimsonEucalyptus/01-Tramos.sql +++ b/db/versions/10894-crimsonEucalyptus/01-Tramos.sql @@ -1,3 +1,5 @@ -- Place your SQL code here -ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.``; +ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.`section`; +ALTER TABLE IF EXISTS `vn`.`section` +CHANGE COLUMN IF EXISTS `Tramo` `section` time NOT NULL; \ No newline at end of file diff --git a/db/versions/10894-crimsonEucalyptus/02-dock.sql b/db/versions/10894-crimsonEucalyptus/02-dock.sql index 1816ce18b..23f8f0705 100644 --- a/db/versions/10894-crimsonEucalyptus/02-dock.sql +++ b/db/versions/10894-crimsonEucalyptus/02-dock.sql @@ -1,2 +1,3 @@ -- Place your SQL code here -ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn`.``; \ No newline at end of file +ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn`.`dock`; + diff --git a/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql b/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql index 45bac972c..0de477f88 100644 --- a/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql +++ b/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql @@ -1,2 +1,5 @@ -- Place your SQL code here -ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.``; +ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.`freightSupplier`; + +ALTER TABLE IF EXISTS `vn`.`freightSupplier` +CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL; \ No newline at end of file diff --git a/db/versions/10894-crimsonEucalyptus/04-Permisos.sql b/db/versions/10894-crimsonEucalyptus/04-Permisos.sql new file mode 100644 index 000000000..441a6ff8e --- /dev/null +++ b/db/versions/10894-crimsonEucalyptus/04-Permisos.sql @@ -0,0 +1,25 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Tramos` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.Tramos TO `employee`; +GRANT SELECT ON TABLE vn.section TO `employee`; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`dock` AS +SELECT 1; + +GRANT SELECT,UPDATE ON TABLE vn2008.dock TO `employee`; +GRANT SELECT ON TABLE vn2008.dock TO `grafana`; +GRANT SELECT,UPDATE ON TABLE vn.dock TO `employee`; +GRANT SELECT ON TABLE vn.dock TO `grafana`; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Proveedores_cargueras` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.Proveedores_cargueras TO `buyer`; +GRANT SELECT ON TABLE vn.freightSupplier TO `buyer`; \ No newline at end of file From dc343a7e3bd4aaaadabc24a0863b95dacd587c49 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 5 Mar 2024 09:33:48 +0100 Subject: [PATCH 05/62] feat: refs #6738 delete vn2008.dock --- db/routines/vn2008/views/dock.sql | 8 -------- db/versions/10894-crimsonEucalyptus/02-dock.sql | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 db/routines/vn2008/views/dock.sql diff --git a/db/routines/vn2008/views/dock.sql b/db/routines/vn2008/views/dock.sql deleted file mode 100644 index 753e38a6c..000000000 --- a/db/routines/vn2008/views/dock.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`dock` -AS SELECT `d`.`id` AS `id`, - `d`.`code` AS `code`, - `d`.`xPos` AS `xPos`, - `d`.`yPos` AS `yPos` -FROM `vn`.`dock` `d` diff --git a/db/versions/10894-crimsonEucalyptus/02-dock.sql b/db/versions/10894-crimsonEucalyptus/02-dock.sql index 23f8f0705..acce9f37c 100644 --- a/db/versions/10894-crimsonEucalyptus/02-dock.sql +++ b/db/versions/10894-crimsonEucalyptus/02-dock.sql @@ -1,3 +1,3 @@ -- Place your SQL code here -ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn`.`dock`; - +ALTER TABLE IF EXISTS `vn2008`.`dock` RENAME `vn2008`.`dock__`; +ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-03-05'; \ No newline at end of file From d668ae9904c3680a86bb799626e44dec5ef506af Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 5 Mar 2024 09:34:30 +0100 Subject: [PATCH 06/62] refs #6738 --- db/versions/10894-crimsonEucalyptus/04-Permisos.sql | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/db/versions/10894-crimsonEucalyptus/04-Permisos.sql b/db/versions/10894-crimsonEucalyptus/04-Permisos.sql index 441a6ff8e..a7defb75f 100644 --- a/db/versions/10894-crimsonEucalyptus/04-Permisos.sql +++ b/db/versions/10894-crimsonEucalyptus/04-Permisos.sql @@ -6,16 +6,6 @@ SELECT 1; GRANT SELECT ON TABLE vn2008.Tramos TO `employee`; GRANT SELECT ON TABLE vn.section TO `employee`; -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`dock` AS -SELECT 1; - -GRANT SELECT,UPDATE ON TABLE vn2008.dock TO `employee`; -GRANT SELECT ON TABLE vn2008.dock TO `grafana`; -GRANT SELECT,UPDATE ON TABLE vn.dock TO `employee`; -GRANT SELECT ON TABLE vn.dock TO `grafana`; - CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`Proveedores_cargueras` AS From 5f16a9827c9fecc542a3329b98846541b14dae25 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 5 Mar 2024 14:17:58 +0100 Subject: [PATCH 07/62] feat: refs #6738 move file version --- db/routines/vn2008/views/Proveedores_cargueras.sql | 2 +- db/routines/vn2008/views/Tramos.sql | 2 +- .../00-firstScript.sql | 0 .../01-Tramos.sql | 0 .../{10894-crimsonEucalyptus => 10930-wheatDendro}/02-dock.sql | 0 .../03-Proveedores_cargueras.sql | 0 .../04-Permisos.sql | 0 7 files changed, 2 insertions(+), 2 deletions(-) rename db/versions/{10894-crimsonEucalyptus => 10930-wheatDendro}/00-firstScript.sql (100%) rename db/versions/{10894-crimsonEucalyptus => 10930-wheatDendro}/01-Tramos.sql (100%) rename db/versions/{10894-crimsonEucalyptus => 10930-wheatDendro}/02-dock.sql (100%) rename db/versions/{10894-crimsonEucalyptus => 10930-wheatDendro}/03-Proveedores_cargueras.sql (100%) rename db/versions/{10894-crimsonEucalyptus => 10930-wheatDendro}/04-Permisos.sql (100%) diff --git a/db/routines/vn2008/views/Proveedores_cargueras.sql b/db/routines/vn2008/views/Proveedores_cargueras.sql index a1aa2f7f4..51a02556a 100644 --- a/db/routines/vn2008/views/Proveedores_cargueras.sql +++ b/db/routines/vn2008/views/Proveedores_cargueras.sql @@ -1,5 +1,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`Proveedores_cargueras` -AS SELECT `fs`.`id` AS `Id_Proveedor` +AS SELECT `fs`.`supplierFk` AS `Id_Proveedor` FROM `vn`.`freightSupplier` `fs` diff --git a/db/routines/vn2008/views/Tramos.sql b/db/routines/vn2008/views/Tramos.sql index eda3ff0db..47a2cb653 100644 --- a/db/routines/vn2008/views/Tramos.sql +++ b/db/routines/vn2008/views/Tramos.sql @@ -2,5 +2,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`Tramos` AS SELECT `s`.`id` AS `id`, - `s`.`isFree` AS `Tramo` + `s`.`section` AS `Tramo` FROM `vn`.`section` `s` \ No newline at end of file diff --git a/db/versions/10894-crimsonEucalyptus/00-firstScript.sql b/db/versions/10930-wheatDendro/00-firstScript.sql similarity index 100% rename from db/versions/10894-crimsonEucalyptus/00-firstScript.sql rename to db/versions/10930-wheatDendro/00-firstScript.sql diff --git a/db/versions/10894-crimsonEucalyptus/01-Tramos.sql b/db/versions/10930-wheatDendro/01-Tramos.sql similarity index 100% rename from db/versions/10894-crimsonEucalyptus/01-Tramos.sql rename to db/versions/10930-wheatDendro/01-Tramos.sql diff --git a/db/versions/10894-crimsonEucalyptus/02-dock.sql b/db/versions/10930-wheatDendro/02-dock.sql similarity index 100% rename from db/versions/10894-crimsonEucalyptus/02-dock.sql rename to db/versions/10930-wheatDendro/02-dock.sql diff --git a/db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql b/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql similarity index 100% rename from db/versions/10894-crimsonEucalyptus/03-Proveedores_cargueras.sql rename to db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql diff --git a/db/versions/10894-crimsonEucalyptus/04-Permisos.sql b/db/versions/10930-wheatDendro/04-Permisos.sql similarity index 100% rename from db/versions/10894-crimsonEucalyptus/04-Permisos.sql rename to db/versions/10930-wheatDendro/04-Permisos.sql From a6de9fd370899d82e3e391a9bac8a83a6182c777 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 13 Mar 2024 07:19:06 +0100 Subject: [PATCH 08/62] feat: refs #6738 modificar a nombres propuestos --- db/routines/vn2008/views/Proveedores_cargueras.sql | 2 +- db/routines/vn2008/views/Tramos.sql | 2 +- db/versions/10930-wheatDendro/01-Tramos.sql | 4 ++-- db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql | 4 ++-- db/versions/10930-wheatDendro/04-Permisos.sql | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/db/routines/vn2008/views/Proveedores_cargueras.sql b/db/routines/vn2008/views/Proveedores_cargueras.sql index 51a02556a..c1dc6ad23 100644 --- a/db/routines/vn2008/views/Proveedores_cargueras.sql +++ b/db/routines/vn2008/views/Proveedores_cargueras.sql @@ -2,4 +2,4 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`Proveedores_cargueras` AS SELECT `fs`.`supplierFk` AS `Id_Proveedor` -FROM `vn`.`freightSupplier` `fs` +FROM `vn`.`supplierFreight` `fs` diff --git a/db/routines/vn2008/views/Tramos.sql b/db/routines/vn2008/views/Tramos.sql index 47a2cb653..6919a610b 100644 --- a/db/routines/vn2008/views/Tramos.sql +++ b/db/routines/vn2008/views/Tramos.sql @@ -3,4 +3,4 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `vn2008`.`Tramos` AS SELECT `s`.`id` AS `id`, `s`.`section` AS `Tramo` -FROM `vn`.`section` `s` \ No newline at end of file +FROM `vn`.`timeSlots` `s` \ No newline at end of file diff --git a/db/versions/10930-wheatDendro/01-Tramos.sql b/db/versions/10930-wheatDendro/01-Tramos.sql index ad8e2f9c4..595aa5dcb 100644 --- a/db/versions/10930-wheatDendro/01-Tramos.sql +++ b/db/versions/10930-wheatDendro/01-Tramos.sql @@ -1,5 +1,5 @@ -- Place your SQL code here -ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.`section`; +ALTER TABLE IF EXISTS `vn2008`.`Tramos` RENAME `vn`.`timeSlots`; -ALTER TABLE IF EXISTS `vn`.`section` +ALTER TABLE IF EXISTS `vn`.`timeSlots` CHANGE COLUMN IF EXISTS `Tramo` `section` time NOT NULL; \ No newline at end of file diff --git a/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql b/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql index 0de477f88..148174215 100644 --- a/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql +++ b/db/versions/10930-wheatDendro/03-Proveedores_cargueras.sql @@ -1,5 +1,5 @@ -- Place your SQL code here -ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.`freightSupplier`; +ALTER TABLE IF EXISTS `vn2008`.`Proveedores_cargueras` RENAME `vn`.`supplierFreight`; -ALTER TABLE IF EXISTS `vn`.`freightSupplier` +ALTER TABLE IF EXISTS `vn`.`supplierFreight` CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL; \ No newline at end of file diff --git a/db/versions/10930-wheatDendro/04-Permisos.sql b/db/versions/10930-wheatDendro/04-Permisos.sql index a7defb75f..0c445755b 100644 --- a/db/versions/10930-wheatDendro/04-Permisos.sql +++ b/db/versions/10930-wheatDendro/04-Permisos.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SELECT 1; GRANT SELECT ON TABLE vn2008.Tramos TO `employee`; -GRANT SELECT ON TABLE vn.section TO `employee`; +GRANT SELECT ON TABLE vn.timeSlots TO `employee`; CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER @@ -12,4 +12,4 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SELECT 1; GRANT SELECT ON TABLE vn2008.Proveedores_cargueras TO `buyer`; -GRANT SELECT ON TABLE vn.freightSupplier TO `buyer`; \ No newline at end of file +GRANT SELECT ON TABLE vn.supplierFreight TO `buyer`; \ No newline at end of file From 0413707061d32326a92e868b53f40dcb02d2a79d Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 13 Mar 2024 12:50:27 +0100 Subject: [PATCH 09/62] feat: refs #6738 --- db/dump/fixtures.after.sql | 18 +++++++++--------- db/routines/vn2008/views/payrollWorker.sql | 6 ++++++ db/routines/vn2008/views/payroll_centros.sql | 6 ++++++ db/routines/vn2008/views/payroll_conceptos.sql | 9 +++++++++ .../10930-wheatDendro/04-payroll_employee.sql | 13 +++++++++++++ .../10930-wheatDendro/05-payroll_centros.sql | 13 +++++++++++++ .../10930-wheatDendro/06-payroll_conceptos.sql | 6 ++++++ .../{04-Permisos.sql => 07-Permisos.sql} | 0 8 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 db/routines/vn2008/views/payrollWorker.sql create mode 100644 db/routines/vn2008/views/payroll_centros.sql create mode 100644 db/routines/vn2008/views/payroll_conceptos.sql create mode 100644 db/versions/10930-wheatDendro/04-payroll_employee.sql create mode 100644 db/versions/10930-wheatDendro/05-payroll_centros.sql create mode 100644 db/versions/10930-wheatDendro/06-payroll_conceptos.sql rename db/versions/10930-wheatDendro/{04-Permisos.sql => 07-Permisos.sql} (100%) diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index bda625a96..3d5fbfa90 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -156,16 +156,16 @@ INSERT INTO `vn`.`occupationCode` (`code`, `name`) ('b', 'Representantes de comercio'), ('c', 'Personal de oficios en trabajos de construcción en general, y en instalac.,edificios y obras'); -INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`nss`,`codpuesto`,`codempresa`,`codcontrato`,`FAntiguedad`,`grupotarifa`,`codcategoria`,`ContratoTemporal`) +INSERT INTO `vn2008`.`payroll_employee` (`CodTrabajador`,`codempresa`) VALUES - (36,'46/10515497-58',6,20,189,'2009-01-02',5,10,0), - (43,'46/10235353-50',7,20,189,'2009-04-21',5,10,0), - (76,'46/10250562-30',1,20,189,'2009-09-07',9,5,0), - (1106,'46/10297768-94',4,20,100,'2021-03-09',7,18,0), - (1107,'46/1627085-11',15,20,402,'2021-03-15',9,6,1), - (1108,'46/10446901-41',25,20,502,'2021-03-22',10,29,1), - (1109,'46/10552113-8',3,20,402,'2021-03-23',9,9,1), - (1110,'46/10723579-75',3,20,402,'2021-03-23',9,9,1); + (36,20), + (43,20), + (76,20), + (1106,20), + (1107,20), + (1108,20), + (1109,20), + (1110,20); INSERT INTO `vn`.`trainingCourseType` (`id`, `name`) VALUES diff --git a/db/routines/vn2008/views/payrollWorker.sql b/db/routines/vn2008/views/payrollWorker.sql new file mode 100644 index 000000000..83ba02ecf --- /dev/null +++ b/db/routines/vn2008/views/payrollWorker.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`payroll_employee` +AS SELECT `pw`.`workerCodeFk` AS `CodTrabajador`, + `pw`.`companyCodeFk` AS `codempresa` +FROM `vn`.`payrollWorker` `pw` diff --git a/db/routines/vn2008/views/payroll_centros.sql b/db/routines/vn2008/views/payroll_centros.sql new file mode 100644 index 000000000..b7e162f90 --- /dev/null +++ b/db/routines/vn2008/views/payroll_centros.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`payroll_centros` +AS SELECT `pwc`.`workCenterFkA3` AS `cod_centro`, + `pwc`.`companyFkA3` AS `codempresa` +FROM `vn`.`payrollWorkCenter` `pwc` diff --git a/db/routines/vn2008/views/payroll_conceptos.sql b/db/routines/vn2008/views/payroll_conceptos.sql new file mode 100644 index 000000000..54be27d0b --- /dev/null +++ b/db/routines/vn2008/views/payroll_conceptos.sql @@ -0,0 +1,9 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`payroll_conceptos` +AS SELECT `pc`.`id` AS `conceptoid`, + `pc`.`concept` AS `concepto`, + `pc`.`isSalaryAgreed` AS `isSalaryAgreed`, + `pc`.`isVariable` AS `isVariable`, + `pc`.`isException` AS `isException` +FROM `vn`.`payrollComponent` `pc` diff --git a/db/versions/10930-wheatDendro/04-payroll_employee.sql b/db/versions/10930-wheatDendro/04-payroll_employee.sql new file mode 100644 index 000000000..2e128ff59 --- /dev/null +++ b/db/versions/10930-wheatDendro/04-payroll_employee.sql @@ -0,0 +1,13 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS `vn2008`.`payroll_employee` RENAME `vn`.`payrollWorker`; + +ALTER TABLE IF EXISTS `vn`.`payrollWorker` +CHANGE COLUMN IF EXISTS `CodTrabajador` `workerCodeFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `nss` `nss__` varchar(23) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `codpuesto` `codpuesto__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `codempresa` `companyCodeFk` int(10) NOT NULL, +CHANGE COLUMN IF EXISTS `codcontrato` `codcontrato__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `FAntiguedad` `FAntiguedad__` date NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `grupotarifa` `grupotarifa__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `codcategoria` `codcategoria__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `ContratoTemporal` `ContratoTemporal__` tinyint(1) NOT NULL DEFAULT 0 COMMENT '@Deprecated refs #6738 15/03/2024'; \ No newline at end of file diff --git a/db/versions/10930-wheatDendro/05-payroll_centros.sql b/db/versions/10930-wheatDendro/05-payroll_centros.sql new file mode 100644 index 000000000..4911c8707 --- /dev/null +++ b/db/versions/10930-wheatDendro/05-payroll_centros.sql @@ -0,0 +1,13 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS `vn2008`.`payroll_centros` RENAME `vn`.`payrollWorkCenter`; + +ALTER TABLE IF EXISTS `vn`.`payrollWorkCenter` +CHANGE COLUMN IF EXISTS `cod_centro` `workCenterFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.', +CHANGE COLUMN IF EXISTS `Centro` `Centro__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `nss_cotizacion` `nss_cotizacion__` varchar(15) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `domicilio` `domicilio__` varchar(255) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `poblacion` `poblacion__` varchar(45) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `cp` `cp__` varchar(5) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `empresa_id` `empresa_id__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', +CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(11) DEFAULT NULL COMMENT 'Columna que hace referencia a A3.'; +; \ No newline at end of file diff --git a/db/versions/10930-wheatDendro/06-payroll_conceptos.sql b/db/versions/10930-wheatDendro/06-payroll_conceptos.sql new file mode 100644 index 000000000..45ab7a374 --- /dev/null +++ b/db/versions/10930-wheatDendro/06-payroll_conceptos.sql @@ -0,0 +1,6 @@ +-- Place your SQL code here +ALTER TABLE IF EXISTS `vn2008`.`payroll_conceptos` RENAME `vn`.`payrollComponent`; + +ALTER TABLE IF EXISTS `vn`.`payrollComponent` +CHANGE COLUMN IF EXISTS `conceptoid` `id` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `concepto` `concept` varchar(255) DEFAULT NULL; \ No newline at end of file diff --git a/db/versions/10930-wheatDendro/04-Permisos.sql b/db/versions/10930-wheatDendro/07-Permisos.sql similarity index 100% rename from db/versions/10930-wheatDendro/04-Permisos.sql rename to db/versions/10930-wheatDendro/07-Permisos.sql From 2d9a106fabafddcdf2681d6550ad20698a00e570 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 13 Mar 2024 12:59:45 +0100 Subject: [PATCH 10/62] feat: refs #6738 premisos --- db/versions/10930-wheatDendro/07-Permisos.sql | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/db/versions/10930-wheatDendro/07-Permisos.sql b/db/versions/10930-wheatDendro/07-Permisos.sql index 0c445755b..5a3dc1413 100644 --- a/db/versions/10930-wheatDendro/07-Permisos.sql +++ b/db/versions/10930-wheatDendro/07-Permisos.sql @@ -12,4 +12,29 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SELECT 1; GRANT SELECT ON TABLE vn2008.Proveedores_cargueras TO `buyer`; -GRANT SELECT ON TABLE vn.supplierFreight TO `buyer`; \ No newline at end of file +GRANT SELECT ON TABLE vn.supplierFreight TO `buyer`; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`payroll_employee` AS +SELECT 1; + +GRANT SELECT,INSERT ON TABLE vn2008.payroll_employee TO `hr`; +GRANT SELECT,INSERT ON TABLE vn.payrollWorker TO `hr`; + + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`payroll_centros` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.payroll_centros TO `hr`; +GRANT SELECT ON TABLE vn.payrollWorkCenter TO `hr`; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`payroll_conceptos` AS +SELECT 1; + +GRANT SELECT,UPDATE ON TABLE vn2008.payroll_conceptos TO `hr`; +GRANT SELECT,UPDATE ON TABLE vn.payrollComponent TO `hr`; \ No newline at end of file From fad30eb56d2e1e15eabbcb1c7cc828907272ea0d Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 13 Mar 2024 14:08:14 +0100 Subject: [PATCH 11/62] feat: refs #6738 --- db/versions/10930-wheatDendro/04-payroll_employee.sql | 4 ++-- db/versions/10930-wheatDendro/06-payroll_conceptos.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/versions/10930-wheatDendro/04-payroll_employee.sql b/db/versions/10930-wheatDendro/04-payroll_employee.sql index 2e128ff59..538c636f4 100644 --- a/db/versions/10930-wheatDendro/04-payroll_employee.sql +++ b/db/versions/10930-wheatDendro/04-payroll_employee.sql @@ -2,10 +2,10 @@ ALTER TABLE IF EXISTS `vn2008`.`payroll_employee` RENAME `vn`.`payrollWorker`; ALTER TABLE IF EXISTS `vn`.`payrollWorker` -CHANGE COLUMN IF EXISTS `CodTrabajador` `workerCodeFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `CodTrabajador` `workerFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',, CHANGE COLUMN IF EXISTS `nss` `nss__` varchar(23) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', CHANGE COLUMN IF EXISTS `codpuesto` `codpuesto__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', -CHANGE COLUMN IF EXISTS `codempresa` `companyCodeFk` int(10) NOT NULL, +CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(10) NOT NULL COMMENT 'Columna que hace referencia a A3.', CHANGE COLUMN IF EXISTS `codcontrato` `codcontrato__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', CHANGE COLUMN IF EXISTS `FAntiguedad` `FAntiguedad__` date NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', CHANGE COLUMN IF EXISTS `grupotarifa` `grupotarifa__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', diff --git a/db/versions/10930-wheatDendro/06-payroll_conceptos.sql b/db/versions/10930-wheatDendro/06-payroll_conceptos.sql index 45ab7a374..1803dc2a3 100644 --- a/db/versions/10930-wheatDendro/06-payroll_conceptos.sql +++ b/db/versions/10930-wheatDendro/06-payroll_conceptos.sql @@ -3,4 +3,4 @@ ALTER TABLE IF EXISTS `vn2008`.`payroll_conceptos` RENAME `vn`.`payrollComponent ALTER TABLE IF EXISTS `vn`.`payrollComponent` CHANGE COLUMN IF EXISTS `conceptoid` `id` int(11) NOT NULL, -CHANGE COLUMN IF EXISTS `concepto` `concept` varchar(255) DEFAULT NULL; \ No newline at end of file +CHANGE COLUMN IF EXISTS `concepto` `name` varchar(255) DEFAULT NULL; \ No newline at end of file From 6163cad8a5184e731c11a8e17dfa831aaaea2ec0 Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 13 Mar 2024 14:17:10 +0100 Subject: [PATCH 12/62] refs #6738 --- db/routines/vn2008/views/payrollWorker.sql | 4 ++-- db/routines/vn2008/views/payroll_conceptos.sql | 2 +- db/versions/10930-wheatDendro/04-payroll_employee.sql | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/db/routines/vn2008/views/payrollWorker.sql b/db/routines/vn2008/views/payrollWorker.sql index 83ba02ecf..d4ada9aa0 100644 --- a/db/routines/vn2008/views/payrollWorker.sql +++ b/db/routines/vn2008/views/payrollWorker.sql @@ -1,6 +1,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`payroll_employee` -AS SELECT `pw`.`workerCodeFk` AS `CodTrabajador`, - `pw`.`companyCodeFk` AS `codempresa` +AS SELECT `pw`.`workerFkA3` AS `CodTrabajador`, + `pw`.`companyFkA3` AS `codempresa` FROM `vn`.`payrollWorker` `pw` diff --git a/db/routines/vn2008/views/payroll_conceptos.sql b/db/routines/vn2008/views/payroll_conceptos.sql index 54be27d0b..a7c6ece5b 100644 --- a/db/routines/vn2008/views/payroll_conceptos.sql +++ b/db/routines/vn2008/views/payroll_conceptos.sql @@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`payroll_conceptos` AS SELECT `pc`.`id` AS `conceptoid`, - `pc`.`concept` AS `concepto`, + `pc`.`name` AS `concepto`, `pc`.`isSalaryAgreed` AS `isSalaryAgreed`, `pc`.`isVariable` AS `isVariable`, `pc`.`isException` AS `isException` diff --git a/db/versions/10930-wheatDendro/04-payroll_employee.sql b/db/versions/10930-wheatDendro/04-payroll_employee.sql index 538c636f4..c346fbf8d 100644 --- a/db/versions/10930-wheatDendro/04-payroll_employee.sql +++ b/db/versions/10930-wheatDendro/04-payroll_employee.sql @@ -2,7 +2,7 @@ ALTER TABLE IF EXISTS `vn2008`.`payroll_employee` RENAME `vn`.`payrollWorker`; ALTER TABLE IF EXISTS `vn`.`payrollWorker` -CHANGE COLUMN IF EXISTS `CodTrabajador` `workerFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.',, +CHANGE COLUMN IF EXISTS `CodTrabajador` `workerFkA3` int(11) NOT NULL COMMENT 'Columna que hace referencia a A3.', CHANGE COLUMN IF EXISTS `nss` `nss__` varchar(23) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', CHANGE COLUMN IF EXISTS `codpuesto` `codpuesto__` int(10) NOT NULL COMMENT '@Deprecated refs #6738 15/03/2024', CHANGE COLUMN IF EXISTS `codempresa` `companyFkA3` int(10) NOT NULL COMMENT 'Columna que hace referencia a A3.', From 027aa8666220c0be94305bbda9f0352703be96be Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 22 Mar 2024 10:08:20 +0100 Subject: [PATCH 13/62] refs #6964 feat:advice for olderItem --- .../methods/item-shelving/hasItemOlder.js | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index 48b3b357a..4d82956d4 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -1,9 +1,10 @@ module.exports = Self => { Self.remoteMethod('hasItemOlder', { - description: 'Get boolean if any item of the shelving has older created in another shelving ', + description: + 'Get boolean if any or specific item of the shelving has older created in another shelving or parking', accessType: 'WRITE', accepts: [{ - arg: 'shelvingFk', + arg: 'shelvingFkIn', type: 'string', required: true, description: 'Shelving code' @@ -11,8 +12,17 @@ module.exports = Self => { { arg: 'parking', type: 'string', - required: true, description: 'Parking code' + }, + { + arg: 'shelvingFkOut', + type: 'string', + description: 'Shelving code' + }, + { + arg: 'itemFk', + type: 'int', + description: 'Item id' }], returns: { type: 'boolean', @@ -24,21 +34,24 @@ module.exports = Self => { } }); - Self.hasItemOlder = async(shelvingFk, parking, options) => { + Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => { const result = await Self.rawSql(` SELECT COUNT(ish.id) - FROM vn.itemShelving ish - JOIN ( - SELECT ish.itemFk, created,shelvingFk, p.code - FROM vn.itemShelving ish - JOIN vn.shelving s ON ish.shelvingFk = s.code - JOIN vn.parking p ON p.id = s.parkingFk + FROM vn.itemShelving ish + JOIN ( + SELECT ish.itemFk, created,shelvingFk, p.code + FROM vn.itemShelving ish + JOIN vn.shelving s ON ish.shelvingFk = s.code + LEFT JOIN vn.parking p ON p.id = s.parkingFk WHERE ish.shelvingFk = ? - )sub ON sub.itemFK = ish.itemFk - JOIN vn.shelving s ON s.code = ish.shelvingFk - JOIN vn.parking p ON p.id = s.parkingFk - WHERE ish.shelvingFk <> ? AND sub.created > ish.created AND p.code <> ?`, - [shelvingFk, shelvingFk, parking]); + )sub ON sub.itemFK = ish.itemFk + JOIN vn.shelving s ON s.code = ish.shelvingFk + JOIN vn.parking p ON p.id = s.parkingFk + WHERE sub.created > ish.created + AND (p.code <> ? OR ? IS NULL) + AND (ish.shelvingFk <> ? OR ? IS NULL) + AND (ish.itemFk <> ? OR ? IS NULL)`, + [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk]); return result[0]['COUNT(ish.id)'] > 0; }; }; From 976c5b7ba8f8bbda1b651a4db4345b6fa51176ac Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 22 Mar 2024 11:42:19 +0100 Subject: [PATCH 14/62] refs #6964 feat:advice for olderItem --- .../item-shelving/specs/hasItemOlder.spec.js | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js diff --git a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js new file mode 100644 index 000000000..b6e501d85 --- /dev/null +++ b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js @@ -0,0 +1,45 @@ + +const {models} = require('vn-loopback/server/server'); + +fdescribe('itemShelving hasOlder()', () => { + it('should return false because there are not older items', async() => { + const shelvingFkIn = 'GVC'; + const shelvingFkOut = 'HEJ'; + const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, shelvingFkOut); + + expect(result).toBe(false); + }); + + it('should return false because there are not older items in parking', async() => { + const shelvingFkIn = 'HEJ'; + const parking = '700-01'; + const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking); + + expect(result).toBe(false); + }); + + it('should return true because there is an older item', async() => { + const shelvingFkIn = 'UXN'; + const shelvingFkOut = 'PCC'; + const parking = 'A-01-1'; + const itemFk = 1; + + const tx = await models.ItemShelving.beginTransaction({}); + const myOptions = {transaction: tx}; + const filter = {where: {shelvingFk: shelvingFkOut} + }; + try { + const itemShelvingBefore = await models.ItemShelving.findOne(filter, myOptions); + await itemShelvingBefore.updateAttributes({ + itemFk: itemFk + }); + const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking); + + expect(result).toBe(true); + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); From 61b649fdc52bd7044b9299fd52cd989fd4e4d9ae Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 22 Mar 2024 11:47:12 +0100 Subject: [PATCH 15/62] refs #6964 feat:advice for olderItem --- db/versions/10967-wheatLilium/00-firstScript.sql | 4 ++++ modules/item/back/methods/item-shelving/hasItemOlder.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 db/versions/10967-wheatLilium/00-firstScript.sql diff --git a/db/versions/10967-wheatLilium/00-firstScript.sql b/db/versions/10967-wheatLilium/00-firstScript.sql new file mode 100644 index 000000000..40cfe45bd --- /dev/null +++ b/db/versions/10967-wheatLilium/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Place your SQL code here + +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES('ItemShelving', 'hasItemOlder', 'READ', 'ALLOW', 'ROLE', 'production'); diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index 4d82956d4..fc4eb8d4f 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -2,7 +2,7 @@ module.exports = Self => { Self.remoteMethod('hasItemOlder', { description: 'Get boolean if any or specific item of the shelving has older created in another shelving or parking', - accessType: 'WRITE', + accessType: 'READ', accepts: [{ arg: 'shelvingFkIn', type: 'string', From c4fcb2cd120273147beaf9b074f491439707670c Mon Sep 17 00:00:00 2001 From: sergiodt Date: Fri, 22 Mar 2024 13:04:16 +0100 Subject: [PATCH 16/62] refs #6964 feat:advice for olderItem --- .../item/back/methods/item-shelving/specs/hasItemOlder.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js index b6e501d85..5f217f9bf 100644 --- a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js +++ b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js @@ -1,7 +1,7 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('itemShelving hasOlder()', () => { +describe('itemShelving hasOlder()', () => { it('should return false because there are not older items', async() => { const shelvingFkIn = 'GVC'; const shelvingFkOut = 'HEJ'; From f6ba5224e608ef83c66421c15cbf51a69c2559e3 Mon Sep 17 00:00:00 2001 From: jcasado Date: Fri, 22 Mar 2024 15:00:30 +0100 Subject: [PATCH 17/62] refs #7123 first edit pdf --- .../templates/reports/credit-request/assets/css/style.css | 6 +++++- .../templates/reports/credit-request/credit-request.html | 8 ++++++++ print/templates/reports/credit-request/locale/es.yml | 5 +++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/print/templates/reports/credit-request/assets/css/style.css b/print/templates/reports/credit-request/assets/css/style.css index 90bbfd103..a46a33484 100644 --- a/print/templates/reports/credit-request/assets/css/style.css +++ b/print/templates/reports/credit-request/assets/css/style.css @@ -49,4 +49,8 @@ td { .field { float: none -} \ No newline at end of file +} + +.wide-rectangle { + background-color: rgb(64 64 68); +} diff --git a/print/templates/reports/credit-request/credit-request.html b/print/templates/reports/credit-request/credit-request.html index c8e3f8c34..6b167e95b 100644 --- a/print/templates/reports/credit-request/credit-request.html +++ b/print/templates/reports/credit-request/credit-request.html @@ -14,6 +14,14 @@ + + {{$t('fields.importCredit')}}: + +
+ +
+ +
diff --git a/print/templates/reports/credit-request/locale/es.yml b/print/templates/reports/credit-request/locale/es.yml index cd6f92dc5..bc0e09528 100644 --- a/print/templates/reports/credit-request/locale/es.yml +++ b/print/templates/reports/credit-request/locale/es.yml @@ -3,10 +3,11 @@ fields: title: Solicitud de crédito date: Fecha companyName: Nombre de la empresa + importCredit: Importe del crédito solicitado businessType: Tipo de negocio antiquity: Antigüedad surface: Superficie (m²) - numberOfEmployees: Número de empleados + numberOfEmployees: Nº empleados owner: Contacto propietario o Administrador phone: Teléfono payer: Contacto responsable de pagos @@ -15,4 +16,4 @@ fields: forecastedPurchases: Previsión de compras a Verdnatura personFilling: Persona que rellena el formulario companyInfo: Información general sobre la empresa - economicInfo: Información económica \ No newline at end of file + economicInfo: Información económica From 22f78dbb916179040abe755d962ab90874246d39 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 25 Mar 2024 07:54:51 +0100 Subject: [PATCH 18/62] refs #6964 feat:hasItemOlder --- .../methods/item-shelving/hasItemOlder.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index fc4eb8d4f..e7609a4db 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -1,3 +1,4 @@ +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethod('hasItemOlder', { description: @@ -35,23 +36,24 @@ module.exports = Self => { }); Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => { + if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving'); const result = await Self.rawSql(` - SELECT COUNT(ish.id) - FROM vn.itemShelving ish - JOIN ( - SELECT ish.itemFk, created,shelvingFk, p.code - FROM vn.itemShelving ish - JOIN vn.shelving s ON ish.shelvingFk = s.code - LEFT JOIN vn.parking p ON p.id = s.parkingFk - WHERE ish.shelvingFk = ? + SELECT COUNT(ish.id) countItemOlder + FROM vn.itemShelving ish + JOIN ( + SELECT ish.itemFk, created,shelvingFk, p.code + FROM vn.itemShelving ish + JOIN vn.shelving s ON ish.shelvingFk = s.code + LEFT JOIN vn.parking p ON p.id = s.parkingFk + WHERE ish.shelvingFk = ? )sub ON sub.itemFK = ish.itemFk - JOIN vn.shelving s ON s.code = ish.shelvingFk - JOIN vn.parking p ON p.id = s.parkingFk - WHERE sub.created > ish.created + JOIN vn.shelving s ON s.code = ish.shelvingFk + JOIN vn.parking p ON p.id = s.parkingFk + WHERE sub.created > ish.created AND (p.code <> ? OR ? IS NULL) AND (ish.shelvingFk <> ? OR ? IS NULL) AND (ish.itemFk <> ? OR ? IS NULL)`, [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk]); - return result[0]['COUNT(ish.id)'] > 0; + return result[0]['countItemOlder'] > 0; }; }; From a40234ba9b06044de1e78cb3a63e5e1ce5ba8ab4 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 25 Mar 2024 08:20:08 +0100 Subject: [PATCH 19/62] refs #6964 feat:hasItemOlder --- modules/item/back/methods/item-shelving/hasItemOlder.js | 2 +- .../back/methods/item-shelving/specs/hasItemOlder.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index e7609a4db..b3fb6fa60 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -53,7 +53,7 @@ module.exports = Self => { AND (p.code <> ? OR ? IS NULL) AND (ish.shelvingFk <> ? OR ? IS NULL) AND (ish.itemFk <> ? OR ? IS NULL)`, - [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk]); + [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], options); return result[0]['countItemOlder'] > 0; }; }; diff --git a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js index 5f217f9bf..d44998fab 100644 --- a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js +++ b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js @@ -5,7 +5,7 @@ describe('itemShelving hasOlder()', () => { it('should return false because there are not older items', async() => { const shelvingFkIn = 'GVC'; const shelvingFkOut = 'HEJ'; - const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, shelvingFkOut); + const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, null, shelvingFkOut); expect(result).toBe(false); }); @@ -33,7 +33,7 @@ describe('itemShelving hasOlder()', () => { await itemShelvingBefore.updateAttributes({ itemFk: itemFk }); - const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking); + const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking, null, null, myOptions); expect(result).toBe(true); await tx.rollback(); From 8b684442f5c51b060aabee611abda974aeaee150 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Mon, 25 Mar 2024 16:07:20 +0100 Subject: [PATCH 20/62] refs #6276 hotFix: setUserError and return --- loopback/locale/es.json | 703 ++++++++++++++++++++-------------------- 1 file changed, 352 insertions(+), 351 deletions(-) diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 7730d4a8c..5eb60ce91 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -1,352 +1,353 @@ { - "Phone format is invalid": "El formato del teléfono no es correcto", - "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", - "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", - "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", - "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", - "Can't be blank": "No puede estar en blanco", - "Invalid TIN": "NIF/CIF inválido", - "TIN must be unique": "El NIF/CIF debe ser único", - "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web", - "Is invalid": "Es inválido", - "Quantity cannot be zero": "La cantidad no puede ser cero", - "Enter an integer different to zero": "Introduce un entero distinto de cero", - "Package cannot be blank": "El embalaje no puede estar en blanco", - "The company name must be unique": "La razón social debe ser única", - "Invalid email": "Correo electrónico inválido", - "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", - "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN", - "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC", - "State cannot be blank": "El estado no puede estar en blanco", - "Worker cannot be blank": "El trabajador no puede estar en blanco", - "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", - "can't be blank": "El campo no puede estar vacío", - "Observation type must be unique": "El tipo de observación no puede repetirse", - "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", - "The grade must be similar to the last one": "El grade debe ser similar al último", - "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", - "Name cannot be blank": "El nombre no puede estar en blanco", - "Phone cannot be blank": "El teléfono no puede estar en blanco", - "Period cannot be blank": "El periodo no puede estar en blanco", - "Choose a company": "Selecciona una empresa", - "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto", - "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres", - "Cannot be blank": "El campo no puede estar en blanco", - "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero", - "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco", - "Description cannot be blank": "Se debe rellenar el campo de texto", - "The price of the item changed": "El precio del artículo cambió", - "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%", - "The value should be a number": "El valor debe ser un numero", - "This order is not editable": "Esta orden no se puede modificar", - "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", - "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", - "is not a valid date": "No es una fecha valida", - "Barcode must be unique": "El código de barras debe ser único", - "The warehouse can't be repeated": "El almacén no puede repetirse", - "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", - "The observation type can't be repeated": "El tipo de observación no puede repetirse", - "A claim with that sale already exists": "Ya existe una reclamación para esta línea", - "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", - "Warehouse cannot be blank": "El almacén no puede quedar en blanco", - "Agency cannot be blank": "La agencia no puede quedar en blanco", - "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", - "This address doesn't exist": "Este consignatario no existe", - "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", - "You don't have enough privileges": "No tienes suficientes permisos", - "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF", - "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos", - "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ", - "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", - "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo", - "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", - "ORDER_EMPTY": "Cesta vacía", - "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", - "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", - "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", - "Street cannot be empty": "Dirección no puede estar en blanco", - "City cannot be empty": "Ciudad no puede estar en blanco", - "Code cannot be blank": "Código no puede estar en blanco", - "You cannot remove this department": "No puedes eliminar este departamento", - "The extension must be unique": "La extensión debe ser unica", - "The secret can't be blank": "La contraseña no puede estar en blanco", - "We weren't able to send this SMS": "No hemos podido enviar el SMS", - "This client can't be invoiced": "Este cliente no puede ser facturado", - "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", - "This ticket can't be invoiced": "Este ticket no puede ser facturado", - "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", - "This ticket can not be modified": "Este ticket no puede ser modificado", - "The introduced hour already exists": "Esta hora ya ha sido introducida", - "INFINITE_LOOP": "Existe una dependencia entre dos Jefes", - "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas", - "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros", - "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado", - "The current ticket can't be modified": "El ticket actual no puede ser modificado", - "The current claim can't be modified": "La reclamación actual no puede ser modificada", - "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", - "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", - "Please select at least one sale": "Por favor selecciona al menos una linea", - "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", - "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", - "This item doesn't exists": "El artículo no existe", - "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", - "Extension format is invalid": "El formato de la extensión es inválido", - "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket", - "This item is not available": "Este artículo no está disponible", - "This postcode already exists": "Este código postal ya existe", - "Concept cannot be blank": "El concepto no puede quedar en blanco", - "File doesn't exists": "El archivo no existe", - "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", - "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", - "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", - "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", - "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", - "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", - "Invalid quantity": "Cantidad invalida", - "This postal code is not valid": "Este código postal no es válido", - "is invalid": "es inválido", - "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", - "The department name can't be repeated": "El nombre del departamento no puede repetirse", - "This phone already exists": "Este teléfono ya existe", - "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", - "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", - "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada", - "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero", - "You should specify a date": "Debes especificar una fecha", - "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin", - "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin", - "You should mark at least one week day": "Debes marcar al menos un día de la semana", - "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", - "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", - "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", - "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", - "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", - "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})", - "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})", - "State": "Estado", - "regular": "normal", - "reserved": "reservado", - "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})", - "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}", - "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", - "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", - "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", - "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", - "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", - "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*", - "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", - "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", - "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000", - "This ticket is deleted": "Este ticket está eliminado", - "Unable to clone this travel": "No ha sido posible clonar este travel", - "This thermograph id already exists": "La id del termógrafo ya existe", - "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", - "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA", - "Invalid password": "Invalid password", - "Password does not meet requirements": "La contraseña no cumple los requisitos", - "Role already assigned": "Rol ya asignado", - "Invalid role name": "Nombre de rol no válido", - "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase", - "Email already exists": "El correo ya existe", - "User already exists": "El/La usuario/a ya existe", - "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral", - "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", - "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", - "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", - "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", - "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})", - "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación", - "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", - "agencyModeFk": "Agencia", - "clientFk": "Cliente", - "zoneFk": "Zona", - "warehouseFk": "Almacén", - "shipped": "F. envío", - "landed": "F. entrega", - "addressFk": "Consignatario", - "companyFk": "Empresa", - "The social name cannot be empty": "La razón social no puede quedar en blanco", - "The nif cannot be empty": "El NIF no puede quedar en blanco", - "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", - "ASSIGN_ZONE_FIRST": "Asigna una zona primero", - "Amount cannot be zero": "El importe no puede ser cero", - "Company has to be official": "Empresa inválida", - "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", - "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", - "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", - "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", - "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", - "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", - "This BIC already exist.": "Este BIC ya existe.", - "That item doesn't exists": "Ese artículo no existe", - "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", - "Invalid account": "Cuenta inválida", - "Compensation account is empty": "La cuenta para compensar está vacia", - "This genus already exist": "Este genus ya existe", - "This specie already exist": "Esta especie ya existe", - "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})", - "None": "Ninguno", - "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", - "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'", - "This document already exists on this ticket": "Este documento ya existe en el ticket", - "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", - "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", - "nickname": "nickname", - "INACTIVE_PROVIDER": "Proveedor inactivo", - "This client is not invoiceable": "Este cliente no es facturable", - "serial non editable": "Esta serie no permite asignar la referencia", - "Max shipped required": "La fecha límite es requerida", - "Can't invoice to future": "No se puede facturar a futuro", - "Can't invoice to past": "No se puede facturar a pasado", - "This ticket is already invoiced": "Este ticket ya está facturado", - "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", - "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", - "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", - "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", - "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", - "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", - "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", - "Amounts do not match": "Las cantidades no coinciden", - "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", - "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", - "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días", - "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día", - "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día", - "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", - "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres", - "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", - "You don't have privileges to create refund": "No tienes permisos para crear un abono", - "The item is required": "El artículo es requerido", - "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", - "date in the future": "Fecha en el futuro", - "reference duplicated": "Referencia duplicada", - "This ticket is already a refund": "Este ticket ya es un abono", - "isWithoutNegatives": "Sin negativos", - "routeFk": "routeFk", - "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", - "No hay un contrato en vigor": "No hay un contrato en vigor", - "No se permite fichar a futuro": "No se permite fichar a futuro", - "No está permitido trabajar": "No está permitido trabajar", - "Fichadas impares": "Fichadas impares", - "Descanso diario 12h.": "Descanso diario 12h.", - "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", - "Dirección incorrecta": "Dirección incorrecta", - "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", - "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", - "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", - "This route does not exists": "Esta ruta no existe", - "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", - "You don't have grant privilege": "No tienes privilegios para dar privilegios", - "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", - "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", - "Already has this status": "Ya tiene este estado", - "There aren't records for this week": "No existen registros para esta semana", - "Empty data source": "Origen de datos vacio", - "App locked": "Aplicación bloqueada por el usuario {{userId}}", - "Email verify": "Correo de verificación", - "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", - "Receipt's bank was not found": "No se encontró el banco del recibo", - "This receipt was not compensated": "Este recibo no ha sido compensado", - "Client's email was not found": "No se encontró el email del cliente", - "Negative basis": "Base negativa", - "This worker code already exists": "Este codigo de trabajador ya existe", - "This personal mail already exists": "Este correo personal ya existe", - "This worker already exists": "Este trabajador ya existe", - "App name does not exist": "El nombre de aplicación no es válido", - "Try again": "Vuelve a intentarlo", - "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", - "Failed to upload delivery note": "Error al subir albarán {{id}}", - "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", - "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", - "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", - "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", - "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", - "There is no assigned email for this client": "No hay correo asignado para este cliente", - "Exists an invoice with a future date": "Existe una factura con fecha posterior", - "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", - "Warehouse inventory not set": "El almacén inventario no está establecido", - "This locker has already been assigned": "Esta taquilla ya ha sido asignada", - "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d", - "Not exist this branch": "La rama no existe", - "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", - "Collection does not exist": "La colección no existe", - "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", - "Insert a date range": "Inserte un rango de fechas", - "Added observation": "{{user}} añadió esta observacion: {{text}}", - "Comment added to client": "Observación añadida al cliente {{clientFk}}", - "Invalid auth code": "Código de verificación incorrecto", - "Invalid or expired verification code": "Código de verificación incorrecto o expirado", - "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", - "company": "Compañía", - "country": "País", - "clientId": "Id cliente", - "clientSocialName": "Cliente", - "amount": "Importe", - "taxableBase": "Base", - "ticketFk": "Id ticket", - "isActive": "Activo", - "hasToInvoice": "Facturar", - "isTaxDataChecked": "Datos comprobados", - "comercialId": "Id comercial", - "comercialName": "Comercial", - "Pass expired": "La contraseña ha caducado, cambiela desde Salix", - "Invalid NIF for VIES": "Invalid NIF for VIES", - "Ticket does not exist": "Este ticket no existe", - "Ticket is already signed": "Este ticket ya ha sido firmado", - "Authentication failed": "Autenticación fallida", - "You can't use the same password": "No puedes usar la misma contraseña", - "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono", - "Fecha fuera de rango": "Fecha fuera de rango", - "Error while generating PDF": "Error al generar PDF", - "Error when sending mail to client": "Error al enviar el correo al cliente", - "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", - "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", - "Valid priorities": "Prioridades válidas: %d", - "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}", - "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}", - "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", - "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s", - "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", - "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", - "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", - "You don't have enough privileges.": "No tienes suficientes permisos.", - "This ticket is locked": "Este ticket está bloqueado.", - "This ticket is not editable.": "Este ticket no es editable.", - "The ticket doesn't exist.": "No existe el ticket.", - "Social name should be uppercase": "La razón social debe ir en mayúscula", - "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", - "Ticket without Route": "Ticket sin ruta", - "Select a different client": "Seleccione un cliente distinto", - "Fill all the fields": "Rellene todos los campos", - "The response is not a PDF": "La respuesta no es un PDF", - "Booking completed": "Reserva completada", - "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", - "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", - "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", - "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", - "They're not your subordinate": "No es tu subordinado/a." -} + "Phone format is invalid": "El formato del teléfono no es correcto", + "You are not allowed to change the credit": "No tienes privilegios para modificar el crédito", + "Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia", + "The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado", + "Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado", + "Can't be blank": "No puede estar en blanco", + "Invalid TIN": "NIF/CIF inválido", + "TIN must be unique": "El NIF/CIF debe ser único", + "A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web", + "Is invalid": "Es inválido", + "Quantity cannot be zero": "La cantidad no puede ser cero", + "Enter an integer different to zero": "Introduce un entero distinto de cero", + "Package cannot be blank": "El embalaje no puede estar en blanco", + "The company name must be unique": "La razón social debe ser única", + "Invalid email": "Correo electrónico inválido", + "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", + "That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN", + "That payment method requires a BIC": "El método de pago seleccionado requiere un BIC", + "State cannot be blank": "El estado no puede estar en blanco", + "Worker cannot be blank": "El trabajador no puede estar en blanco", + "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", + "can't be blank": "El campo no puede estar vacío", + "Observation type must be unique": "El tipo de observación no puede repetirse", + "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", + "The grade must be similar to the last one": "El grade debe ser similar al último", + "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", + "Name cannot be blank": "El nombre no puede estar en blanco", + "Phone cannot be blank": "El teléfono no puede estar en blanco", + "Period cannot be blank": "El periodo no puede estar en blanco", + "Choose a company": "Selecciona una empresa", + "Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto", + "Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres", + "Cannot be blank": "El campo no puede estar en blanco", + "The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero", + "Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco", + "Description cannot be blank": "Se debe rellenar el campo de texto", + "The price of the item changed": "El precio del artículo cambió", + "The value should not be greater than 100%": "El valor no debe de ser mayor de 100%", + "The value should be a number": "El valor debe ser un numero", + "This order is not editable": "Esta orden no se puede modificar", + "You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado", + "You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda", + "is not a valid date": "No es una fecha valida", + "Barcode must be unique": "El código de barras debe ser único", + "The warehouse can't be repeated": "El almacén no puede repetirse", + "The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item", + "The observation type can't be repeated": "El tipo de observación no puede repetirse", + "A claim with that sale already exists": "Ya existe una reclamación para esta línea", + "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", + "Warehouse cannot be blank": "El almacén no puede quedar en blanco", + "Agency cannot be blank": "La agencia no puede quedar en blanco", + "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", + "This address doesn't exist": "Este consignatario no existe", + "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", + "You don't have enough privileges": "No tienes suficientes permisos", + "Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF", + "You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos", + "INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ", + "You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado", + "You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo", + "Tag value cannot be blank": "El valor del tag no puede quedar en blanco", + "ORDER_EMPTY": "Cesta vacía", + "You don't have enough privileges to do that": "No tienes permisos para cambiar esto", + "NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT", + "Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido", + "Street cannot be empty": "Dirección no puede estar en blanco", + "City cannot be empty": "Ciudad no puede estar en blanco", + "Code cannot be blank": "Código no puede estar en blanco", + "You cannot remove this department": "No puedes eliminar este departamento", + "The extension must be unique": "La extensión debe ser unica", + "The secret can't be blank": "La contraseña no puede estar en blanco", + "We weren't able to send this SMS": "No hemos podido enviar el SMS", + "This client can't be invoiced": "Este cliente no puede ser facturado", + "You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa", + "This ticket can't be invoiced": "Este ticket no puede ser facturado", + "You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado", + "This ticket can not be modified": "Este ticket no puede ser modificado", + "The introduced hour already exists": "Esta hora ya ha sido introducida", + "INFINITE_LOOP": "Existe una dependencia entre dos Jefes", + "The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas", + "NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros", + "ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado", + "The current ticket can't be modified": "El ticket actual no puede ser modificado", + "The current claim can't be modified": "La reclamación actual no puede ser modificada", + "The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas", + "The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)", + "Please select at least one sale": "Por favor selecciona al menos una linea", + "All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket", + "NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "This item doesn't exists": "El artículo no existe", + "NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada", + "Extension format is invalid": "El formato de la extensión es inválido", + "Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket", + "This item is not available": "Este artículo no está disponible", + "This postcode already exists": "Este código postal ya existe", + "Concept cannot be blank": "El concepto no puede quedar en blanco", + "File doesn't exists": "El archivo no existe", + "You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias", + "This ticket is already on weekly tickets": "Este ticket ya está en tickets programados", + "Ticket id cannot be blank": "El id de ticket no puede quedar en blanco", + "Weekday cannot be blank": "El día de la semana no puede quedar en blanco", + "You can't delete a confirmed order": "No puedes borrar un pedido confirmado", + "The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto", + "Invalid quantity": "Cantidad invalida", + "This postal code is not valid": "Este código postal no es válido", + "is invalid": "es inválido", + "The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto", + "The department name can't be repeated": "El nombre del departamento no puede repetirse", + "This phone already exists": "Este teléfono ya existe", + "You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos", + "You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado", + "You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada", + "You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero", + "You should specify a date": "Debes especificar una fecha", + "You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin", + "Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin", + "You should mark at least one week day": "Debes marcar al menos un día de la semana", + "Swift / BIC can't be empty": "Swift / BIC no puede estar vacío", + "Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios", + "Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios", + "Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}", + "Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}", + "Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})", + "Changed sale quantity": "He cambiado la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* del ticket [{{ticketId}}]({{{ticketUrl}}})", + "State": "Estado", + "regular": "normal", + "reserved": "reservado", + "Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})", + "Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}", + "MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*", + "Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})", + "Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})", + "Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}", + "Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*", + "Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*", + "Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}", + "ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto", + "Distance must be lesser than 4000": "La distancia debe ser inferior a 4000", + "This ticket is deleted": "Este ticket está eliminado", + "Unable to clone this travel": "No ha sido posible clonar este travel", + "This thermograph id already exists": "La id del termógrafo ya existe", + "Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante", + "ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA", + "Invalid password": "Invalid password", + "Password does not meet requirements": "La contraseña no cumple los requisitos", + "Role already assigned": "Rol ya asignado", + "Invalid role name": "Nombre de rol no válido", + "Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase", + "Email already exists": "El correo ya existe", + "User already exists": "El/La usuario/a ya existe", + "Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral", + "Record of hours week": "Registro de horas semana {{week}} año {{year}} ", + "Created absence": "El empleado {{author}} ha añadido una ausencia de tipo '{{absenceType}}' a {{employee}} para el día {{dated}}.", + "Deleted absence": "El empleado {{author}} ha eliminado una ausencia de tipo '{{absenceType}}' a {{employee}} del día {{dated}}.", + "I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})", + "I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})", + "You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación", + "Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}", + "agencyModeFk": "Agencia", + "clientFk": "Cliente", + "zoneFk": "Zona", + "warehouseFk": "Almacén", + "shipped": "F. envío", + "landed": "F. entrega", + "addressFk": "Consignatario", + "companyFk": "Empresa", + "The social name cannot be empty": "La razón social no puede quedar en blanco", + "The nif cannot be empty": "El NIF no puede quedar en blanco", + "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados", + "ASSIGN_ZONE_FIRST": "Asigna una zona primero", + "Amount cannot be zero": "El importe no puede ser cero", + "Company has to be official": "Empresa inválida", + "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", + "Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas", + "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", + "New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*", + "New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*", + "Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío", + "This BIC already exist.": "Este BIC ya existe.", + "That item doesn't exists": "Ese artículo no existe", + "There's a new urgent ticket:": "Hay un nuevo ticket urgente:", + "Invalid account": "Cuenta inválida", + "Compensation account is empty": "La cuenta para compensar está vacia", + "This genus already exist": "Este genus ya existe", + "This specie already exist": "Esta especie ya existe", + "Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})", + "None": "Ninguno", + "The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada", + "Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'", + "This document already exists on this ticket": "Este documento ya existe en el ticket", + "Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables", + "You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes", + "nickname": "nickname", + "INACTIVE_PROVIDER": "Proveedor inactivo", + "This client is not invoiceable": "Este cliente no es facturable", + "serial non editable": "Esta serie no permite asignar la referencia", + "Max shipped required": "La fecha límite es requerida", + "Can't invoice to future": "No se puede facturar a futuro", + "Can't invoice to past": "No se puede facturar a pasado", + "This ticket is already invoiced": "Este ticket ya está facturado", + "A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero", + "A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa", + "Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes", + "Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes", + "Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio", + "You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito", + "You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas", + "Amounts do not match": "Las cantidades no coinciden", + "The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'", + "The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos", + "You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días", + "The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día", + "The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día", + "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", + "The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres", + "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", + "You don't have privileges to create refund": "No tienes permisos para crear un abono", + "The item is required": "El artículo es requerido", + "The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo", + "date in the future": "Fecha en el futuro", + "reference duplicated": "Referencia duplicada", + "This ticket is already a refund": "Este ticket ya es un abono", + "isWithoutNegatives": "Sin negativos", + "routeFk": "routeFk", + "Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador", + "No hay un contrato en vigor": "No hay un contrato en vigor", + "No se permite fichar a futuro": "No se permite fichar a futuro", + "No está permitido trabajar": "No está permitido trabajar", + "Fichadas impares": "Fichadas impares", + "Descanso diario 12h.": "Descanso diario 12h.", + "Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.", + "Dirección incorrecta": "Dirección incorrecta", + "Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador", + "Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador", + "Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente", + "This route does not exists": "Esta ruta no existe", + "Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*", + "You don't have grant privilege": "No tienes privilegios para dar privilegios", + "You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario", + "Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})", + "Already has this status": "Ya tiene este estado", + "There aren't records for this week": "No existen registros para esta semana", + "Empty data source": "Origen de datos vacio", + "App locked": "Aplicación bloqueada por el usuario {{userId}}", + "Email verify": "Correo de verificación", + "Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment", + "Receipt's bank was not found": "No se encontró el banco del recibo", + "This receipt was not compensated": "Este recibo no ha sido compensado", + "Client's email was not found": "No se encontró el email del cliente", + "Negative basis": "Base negativa", + "This worker code already exists": "Este codigo de trabajador ya existe", + "This personal mail already exists": "Este correo personal ya existe", + "This worker already exists": "Este trabajador ya existe", + "App name does not exist": "El nombre de aplicación no es válido", + "Try again": "Vuelve a intentarlo", + "Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9", + "Failed to upload delivery note": "Error al subir albarán {{id}}", + "The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe", + "It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar", + "It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo", + "It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas", + "A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.", + "There is no assigned email for this client": "No hay correo asignado para este cliente", + "Exists an invoice with a future date": "Existe una factura con fecha posterior", + "Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite", + "Warehouse inventory not set": "El almacén inventario no está establecido", + "This locker has already been assigned": "Esta taquilla ya ha sido asignada", + "Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %d", + "Not exist this branch": "La rama no existe", + "This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado", + "Collection does not exist": "La colección no existe", + "Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo", + "Insert a date range": "Inserte un rango de fechas", + "Added observation": "{{user}} añadió esta observacion: {{text}}", + "Comment added to client": "Observación añadida al cliente {{clientFk}}", + "Invalid auth code": "Código de verificación incorrecto", + "Invalid or expired verification code": "Código de verificación incorrecto o expirado", + "Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen", + "company": "Compañía", + "country": "País", + "clientId": "Id cliente", + "clientSocialName": "Cliente", + "amount": "Importe", + "taxableBase": "Base", + "ticketFk": "Id ticket", + "isActive": "Activo", + "hasToInvoice": "Facturar", + "isTaxDataChecked": "Datos comprobados", + "comercialId": "Id comercial", + "comercialName": "Comercial", + "Pass expired": "La contraseña ha caducado, cambiela desde Salix", + "Invalid NIF for VIES": "Invalid NIF for VIES", + "Ticket does not exist": "Este ticket no existe", + "Ticket is already signed": "Este ticket ya ha sido firmado", + "Authentication failed": "Autenticación fallida", + "You can't use the same password": "No puedes usar la misma contraseña", + "You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono", + "Fecha fuera de rango": "Fecha fuera de rango", + "Error while generating PDF": "Error al generar PDF", + "Error when sending mail to client": "Error al enviar el correo al cliente", + "Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico", + "The renew period has not been exceeded": "El periodo de renovación no ha sido superado", + "Valid priorities": "Prioridades válidas: %d", + "hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}", + "hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}", + "You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado", + "This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s", + "The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias", + "You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado", + "This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado", + "You don't have enough privileges.": "No tienes suficientes permisos.", + "This ticket is locked": "Este ticket está bloqueado.", + "This ticket is not editable.": "Este ticket no es editable.", + "The ticket doesn't exist.": "No existe el ticket.", + "Social name should be uppercase": "La razón social debe ir en mayúscula", + "Street should be uppercase": "La dirección fiscal debe ir en mayúscula", + "Ticket without Route": "Ticket sin ruta", + "Select a different client": "Seleccione un cliente distinto", + "Fill all the fields": "Rellene todos los campos", + "The response is not a PDF": "La respuesta no es un PDF", + "Booking completed": "Reserva completada", + "The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación", + "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", + "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", + "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", + "They're not your subordinate": "No es tu subordinado/a.", + "Missing data: parking or shelving": "Faltas datos: parking o carro" +} \ No newline at end of file From 678eb2928f441fe3f86a75b9559c72e71cad3686 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Tue, 26 Mar 2024 10:30:17 +0100 Subject: [PATCH 21/62] refs #6964 feat:hasItemOlder --- modules/item/back/methods/item-shelving/hasItemOlder.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index b3fb6fa60..72f928ebc 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -37,6 +37,11 @@ module.exports = Self => { Self.hasItemOlder = async(shelvingFkIn, parking, shelvingFkOut, itemFk, options) => { if (!parking && !shelvingFkOut) throw new UserError('Missing data: parking or shelving'); + + const myOptions = {}; + if (typeof options == 'object') + Object.assign(myOptions, options); + const result = await Self.rawSql(` SELECT COUNT(ish.id) countItemOlder FROM vn.itemShelving ish @@ -53,7 +58,7 @@ module.exports = Self => { AND (p.code <> ? OR ? IS NULL) AND (ish.shelvingFk <> ? OR ? IS NULL) AND (ish.itemFk <> ? OR ? IS NULL)`, - [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], options); + [shelvingFkIn, parking, parking, shelvingFkOut, shelvingFkOut, itemFk, itemFk], myOptions); return result[0]['countItemOlder'] > 0; }; }; From ff8522cfd1758c698aa525347e3fb691566222ee Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 27 Mar 2024 07:09:18 +0100 Subject: [PATCH 22/62] refs #6964 feat:advice for olderItem --- .../item/back/methods/item-shelving/specs/hasItemOlder.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js index d44998fab..abffead53 100644 --- a/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js +++ b/modules/item/back/methods/item-shelving/specs/hasItemOlder.spec.js @@ -32,7 +32,7 @@ describe('itemShelving hasOlder()', () => { const itemShelvingBefore = await models.ItemShelving.findOne(filter, myOptions); await itemShelvingBefore.updateAttributes({ itemFk: itemFk - }); + }, myOptions); const result = await models.ItemShelving.hasItemOlder(shelvingFkIn, parking, null, null, myOptions); expect(result).toBe(true); From 9240732c00c0a4b8600451d12fa5a2a49fd6b175 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 27 Mar 2024 07:49:51 +0100 Subject: [PATCH 23/62] refs #6964 feat:advice for olderItem --- modules/item/back/methods/item-shelving/hasItemOlder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index 72f928ebc..9502cee67 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -22,7 +22,7 @@ module.exports = Self => { }, { arg: 'itemFk', - type: 'int', + type: 'integer', description: 'Item id' }], returns: { From 1f819ab16aef2a573a1c5f87b88416fceef981eb Mon Sep 17 00:00:00 2001 From: robert Date: Wed, 27 Mar 2024 19:02:05 +0100 Subject: [PATCH 24/62] fix: riesgos --- db/routines/vn/procedures/company_getSuppliersDebt.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql index f6bfc229d..6b0494db7 100644 --- a/db/routines/vn/procedures/company_getSuppliersDebt.sql +++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql @@ -187,7 +187,7 @@ BEGIN FROM tPendingDuedates vp LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif - LEFT JOIN clientRisk cr ON cr.clientFk = c.id + JOIN clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = vp.companyFk; DROP TEMPORARY TABLE tOpeningBalances; From 7634d82d8b0f090776e54a62136a5fa75fd81898 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 28 Mar 2024 07:15:30 +0100 Subject: [PATCH 25/62] refs #6964 feat:hasItemOlder --- modules/item/back/methods/item-shelving/hasItemOlder.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/item/back/methods/item-shelving/hasItemOlder.js b/modules/item/back/methods/item-shelving/hasItemOlder.js index 9502cee67..ee4cdc829 100644 --- a/modules/item/back/methods/item-shelving/hasItemOlder.js +++ b/modules/item/back/methods/item-shelving/hasItemOlder.js @@ -46,10 +46,9 @@ module.exports = Self => { SELECT COUNT(ish.id) countItemOlder FROM vn.itemShelving ish JOIN ( - SELECT ish.itemFk, created,shelvingFk, p.code + SELECT ish.itemFk, created,shelvingFk FROM vn.itemShelving ish JOIN vn.shelving s ON ish.shelvingFk = s.code - LEFT JOIN vn.parking p ON p.id = s.parkingFk WHERE ish.shelvingFk = ? )sub ON sub.itemFK = ish.itemFk JOIN vn.shelving s ON s.code = ish.shelvingFk From 063745167e939e0d46de8c02ab138dbb26639149 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 28 Mar 2024 10:30:41 +0100 Subject: [PATCH 26/62] fix: modificar company_getSuppliersDebt --- db/routines/vn/procedures/company_getSuppliersDebt.sql | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql index 6b0494db7..3f91a2328 100644 --- a/db/routines/vn/procedures/company_getSuppliersDebt.sql +++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql @@ -185,10 +185,12 @@ BEGIN vp.endingBalance, cr.amount clientRiskAmount FROM tPendingDuedates vp - LEFT JOIN supplier s ON s.id = vp.supplierFk + LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif - JOIN clientRisk cr ON cr.clientFk = c.id - AND cr.companyFk = vp.companyFk; + JOIN clientRisk cr ON cr.clientFk = c.id AND cr.companyFk = vp.companyFk + LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id + LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk + LEFT JOIN country co ON co.id = be.countryFk; DROP TEMPORARY TABLE tOpeningBalances; DROP TEMPORARY TABLE tPendingDuedates; From 1c18b0953147070e69aadc497ac47c3561a71a1b Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 28 Mar 2024 10:47:47 +0100 Subject: [PATCH 27/62] fix: company_getSuppliersDebt --- .../procedures/company_getSuppliersDebt.sql | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql index 3f91a2328..842698020 100644 --- a/db/routines/vn/procedures/company_getSuppliersDebt.sql +++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql @@ -174,16 +174,17 @@ BEGIN SELECT vp.expirationId, vp.dated, vp.supplierFk, - vp.companyFk, - vp.currencyFk, - vp.amount, - vp.pending, - vp.balance, - s.payMethodFk, - vp.isPayment, - vp.isReconciled, - vp.endingBalance, - cr.amount clientRiskAmount + vp.companyFk, + vp.currencyFk, + vp.amount, + vp.pending, + vp.balance, + s.payMethodFk, + vp.isPayment, + vp.isReconciled, + vp.endingBalance, + cr.amount clientRiskAmount, + co.CEE FROM tPendingDuedates vp LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif From b445d745a534a611e77ed259f1abe4cc75500b2e Mon Sep 17 00:00:00 2001 From: Pako Date: Thu, 28 Mar 2024 11:40:18 +0100 Subject: [PATCH 28/62] cambios --- .../vn/procedures/sale_boxPickingPrint.sql | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 db/routines/vn/procedures/sale_boxPickingPrint.sql diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql new file mode 100644 index 000000000..e979ee0b4 --- /dev/null +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -0,0 +1,283 @@ +DELIMITER $$ +$$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE vn.sale_boxPickingPrint( + IN vPrinterFk INT, + IN vSaleFk INT, + IN vPacking INT, + IN vSectorFk INT, + IN vUserFk INT, + IN vPackagingFk VARCHAR(10), + IN vPackingSiteFk INT) +BEGIN +/** Splits a line of sale to a different ticket and prints the transport sticker + */ + DECLARE vAgencyModeFk INT; + DECLARE vConcept VARCHAR(30); + DECLARE vExpeditionFk INT; + DECLARE vItemFk INT; + DECLARE vItemShelvingFk INT; + DECLARE vItemShelvingSaleFk INT; + DECLARE vItemShelvingSaleFk_old INT; + DECLARE vLastExpeditionTimeStamp DATETIME; + DECLARE vMaxPhoneLength INT DEFAULT 11; + DECLARE vMaxStreetLength INT DEFAULT 36; + DECLARE vNewSaleFk INT; + DECLARE vNewTicketFk INT; + DECLARE vParkingCode VARCHAR(10); + DECLARE vQuantity INT; + DECLARE vRemainder INT DEFAULT 0; + DECLARE vRemainderSaleFk INT; + DECLARE vShelving VARCHAR(10); + DECLARE vTicketFk INT; + + SELECT s.quantity, + s.quantity MOD vPacking, + s.ticketFk, + s.itemFk, + s.concept + INTO vQuantity, + vRemainder, + vTicketFk, + vItemFk, + vConcept + FROM sale s + WHERE s.id = vSaleFk; + + IF vRemainder THEN + UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk; + + INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept) + SELECT ticketFk, itemFk, vRemainder, price, discount, concept + FROM sale + WHERE id = vSaleFk; + + SET vRemainderSaleFk = LAST_INSERT_ID(); + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT vRemainderSaleFk, componentFk, value + FROM saleComponent + WHERE saleFk = vSaleFk; + END IF; + +w1: WHILE vQuantity >= vPacking DO + + SET vItemShelvingFk = NULL; + + SELECT sub.id + INTO vItemShelvingFk + FROM productionConfig pc + JOIN ( + SELECT ish.id, + ish.visible - IFNULL(SUM(iss.quantity),0) available, + p.pickingOrder, + ish.created + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + LEFT JOIN itemShelvingSale iss + ON iss.itemShelvingFk = ish.id + AND iss.created >= CURDATE() + AND iss.isPicked = FALSE + WHERE ish.itemFk = vItemFk + AND p.sectorFk = vSectorFk + GROUP BY ish.id + HAVING available >= vPacking) sub + ORDER BY IF(pc.orderMode = 'Location',sub.pickingOrder, sub.created) + LIMIT 1; + + IF vItemShelvingFk THEN + INSERT INTO itemShelvingSale + SET itemShelvingFk = vItemShelvingFk, + saleFk = vSaleFk, + quantity = vPacking, + userFk = vUserFk, + isPicked = TRUE; + + SET vItemShelvingSaleFk = LAST_INSERT_ID(); + + UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk; + ELSE + LEAVE w1; + END IF; + + SET vNewTicketFk = NULL; + + SELECT MAX(t.id) INTO vNewTicketFk + FROM ticket t + JOIN ticketLastState tls ON tls.ticketFk = t.id + JOIN (SELECT addressFk, clientFk, date(shipped) shipped, warehouseFk + FROM ticket + WHERE id = vTicketFk) tt + ON tt.addressFk = t.addressFk + AND tt.clientFk = t.clientFk + AND t.shipped BETWEEN tt.shipped AND util.dayend(tt.shipped) + AND t.warehouseFk = tt.warehouseFk + WHERE tls.name = 'Encajado' ; + + IF ISNULL(vNewTicketFk) THEN + INSERT INTO ticket( clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority, + clonedFrom) + SELECT clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority, + id + FROM ticket + WHERE id = vTicketFk; + + SET vNewTicketFk = LAST_INSERT_ID(); + + INSERT INTO ticketTracking(ticketFk, stateFk, userFk) + SELECT vNewTicketFk, id, vUserFk + FROM state + WHERE code = 'PACKED'; + END IF; + + UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk; + + UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk; + + SET vNewSaleFk = NULL; + + SELECT MAX(id) INTO vNewSaleFk + FROM sale + WHERE ticketFk = vNewTicketFk + AND itemFk = vItemFk; + + IF vNewSaleFk THEN + UPDATE sale + SET quantity = quantity + vPacking + WHERE id = vNewSaleFk; + + SET vItemShelvingSaleFk_old = NULL; + + SELECT MAX(id) INTO vItemShelvingSaleFk_old + FROM itemShelvingSale + WHERE itemShelvingFk = vItemShelvingFk + AND saleFk = vNewSaleFk; + + IF vItemShelvingSaleFk_old THEN + UPDATE itemShelvingSale + SET quantity = quantity + vPacking + WHERE id = vItemShelvingSaleFk_old; + + DELETE FROM itemShelvingSale + WHERE id = vItemShelvingSaleFk; + + SET vItemShelvingSaleFk = vItemShelvingSaleFk_old; + ELSE + UPDATE itemShelvingSale + SET saleFk = vNewSaleFk + WHERE id = vItemShelvingSaleFk; + END IF; + ELSE + INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price) + SELECT vNewTicketFk, itemFk, concept, vPacking, discount, price + FROM sale + WHERE id = vSaleFk; + + SET vNewSaleFk = LAST_INSERT_ID(); + + INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge) + SELECT vNewSaleFk, componentFk, value, isGreuge + FROM saleComponent + WHERE saleFk = vSaleFk; + + UPDATE itemShelvingSale + SET saleFk = vNewSaleFk + WHERE id = vItemShelvingSaleFk; + END IF; + + INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk) + SELECT vNewSaleFk, TRUE, vUserFk, id + FROM state + WHERE code = 'PREPARED'; + + SELECT agencyModeFk INTO vAgencyModeFk + FROM ticket + WHERE id = vNewTicketFk; + + INSERT INTO expedition( + agencyModeFk, + ticketFk, + freightItemFk, + workerFk, + packagingFk, + itemPackingTypeFk, + hostFk, + packingSiteFk, + monitorId, + started, + ended + ) + SELECT vAgencyModeFk, + vNewTicketFk, + i.id, + vUserFk, + vPackagingFk, + ps.code, + h.code, + vPackingSiteFk, + ps.monitorId, + IFNULL(vLastExpeditionTimeStamp, NOW()), + NOW() + FROM packingSite ps + JOIN host h ON h.id = ps.hostFk + JOIN item i ON i.name = 'Shipping cost' + WHERE ps.id = vPackingSiteFk + LIMIT 1; + + SET vExpeditionFk = LAST_INSERT_ID(); + + SET vLastExpeditionTimeStamp = NOW(); + + CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE); + + SELECT shelvingFk, p.code + INTO vShelving, vParkingCode + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + WHERE ish.id = vItemShelvingFk; + + UPDATE dipole.expedition_PrintOut + SET isPrinted = FALSE, + itemFk = vItemFk, + quantity = vPacking, + longName = vConcept, + shelvingFk = vShelving, + parkingCode = vParkingCode, + phone = RIGHT(phone,vMaxPhoneLength), + street = RIGHT(street, vMAxStreetLength) + WHERE expeditionFk = vExpeditionFk; + + DELETE FROM sale + WHERE quantity = 0 + AND id = vSaleFk; + END WHILE; + +END$$ +DELIMITER ; \ No newline at end of file From 1d906c993b8b0ebff3f9e5ba455781aa75a2ea7e Mon Sep 17 00:00:00 2001 From: Pako Date: Thu, 28 Mar 2024 12:43:13 +0100 Subject: [PATCH 29/62] portes --- db/routines/vn/procedures/sale_boxPickingPrint.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index e979ee0b4..6cd8eeb20 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -246,7 +246,7 @@ w1: WHILE vQuantity >= vPacking DO NOW() FROM packingSite ps JOIN host h ON h.id = ps.hostFk - JOIN item i ON i.name = 'Shipping cost' + JOIN item i ON i.name = 'Porte Caja' WHERE ps.id = vPackingSiteFk LIMIT 1; From 9a7bcdf104b423a26fec5c49944c420058eabadb Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 28 Mar 2024 13:26:09 +0100 Subject: [PATCH 30/62] fix: company_getSuppliersDebt --- .../procedures/company_getSuppliersDebt.sql | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/db/routines/vn/procedures/company_getSuppliersDebt.sql b/db/routines/vn/procedures/company_getSuppliersDebt.sql index 842698020..3f6756d48 100644 --- a/db/routines/vn/procedures/company_getSuppliersDebt.sql +++ b/db/routines/vn/procedures/company_getSuppliersDebt.sql @@ -34,19 +34,19 @@ BEGIN currencyFk FROM ( SELECT p.supplierFk, - p.companyFk, - IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount, - p.dueDated < vStartingDate isBeforeStarting, - p.currencyFk + p.companyFk, + IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount, + p.dueDated < vStartingDate isBeforeStarting, + p.currencyFk FROM payment p WHERE p.received > vStartDate AND p.companyFk = vSelf UNION ALL SELECT r.supplierFk, - r.companyFk, - - IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total, - rv.dueDated < vStartingDate isBeforeStarting, - r.currencyFk + r.companyFk, + - IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total, + rv.dueDated < vStartingDate isBeforeStarting, + r.currencyFk FROM invoiceIn r INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk WHERE r.issued > vStartDate @@ -57,7 +57,7 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tPendingDuedates; CREATE TEMPORARY TABLE tPendingDuedates ( id INT auto_increment, - expirationId INT, + expirationId INT, dated DATE, supplierFk INT NOT NULL, companyFk INT NOT NULL, @@ -82,35 +82,35 @@ BEGIN isPayment, isReconciled )SELECT p.id, - p.dueDated, - p.supplierFk, - p.companyFk, - IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa), - p.currencyFk, - TRUE isPayment, - p.isConciliated - FROM payment p - WHERE p.dueDated >= vStartingDate - AND p.companyFk = vSelf - UNION ALL - SELECT r.id, - rv.dueDated, - r.supplierFk, - r.companyFk, - -IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue), - r.currencyFk, - FALSE isPayment, - TRUE - FROM invoiceIn r - LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk - AND r.supplierFk = si.supplierFk - AND r.currencyFk = si.currencyFk - JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk - WHERE rv.dueDated >= vStartingDate - AND (si.closingBalances IS NULL OR si.closingBalances <> 0) - AND r.isBooked - AND r.companyFk = vSelf - ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id; + p.dueDated, + p.supplierFk, + p.companyFk, + IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa), + p.currencyFk, + TRUE isPayment, + p.isConciliated + FROM payment p + WHERE p.dueDated >= vStartingDate + AND p.companyFk = vSelf + UNION ALL + SELECT r.id, + rv.dueDated, + r.supplierFk, + r.companyFk, + -IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue), + r.currencyFk, + FALSE isPayment, + TRUE + FROM invoiceIn r + LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk + AND r.supplierFk = si.supplierFk + AND r.currencyFk = si.currencyFk + JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk + WHERE rv.dueDated >= vStartingDate + AND (si.closingBalances IS NULL OR si.closingBalances <> 0) + AND r.isBooked + AND r.companyFk = vSelf + ORDER BY supplierFk, companyFk, companyFk, dueDated, isPayment DESC, id; -- Now, we calculate the outstanding amount for each receipt in descending order SET @risk := 0.0; SET @supplier := 0.0; @@ -169,7 +169,7 @@ BEGIN AND vp.supplierFk = rd.supplierFk AND vp.companyFk = rd.companyFk AND vp.currencyFk = rd.currencyFk - WHERE vp.isPayment = FALSE; + WHERE NOT vp.isPayment; SELECT vp.expirationId, vp.dated, From c942786783ea8bc9650e20ba690fcf095e98624b Mon Sep 17 00:00:00 2001 From: Pako Date: Thu, 28 Mar 2024 14:54:30 +0100 Subject: [PATCH 31/62] pruebas --- .../vn/procedures/boxPicking_print.sql | 22 +++++++++++++------ .../vn/procedures/sale_boxPickingPrint.sql | 14 ++++++------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/db/routines/vn/procedures/boxPicking_print.sql b/db/routines/vn/procedures/boxPicking_print.sql index 5eea4ee1e..31485be1d 100644 --- a/db/routines/vn/procedures/boxPicking_print.sql +++ b/db/routines/vn/procedures/boxPicking_print.sql @@ -59,6 +59,8 @@ BEGIN WHERE saleFk = vSaleFk; END IF; +SELECT vQuantity , vPacking; + w1: WHILE vQuantity >= vPacking DO SET vItemShelvingFk = NULL; @@ -86,13 +88,13 @@ w1: WHILE vQuantity >= vPacking DO LIMIT 1; IF vItemShelvingFk THEN - INSERT INTO itemShelvingSale + /* INSERT INTO itemShelvingSale SET itemShelvingFk = vItemShelvingFk, saleFk = vSaleFk, quantity = vPacking, userFk = vUserFk, isPicked = TRUE; - +*/ SET vItemShelvingSaleFk = LAST_INSERT_ID(); UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk; @@ -188,10 +190,12 @@ w1: WHILE vQuantity >= vPacking DO WHERE id = vItemShelvingSaleFk; SET vItemShelvingSaleFk = vItemShelvingSaleFk_old; - ELSE - UPDATE itemShelvingSale + /*ELSE + + * UPDATE itemShelvingSale SET saleFk = vNewSaleFk WHERE id = vItemShelvingSaleFk; + */ END IF; ELSE INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price) @@ -206,9 +210,11 @@ w1: WHILE vQuantity >= vPacking DO FROM saleComponent WHERE saleFk = vSaleFk; - UPDATE itemShelvingSale + /* + * UPDATE itemShelvingSale SET saleFk = vNewSaleFk WHERE id = vItemShelvingSaleFk; + */ END IF; INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk) @@ -231,7 +237,8 @@ w1: WHILE vQuantity >= vPacking DO packingSiteFk, monitorId, started, - ended + ended, + counter ) SELECT vAgencyModeFk, vNewTicketFk, @@ -243,7 +250,8 @@ w1: WHILE vQuantity >= vPacking DO vPackingSiteFk, ps.monitorId, IFNULL(vLastExpeditionTimeStamp, NOW()), - NOW() + NOW(), + 0 FROM packingSite ps JOIN host h ON h.id = ps.hostFk JOIN item i ON i.name = 'Shipping cost' diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index 6cd8eeb20..7872ff000 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -86,7 +86,7 @@ w1: WHILE vQuantity >= vPacking DO LIMIT 1; IF vItemShelvingFk THEN - INSERT INTO itemShelvingSale + /* INSERT INTO itemShelvingSale SET itemShelvingFk = vItemShelvingFk, saleFk = vSaleFk, quantity = vPacking, @@ -94,7 +94,7 @@ w1: WHILE vQuantity >= vPacking DO isPicked = TRUE; SET vItemShelvingSaleFk = LAST_INSERT_ID(); - +*/ UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk; ELSE LEAVE w1; @@ -188,10 +188,10 @@ w1: WHILE vQuantity >= vPacking DO WHERE id = vItemShelvingSaleFk; SET vItemShelvingSaleFk = vItemShelvingSaleFk_old; - ELSE + /* ELSE UPDATE itemShelvingSale SET saleFk = vNewSaleFk - WHERE id = vItemShelvingSaleFk; + WHERE id = vItemShelvingSaleFk; */ END IF; ELSE INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price) @@ -206,9 +206,9 @@ w1: WHILE vQuantity >= vPacking DO FROM saleComponent WHERE saleFk = vSaleFk; - UPDATE itemShelvingSale - SET saleFk = vNewSaleFk - WHERE id = vItemShelvingSaleFk; + /* UPDATE itemShelvingSale + SET saleFk = vNewSaleFk */ + END IF; INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk) From 9aae9677e66b3208fd66b1399a578cf1974f6ef2 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 1 Apr 2024 08:43:26 +0200 Subject: [PATCH 32/62] modificaciones --- .../vn/procedures/sale_boxPickingPrint.sql | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index 7872ff000..8b7f8ecbe 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -61,6 +61,8 @@ BEGIN w1: WHILE vQuantity >= vPacking DO + SET vQuantity = vQuantity - vPacking; + SET vItemShelvingFk = NULL; SELECT sub.id @@ -86,7 +88,7 @@ w1: WHILE vQuantity >= vPacking DO LIMIT 1; IF vItemShelvingFk THEN - /* INSERT INTO itemShelvingSale + INSERT INTO itemShelvingSale SET itemShelvingFk = vItemShelvingFk, saleFk = vSaleFk, quantity = vPacking, @@ -94,7 +96,7 @@ w1: WHILE vQuantity >= vPacking DO isPicked = TRUE; SET vItemShelvingSaleFk = LAST_INSERT_ID(); -*/ + UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk; ELSE LEAVE w1; @@ -188,10 +190,10 @@ w1: WHILE vQuantity >= vPacking DO WHERE id = vItemShelvingSaleFk; SET vItemShelvingSaleFk = vItemShelvingSaleFk_old; - /* ELSE + ELSE UPDATE itemShelvingSale SET saleFk = vNewSaleFk - WHERE id = vItemShelvingSaleFk; */ + WHERE id = vItemShelvingSaleFk; END IF; ELSE INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price) @@ -206,9 +208,10 @@ w1: WHILE vQuantity >= vPacking DO FROM saleComponent WHERE saleFk = vSaleFk; - /* UPDATE itemShelvingSale - SET saleFk = vNewSaleFk */ - + UPDATE itemShelvingSale + SET saleFk = vNewSaleFk + WHERE id = vItemShelvingSaleFk; + END IF; INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk) @@ -277,6 +280,7 @@ w1: WHILE vQuantity >= vPacking DO DELETE FROM sale WHERE quantity = 0 AND id = vSaleFk; + END WHILE; END$$ From 98b1e933f7c0c390440b04ef6f8ad0edab66f542 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 1 Apr 2024 08:46:07 +0200 Subject: [PATCH 33/62] prova --- db/routines/vn/procedures/sale_boxPickingPrint.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index 8b7f8ecbe..ae0c6451e 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -58,7 +58,7 @@ BEGIN FROM saleComponent WHERE saleFk = vSaleFk; END IF; - +/* res */ w1: WHILE vQuantity >= vPacking DO SET vQuantity = vQuantity - vPacking; From 547df4704922b475341a9ddffa33e984a619eb22 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 1 Apr 2024 08:47:16 +0200 Subject: [PATCH 34/62] delete old proc --- .../vn/procedures/boxPicking_print.sql | 291 ------------------ 1 file changed, 291 deletions(-) delete mode 100644 db/routines/vn/procedures/boxPicking_print.sql diff --git a/db/routines/vn/procedures/boxPicking_print.sql b/db/routines/vn/procedures/boxPicking_print.sql deleted file mode 100644 index 31485be1d..000000000 --- a/db/routines/vn/procedures/boxPicking_print.sql +++ /dev/null @@ -1,291 +0,0 @@ -DELIMITER $$ -$$ -CREATE OR REPLACE PROCEDURE vn.sale_boxPickingPrint( - IN vPrinterFk INT, - IN vSaleFk INT, - IN vPacking INT, - IN vSectorFk INT, - IN vUserFk INT, - IN vPackagingFk INT, - IN vPackingSiteFk INT) -BEGIN -/** Splits a line of sale to a different ticket and prints the transport sticker - */ - DECLARE vAgencyModeFk INT; - DECLARE vConcept VARCHAR(30); - DECLARE vExpeditionFk INT; - DECLARE vItemFk INT; - DECLARE vItemShelvingFk INT; - DECLARE vItemShelvingSaleFk INT; - DECLARE vItemShelvingSaleFk_old INT; - DECLARE vLastExpeditionTimeStamp DATETIME; - DECLARE vMaxPhoneLength INT DEFAULT 11; - DECLARE vMaxStreetLength INT DEFAULT 36; - DECLARE vNewSaleFk INT; - DECLARE vNewTicketFk INT; - DECLARE vParkingCode VARCHAR(10); - DECLARE vQuantity INT; - DECLARE vRemainder INT DEFAULT 0; - DECLARE vRemainderSaleFk INT; - DECLARE vShelving VARCHAR(10); - DECLARE vTicketFk INT; - - SELECT s.quantity, - s.quantity MOD vPacking, - s.ticketFk, - s.itemFk, - s.concept - INTO vQuantity, - vRemainder, - vTicketFk, - vItemFk, - vConcept - FROM sale s - WHERE s.id = vSaleFk; - - IF vRemainder THEN - UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk; - - INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept) - SELECT ticketFk, itemFk, vRemainder, price, discount, concept - FROM sale - WHERE id = vSaleFk; - - SET vRemainderSaleFk = LAST_INSERT_ID(); - - INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT vRemainderSaleFk, componentFk, value - FROM saleComponent - WHERE saleFk = vSaleFk; - END IF; - -SELECT vQuantity , vPacking; - -w1: WHILE vQuantity >= vPacking DO - - SET vItemShelvingFk = NULL; - - SELECT sub.id - INTO vItemShelvingFk - FROM productionConfig pc - JOIN ( - SELECT ish.id, - ish.visible - IFNULL(SUM(iss.quantity),0) available, - p.pickingOrder, - ish.created - FROM itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - LEFT JOIN itemShelvingSale iss - ON iss.itemShelvingFk = ish.id - AND iss.created >= CURDATE() - AND iss.isPicked = FALSE - WHERE ish.itemFk = vItemFk - AND p.sectorFk = vSectorFk - GROUP BY ish.id - HAVING available >= vPacking) sub - ORDER BY IF(pc.orderMode = 'Location',sub.pickingOrder, sub.created) - LIMIT 1; - - IF vItemShelvingFk THEN - /* INSERT INTO itemShelvingSale - SET itemShelvingFk = vItemShelvingFk, - saleFk = vSaleFk, - quantity = vPacking, - userFk = vUserFk, - isPicked = TRUE; -*/ - SET vItemShelvingSaleFk = LAST_INSERT_ID(); - - UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk; - ELSE - LEAVE w1; - END IF; - - SET vNewTicketFk = NULL; - - SELECT MAX(t.id) INTO vNewTicketFk - FROM ticket t - JOIN ticketLastState tls ON tls.ticketFk = t.id - JOIN (SELECT addressFk, clientFk, date(shipped) shipped, warehouseFk - FROM ticket - WHERE id = vTicketFk) tt - ON tt.addressFk = t.addressFk - AND tt.clientFk = t.clientFk - AND t.shipped BETWEEN tt.shipped AND util.dayend(tt.shipped) - AND t.warehouseFk = tt.warehouseFk - WHERE tls.name = 'Encajado' ; - - IF ISNULL(vNewTicketFk) THEN - INSERT INTO ticket( clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk, - priority, - hasPriority, - clonedFrom) - SELECT clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk, - priority, - hasPriority, - id - FROM ticket - WHERE id = vTicketFk; - - SET vNewTicketFk = LAST_INSERT_ID(); - - INSERT INTO ticketTracking(ticketFk, stateFk, userFk) - SELECT vNewTicketFk, id, vUserFk - FROM state - WHERE code = 'PACKED'; - END IF; - - UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk; - - UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk; - - SET vNewSaleFk = NULL; - - SELECT MAX(id) INTO vNewSaleFk - FROM sale - WHERE ticketFk = vNewTicketFk - AND itemFk = vItemFk; - - IF vNewSaleFk THEN - UPDATE sale - SET quantity = quantity + vPacking - WHERE id = vNewSaleFk; - - SET vItemShelvingSaleFk_old = NULL; - - SELECT MAX(id) INTO vItemShelvingSaleFk_old - FROM itemShelvingSale - WHERE itemShelvingFk = vItemShelvingFk - AND saleFk = vNewSaleFk; - - IF vItemShelvingSaleFk_old THEN - UPDATE itemShelvingSale - SET quantity = quantity + vPacking - WHERE id = vItemShelvingSaleFk_old; - - DELETE FROM itemShelvingSale - WHERE id = vItemShelvingSaleFk; - - SET vItemShelvingSaleFk = vItemShelvingSaleFk_old; - /*ELSE - - * UPDATE itemShelvingSale - SET saleFk = vNewSaleFk - WHERE id = vItemShelvingSaleFk; - */ - END IF; - ELSE - INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price) - SELECT vNewTicketFk, itemFk, concept, vPacking, discount, price - FROM sale - WHERE id = vSaleFk; - - SET vNewSaleFk = LAST_INSERT_ID(); - - INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge) - SELECT vNewSaleFk, componentFk, value, isGreuge - FROM saleComponent - WHERE saleFk = vSaleFk; - - /* - * UPDATE itemShelvingSale - SET saleFk = vNewSaleFk - WHERE id = vItemShelvingSaleFk; - */ - END IF; - - INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk) - SELECT vNewSaleFk, TRUE, vUserFk, id - FROM state - WHERE code = 'PREPARED'; - - SELECT agencyModeFk INTO vAgencyModeFk - FROM ticket - WHERE id = vNewTicketFk; - - INSERT INTO expedition( - agencyModeFk, - ticketFk, - freightItemFk, - workerFk, - packagingFk, - itemPackingTypeFk, - hostFk, - packingSiteFk, - monitorId, - started, - ended, - counter - ) - SELECT vAgencyModeFk, - vNewTicketFk, - i.id, - vUserFk, - vPackagingFk, - ps.code, - h.code, - vPackingSiteFk, - ps.monitorId, - IFNULL(vLastExpeditionTimeStamp, NOW()), - NOW(), - 0 - FROM packingSite ps - JOIN host h ON h.id = ps.hostFk - JOIN item i ON i.name = 'Shipping cost' - WHERE ps.id = vPackingSiteFk - LIMIT 1; - - SET vExpeditionFk = LAST_INSERT_ID(); - - SET vLastExpeditionTimeStamp = NOW(); - - CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE); - - SELECT shelvingFk, p.code - INTO vShelving, vParkingCode - FROM itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - WHERE ish.id = vItemShelvingFk; - - UPDATE dipole.expedition_PrintOut - SET isPrinted = FALSE, - itemFk = vItemFk, - quantity = vPacking, - longName = vConcept, - shelvingFk = vShelving, - parkingCode = vParkingCode, - phone = RIGHT(phone,vMaxPhoneLength), - street = RIGHT(street, vMAxStreetLength) - WHERE expeditionFk = vExpeditionFk; - - DELETE FROM sale - WHERE quantity = 0 - AND id = vSaleFk; - END WHILE; - -END$$ -DELIMITER ; \ No newline at end of file From df911b9b75e23066f0263e1fcb96379b0ef25412 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 1 Apr 2024 08:47:47 +0200 Subject: [PATCH 35/62] fora comentaris --- db/routines/vn/procedures/sale_boxPickingPrint.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index ae0c6451e..8b7f8ecbe 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -58,7 +58,7 @@ BEGIN FROM saleComponent WHERE saleFk = vSaleFk; END IF; -/* res */ + w1: WHILE vQuantity >= vPacking DO SET vQuantity = vQuantity - vPacking; From 7c4fc31b50a8ab0323a8ab510ffa70135d8cfe81 Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 1 Apr 2024 08:55:21 +0200 Subject: [PATCH 36/62] version productionConfig --- db/routines/vn/procedures/sale_boxPickingPrint.sql | 7 +++---- db/versions/10973-purpleAsparagus/00-firstScript.sql | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 db/versions/10973-purpleAsparagus/00-firstScript.sql diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index 8b7f8ecbe..dbb3b6c14 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -238,7 +238,7 @@ w1: WHILE vQuantity >= vPacking DO ) SELECT vAgencyModeFk, vNewTicketFk, - i.id, + pc.defaultFreightItemFk, vUserFk, vPackagingFk, ps.code, @@ -249,9 +249,8 @@ w1: WHILE vQuantity >= vPacking DO NOW() FROM packingSite ps JOIN host h ON h.id = ps.hostFk - JOIN item i ON i.name = 'Porte Caja' - WHERE ps.id = vPackingSiteFk - LIMIT 1; + JOIN productionConfig pc + WHERE ps.id = vPackingSiteFk; SET vExpeditionFk = LAST_INSERT_ID(); diff --git a/db/versions/10973-purpleAsparagus/00-firstScript.sql b/db/versions/10973-purpleAsparagus/00-firstScript.sql new file mode 100644 index 000000000..f5b838529 --- /dev/null +++ b/db/versions/10973-purpleAsparagus/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE vn.productionConfig ADD defaultFreightItemFk INT UNSIGNED DEFAULT 71 NOT NULL COMMENT 'Default value for expedition table'; From 3a1f5109d9cb6908f5d2496f44f56f4c21ed696b Mon Sep 17 00:00:00 2001 From: pako Date: Mon, 1 Apr 2024 11:58:16 +0200 Subject: [PATCH 37/62] lines and volume --- db/routines/vn/procedures/collection_new.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql index 82196585d..1292707af 100644 --- a/db/routines/vn/procedures/collection_new.sql +++ b/db/routines/vn/procedures/collection_new.sql @@ -219,9 +219,11 @@ proc:BEGIN UPDATE tmp.productionBuffer pb JOIN ( SELECT SUM(litros) liters, - @lines:= COUNT(*) + @lines `lines`, + @lines:= COUNT(*) + @lines, + COUNT(*) `lines`, MAX(i.`size`) height, - @volume := SUM(sv.volume) + @volume volume + @volume := SUM(sv.volume) + @volume, + SUM(sv.volume) volume FROM saleVolume sv JOIN sale s ON s.id = sv.saleFk JOIN item i ON i.id = s.itemFk From bfa59bdcea3518146e41f12d2c897e198db07c6f Mon Sep 17 00:00:00 2001 From: pako Date: Mon, 1 Apr 2024 14:20:25 +0200 Subject: [PATCH 38/62] release_lock --- db/routines/vn/procedures/collection_assign.sql | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index 6d31fbc8f..70c48bc38 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -1,8 +1,8 @@ -DELIMITER $$ +DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`collection_assign`( vUserFk INT, OUT vCollectionFk INT -) +) proc:BEGIN /** * Comprueba si existen colecciones libres que se ajustan @@ -15,6 +15,15 @@ proc:BEGIN DECLARE vHasTooMuchCollections BOOL; DECLARE vLockTime INT DEFAULT 15; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + IF 'collection_assign' IS NOT NULL THEN + DO RELEASE_LOCK('collection_assign'); + END IF; + + RESIGNAL; + END; + -- Si hay colecciones sin terminar, sale del proceso CALL collection_get(vUserFk); @@ -84,5 +93,5 @@ proc:BEGIN WHERE id = vCollectionFk; DO RELEASE_LOCK('collection_assign'); -END$$ -DELIMITER ; +END$$ +DELIMITER ; From cb745b0f4d146e38866b7a91cb45b08e81a9aa55 Mon Sep 17 00:00:00 2001 From: pako Date: Mon, 1 Apr 2024 14:21:34 +0200 Subject: [PATCH 39/62] release_lock --- db/routines/vn/procedures/collection_assign.sql | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index 70c48bc38..49b4eb7bb 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -17,10 +17,8 @@ proc:BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - IF 'collection_assign' IS NOT NULL THEN - DO RELEASE_LOCK('collection_assign'); - END IF; - + DO RELEASE_LOCK('collection_assign'); + RESIGNAL; END; From 1b72572440bb22ac15934488f70b357ea03d340c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 2 Apr 2024 11:58:30 +0000 Subject: [PATCH 40/62] FIX render HTML --- print/templates/email/zone-included/zone-included.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/email/zone-included/zone-included.html b/print/templates/email/zone-included/zone-included.html index 78915faad..e4fe08247 100644 --- a/print/templates/email/zone-included/zone-included.html +++ b/print/templates/email/zone-included/zone-included.html @@ -18,7 +18,7 @@ - + {{ zone.zn.name }} {{ zone.zoneFk }} {{ zone.z.price }} From 09e1e4de19e5829c8993a6a93356049e8bd17af0 Mon Sep 17 00:00:00 2001 From: jcasado Date: Wed, 3 Apr 2024 07:23:36 +0200 Subject: [PATCH 41/62] refactor: #7123 change credit document --- front/core/components/searchbar/style.scss | 4 +- print/common/css/layout.css | 6 +- .../credit-request/assets/css/style.css | 27 ++++--- .../credit-request/credit-request.html | 72 +++++-------------- .../reports/credit-request/locale/es.yml | 1 + 5 files changed, 40 insertions(+), 70 deletions(-) diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss index eab9c126b..b8dff9474 100644 --- a/front/core/components/searchbar/style.scss +++ b/front/core/components/searchbar/style.scss @@ -61,10 +61,10 @@ vn-searchbar { } vn-icon[icon="info"] { - position: absolute; + position: absolute; top: 2px; right: 2px } } } -} \ No newline at end of file +} diff --git a/print/common/css/layout.css b/print/common/css/layout.css index c1af4807d..8f4d1fc9e 100644 --- a/print/common/css/layout.css +++ b/print/common/css/layout.css @@ -178,7 +178,7 @@ table { margin-bottom: 15px } -.column-oriented td, +.column-oriented td, .column-oriented th { padding: 10px } @@ -252,10 +252,10 @@ table { position: absolute; text-align: center; width: 100%; - + } .line span { background-color: #FFF; padding: 5px -} \ No newline at end of file +} diff --git a/print/templates/reports/credit-request/assets/css/style.css b/print/templates/reports/credit-request/assets/css/style.css index a46a33484..ac58e81cf 100644 --- a/print/templates/reports/credit-request/assets/css/style.css +++ b/print/templates/reports/credit-request/assets/css/style.css @@ -16,7 +16,6 @@ p { td > span { width: 100%; - margin-bottom: 15px } .green-background { @@ -28,7 +27,7 @@ td > span { } .info-panel td, .info-panel th { - padding: 1em 1em; + padding: 1%; } .info-panel { @@ -37,20 +36,28 @@ td > span { table { width: 100%; + text-align: end; } th { - width: 30%; -} - -td { width: 20%; } -.field { - float: none +td { + width: 10%; } -.wide-rectangle { - background-color: rgb(64 64 68); +.field { + width: 100%; + float: none; } + +th > input { + float: none; + border: 0; + background-color: rgb(236, 236, 236); + width: 100%; + height: 3em; +} + + diff --git a/print/templates/reports/credit-request/credit-request.html b/print/templates/reports/credit-request/credit-request.html index 6b167e95b..2623de577 100644 --- a/print/templates/reports/credit-request/credit-request.html +++ b/print/templates/reports/credit-request/credit-request.html @@ -9,17 +9,13 @@ {{$t('fields.date')}}: -
- -
+ - {{$t('fields.importCredit')}}: + {{$t('fields.importCredit')}}: -
- -
+ @@ -36,65 +32,47 @@ {{$t('fields.companyName')}}: -
- -
+ {{$t('fields.businessType')}}: -
- -
+ {{$t('fields.antiquity')}}: -
- -
+ {{$t('fields.surface')}}: -
- -
+ {{$t('fields.numberOfEmployees')}}: -
- -
+ {{$t('fields.owner')}}: -
- -
+ {{$t('fields.phone')}}: -
- -
+ {{$t('fields.payer')}}: -
- -
+ {{$t('fields.phone')}}: -
- -
+ @@ -113,27 +91,15 @@ - + - - - - @@ -150,15 +116,11 @@ diff --git a/print/templates/reports/credit-request/locale/es.yml b/print/templates/reports/credit-request/locale/es.yml index bc0e09528..5a48cfa50 100644 --- a/print/templates/reports/credit-request/locale/es.yml +++ b/print/templates/reports/credit-request/locale/es.yml @@ -17,3 +17,4 @@ fields: personFilling: Persona que rellena el formulario companyInfo: Información general sobre la empresa economicInfo: Información económica + previousSellsVolume: Volumen de ventas del año anterior From 1f8afc074d3c98a11c84be1d5bb4c33eaad8a725 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 3 Apr 2024 05:49:40 +0000 Subject: [PATCH 42/62] Actualizar print/templates/email/zone-included/zone-included.html --- print/templates/email/zone-included/zone-included.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/email/zone-included/zone-included.html b/print/templates/email/zone-included/zone-included.html index e4fe08247..0484e0919 100644 --- a/print/templates/email/zone-included/zone-included.html +++ b/print/templates/email/zone-included/zone-included.html @@ -18,7 +18,7 @@ - + From 3449e271504344c3bd20d32027ea8333b66a1982 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 3 Apr 2024 05:50:04 +0000 Subject: [PATCH 43/62] Actualizar print/templates/email/zone-included/zone-included.js --- print/templates/email/zone-included/zone-included.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/print/templates/email/zone-included/zone-included.js b/print/templates/email/zone-included/zone-included.js index 4de4777f3..ed6a59b40 100755 --- a/print/templates/email/zone-included/zone-included.js +++ b/print/templates/email/zone-included/zone-included.js @@ -8,5 +8,10 @@ module.exports = { }, props: { zoneCollisions: {type: Array, required: true} + }, + computed: { + zones() { + return JSON.parse(this.zoneCollisions); + } } }; From b9520b53abd66a61043067c2655764171c229273 Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 3 Apr 2024 10:03:59 +0200 Subject: [PATCH 44/62] hotfix_clientsDisable --- db/routines/vn/events/clientsDisable.sql | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/db/routines/vn/events/clientsDisable.sql b/db/routines/vn/events/clientsDisable.sql index 00cd4ed8b..238e060dd 100644 --- a/db/routines/vn/events/clientsDisable.sql +++ b/db/routines/vn/events/clientsDisable.sql @@ -7,9 +7,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable` DO BEGIN UPDATE account.user u JOIN client c ON c.id = u.id - JOIN clientType ct ON ct.id = c.typeFk SET u.active = FALSE - WHERE ct.code = 'normal' + WHERE c.typeFk = 'normal' AND u.id NOT IN ( SELECT DISTINCT c.id FROM client c From 064d6dbb64fa1ea990e551ab923a0fad01a6359c Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 3 Apr 2024 11:57:28 +0200 Subject: [PATCH 45/62] feat: refs #6829 Added two indexes --- db/versions/10975-whiteIvy/00-action.sql | 1 + db/versions/10975-whiteIvy/01-expeditionFk.sql | 1 + 2 files changed, 2 insertions(+) create mode 100644 db/versions/10975-whiteIvy/00-action.sql create mode 100644 db/versions/10975-whiteIvy/01-expeditionFk.sql diff --git a/db/versions/10975-whiteIvy/00-action.sql b/db/versions/10975-whiteIvy/00-action.sql new file mode 100644 index 000000000..3f9cf9d8b --- /dev/null +++ b/db/versions/10975-whiteIvy/00-action.sql @@ -0,0 +1 @@ +CREATE INDEX expeditionLog_action_IDX USING BTREE ON srt.expeditionLog (`action`); diff --git a/db/versions/10975-whiteIvy/01-expeditionFk.sql b/db/versions/10975-whiteIvy/01-expeditionFk.sql new file mode 100644 index 000000000..ac1e01e6f --- /dev/null +++ b/db/versions/10975-whiteIvy/01-expeditionFk.sql @@ -0,0 +1 @@ +CREATE INDEX expeditionLog_expeditionFk_IDX USING BTREE ON srt.expeditionLog (expeditionFk); From 09f023090ecf593b99aadb49426e8aa99d53fe44 Mon Sep 17 00:00:00 2001 From: jcasado Date: Wed, 3 Apr 2024 13:33:56 +0200 Subject: [PATCH 46/62] hotfix claimStateLanguage --- modules/claim/back/methods/claim/updateClaim.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/claim/back/methods/claim/updateClaim.js b/modules/claim/back/methods/claim/updateClaim.js index 68fff7846..82351f802 100644 --- a/modules/claim/back/methods/claim/updateClaim.js +++ b/modules/claim/back/methods/claim/updateClaim.js @@ -96,9 +96,9 @@ module.exports = Self => { // When claimState has been changed if (args.claimStateFk) { const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions); - await notifyStateChange(ctx, salesPerson.id, claim, newState.code); + await notifyStateChange(ctx, salesPerson.id, claim, newState.description); if (newState.code == 'canceled') - await notifyStateChange(ctx, claim.workerFk, claim, newState.code); + await notifyStateChange(ctx, claim.workerFk, claim, newState.description); } if (tx) await tx.commit(); From 59ead0c2e56718dadebf93c010bb6364ee16c816 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 3 Apr 2024 15:29:56 +0200 Subject: [PATCH 47/62] debug(closure): add log --- modules/ticket/back/methods/ticket/closure.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index f616894ec..1d3077b9d 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -147,6 +147,10 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) { ); } } catch (error) { + await Self.rawSql(` + INSERT INTO util.debug (variable, value) + VALUES ('invoicingTicketError', ?) + `, [ticket.id + ' - ' + error]); // Domain not found if (error.responseCode == 450) return invalidEmail(ticket); From 3e044a8efeacafa2d5af9ac9218b71ba99439a35 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 4 Apr 2024 08:16:37 +0200 Subject: [PATCH 48/62] fix: refs #7152 add supplier storage --- loopback/server/datasources.json | 15 +++++++++++++++ modules/supplier/back/model-config.json | 3 +++ 2 files changed, 18 insertions(+) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 608479b4b..341d5d578 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -117,6 +117,21 @@ "video/mp4" ] }, + "supplierStorage": { + "name": "supplierStorage", + "connector": "loopback-component-storage", + "provider": "filesystem", + "root": "./storage/dms", + "maxFileSize": "31457280", + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg", + "image/webp", + "video/mp4", + "application/pdf" + ] + }, "accessStorage": { "name": "accessStorage", "connector": "loopback-component-storage", diff --git a/modules/supplier/back/model-config.json b/modules/supplier/back/model-config.json index 5a0c6b43a..7f3b3aaaf 100644 --- a/modules/supplier/back/model-config.json +++ b/modules/supplier/back/model-config.json @@ -8,6 +8,9 @@ "SupplierDms": { "dataSource": "vn" }, + "SupplierContainer": { + "dataSource": "supplierStorage" + }, "SupplierAddress": { "dataSource": "vn" }, From de5e954ce20bd0f211346ac7201fb60d896e92cd Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 4 Apr 2024 08:48:58 +0200 Subject: [PATCH 49/62] fix: refs #7145 fix overFlow on driver-route --- .../reports/driver-route/assets/css/style.css | 10 +++ .../reports/driver-route/driver-route.html | 2 +- .../reports/driver-route/sql/routes.sql | 37 ++++---- .../reports/driver-route/sql/tickets.sql | 85 +++++++++---------- 4 files changed, 71 insertions(+), 63 deletions(-) diff --git a/print/templates/reports/driver-route/assets/css/style.css b/print/templates/reports/driver-route/assets/css/style.css index a3bcae789..0f08f6493 100644 --- a/print/templates/reports/driver-route/assets/css/style.css +++ b/print/templates/reports/driver-route/assets/css/style.css @@ -1,3 +1,13 @@ +td{ + overflow: hidden; + max-width: 100px; + text-overflow: ellipsis; +} + +/* .text-field{ + text-overflow: ellipsis; +} */ + h1 { text-align: center; } diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 109afd2f5..1391f621c 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -103,7 +103,7 @@
{{$t('fields.previousSalesVolume')}}:{{$t('fields.previousSellsVolume')}}: -
- -
+
{{$t('fields.forecastedSalesVolume')}}: -
- -
-
{{$t('fields.forecastedPurchases')}}: -
- -
+
{{$t('fields.personFilling')}}: -
- -
+
{{$t('fields.phone')}}: -
- -
+
{{ zone.zn.name }} {{ zone.zoneFk }} {{ zone.z.price }}
- + diff --git a/print/templates/reports/driver-route/sql/routes.sql b/print/templates/reports/driver-route/sql/routes.sql index 79bede5b2..9d2dd5c13 100644 --- a/print/templates/reports/driver-route/sql/routes.sql +++ b/print/templates/reports/driver-route/sql/routes.sql @@ -1,19 +1,18 @@ -SELECT - r.id, - r.m3, - r.created, - r.time, - u.nickName userNickName, - v.tradeMark vehicleTradeMark, - v.model vehicleModel, - v.numberPlate plateNumber, - IFNULL(s.name, am.name) AS agencyName -FROM route r - LEFT JOIN vehicle v ON v.id = r.vehicleFk - LEFT JOIN worker w ON w.id = r.workerFk - LEFT JOIN account.user u ON u.id = w.id - LEFT JOIN agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN agency a ON a.id = am.agencyFk - LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id - LEFT JOIN supplier s ON s.id = sa.supplierFk -WHERE r.id IN(?) +SELECT r.id, + r.m3, + r.created, + r.time, + u.nickName userNickName, + v.tradeMark vehicleTradeMark, + v.model vehicleModel, + v.numberPlate plateNumber, + IFNULL(s.name, am.name) agencyName + FROM route r + LEFT JOIN vehicle v ON v.id = r.vehicleFk + LEFT JOIN worker w ON w.id = r.workerFk + LEFT JOIN account.user u ON u.id = w.id + LEFT JOIN agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN agency a ON a.id = am.agencyFk + LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id + LEFT JOIN supplier s ON s.id = sa.supplierFk + WHERE r.id IN(?) diff --git a/print/templates/reports/driver-route/sql/tickets.sql b/print/templates/reports/driver-route/sql/tickets.sql index 9d548c2b3..1ffb4d623 100644 --- a/print/templates/reports/driver-route/sql/tickets.sql +++ b/print/templates/reports/driver-route/sql/tickets.sql @@ -1,43 +1,42 @@ -SELECT - t.nickname addressName, - t.packages, - t.priority, - t.id, - t.clientFk, - t.companyFk, - t.routeFk, - if(a.phone, a.phone, c.phone) AS phone, - if(a.mobile, a.mobile, c.mobile) AS mobile, - wh.name warehouseName, - a.city, - a.street, - a.postalCode, - LPAD(a.id, 5, '0') AS addressFk, - p.name province, - 0 AS import, - am.name ticketAgency, - tob.description, - u.nickName salesPersonName, - ipkg.itemPackingTypes -FROM route r - JOIN ticket t ON t.routeFk = r.id - LEFT JOIN address a ON a.id = t.addressFk - LEFT JOIN client c ON c.id = t.clientFk - LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE()) - LEFT JOIN account.user u ON u.id = w.id - LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 3 - LEFT JOIN province p ON a.provinceFk = p.id - LEFT JOIN warehouse wh ON wh.id = t.warehouseFk - LEFT JOIN agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN ( - SELECT t.id AS ticketFk, - GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes - FROM route r - JOIN ticket t ON t.routeFk = r.id - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - WHERE r.id IN (?) - GROUP BY t.id - ) ipkg ON ipkg.ticketFk = t.id -WHERE r.id IN (?) -ORDER BY t.priority, t.id; \ No newline at end of file +SELECT t.nickname addressName, + t.packages, + t.priority, + t.id, + t.clientFk, + t.companyFk, + t.routeFk, + if(a.phone, a.phone, c.phone) phone, + if(a.mobile, a.mobile, c.mobile) mobile, + wh.name warehouseName, + a.city, + a.street, + a.postalCode, + LPAD(a.id, 5, '0') addressFk, + p.name province, + 0 import, + am.name ticketAgency, + tob.description, + u.nickName salesPersonName, + ipkg.itemPackingTypes + FROM route r + JOIN ticket t ON t.routeFk = r.id + LEFT JOIN address a ON a.id = t.addressFk + LEFT JOIN client c ON c.id = t.clientFk + LEFT JOIN worker w ON w.id = client_getSalesPerson(t.clientFk, CURDATE()) + LEFT JOIN account.user u ON u.id = w.id + LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id AND tob.observationTypeFk = 3 + LEFT JOIN province p ON a.provinceFk = p.id + LEFT JOIN warehouse wh ON wh.id = t.warehouseFk + LEFT JOIN agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN ( + SELECT t.id AS ticketFk, + GROUP_CONCAT(DISTINCT(i.itemPackingTypeFk)) AS itemPackingTypes + FROM route r + JOIN ticket t ON t.routeFk = r.id + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + WHERE r.id IN (?) + GROUP BY t.id + ) ipkg ON ipkg.ticketFk = t.id + WHERE r.id IN (?) + ORDER BY t.priority, t.id; \ No newline at end of file From 2a7807a4ab1ba55e900e2d22ff04320537345177 Mon Sep 17 00:00:00 2001 From: pablone Date: Thu, 4 Apr 2024 08:49:47 +0200 Subject: [PATCH 50/62] remove: refs #7145 dev code --- print/templates/reports/driver-route/assets/css/style.css | 4 ---- print/templates/reports/driver-route/driver-route.html | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/print/templates/reports/driver-route/assets/css/style.css b/print/templates/reports/driver-route/assets/css/style.css index 0f08f6493..02d6778ce 100644 --- a/print/templates/reports/driver-route/assets/css/style.css +++ b/print/templates/reports/driver-route/assets/css/style.css @@ -4,10 +4,6 @@ td{ text-overflow: ellipsis; } -/* .text-field{ - text-overflow: ellipsis; -} */ - h1 { text-align: center; } diff --git a/print/templates/reports/driver-route/driver-route.html b/print/templates/reports/driver-route/driver-route.html index 1391f621c..109afd2f5 100644 --- a/print/templates/reports/driver-route/driver-route.html +++ b/print/templates/reports/driver-route/driver-route.html @@ -103,7 +103,7 @@
{{$t('street')}}{{$t('street')}} {{ticket.street}} {{$t('postcode')}} {{ticket.postalCode}}
- + From 0f8b80d533477dd0def25a2313cbd8136df5e237 Mon Sep 17 00:00:00 2001 From: jcasado Date: Thu, 4 Apr 2024 09:40:43 +0200 Subject: [PATCH 51/62] refs #6816 remove tittle MicroSip --- front/core/components/link-phone/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/front/core/components/link-phone/index.html b/front/core/components/link-phone/index.html index 2789ab75c..58724b0a1 100644 --- a/front/core/components/link-phone/index.html +++ b/front/core/components/link-phone/index.html @@ -5,7 +5,6 @@ flat round icon="phone" - title="MicroSIP" ng-click="$event.stopPropagation();" > From c685000b470b9a53f60719bd344bd0236bfdd44a Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 4 Apr 2024 10:13:56 +0200 Subject: [PATCH 52/62] hotfix: refs #6930 Rollback tokenMultimedia --- back/methods/dms/downloadFile.js | 2 +- back/methods/docuware/download.js | 2 +- back/methods/image/download.js | 2 +- front/core/services/token.js | 3 ++- modules/claim/back/methods/claim/claimPickupPdf.js | 2 +- modules/claim/back/methods/claim/downloadFile.js | 2 +- modules/client/back/methods/client/campaignMetricsPdf.js | 2 +- modules/entry/back/methods/entry/entryOrderPdf.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/download.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/downloadZip.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js | 2 +- modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js | 2 +- modules/item/back/methods/item-image-queue/download.js | 2 +- modules/route/back/methods/route/downloadCmrsZip.js | 2 +- modules/route/back/methods/route/downloadZip.js | 2 +- modules/route/back/methods/route/driverRoutePdf.js | 2 +- modules/supplier/back/methods/supplier/campaignMetricsPdf.js | 2 +- modules/ticket/back/methods/ticket/deliveryNoteCsv.js | 2 +- modules/ticket/back/methods/ticket/deliveryNotePdf.js | 2 +- modules/travel/back/methods/travel/extraCommunityPdf.js | 2 +- modules/worker/back/methods/worker-dms/downloadFile.js | 2 +- 22 files changed, 23 insertions(+), 22 deletions(-) diff --git a/back/methods/dms/downloadFile.js b/back/methods/dms/downloadFile.js index d64b15b70..6f2451505 100644 --- a/back/methods/dms/downloadFile.js +++ b/back/methods/dms/downloadFile.js @@ -30,7 +30,7 @@ module.exports = Self => { path: `/:id/downloadFile`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.downloadFile = async function(ctx, id) { diff --git a/back/methods/docuware/download.js b/back/methods/docuware/download.js index a1776cde5..4aa40197f 100644 --- a/back/methods/docuware/download.js +++ b/back/methods/docuware/download.js @@ -43,7 +43,7 @@ module.exports = Self => { path: `/:id/download`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.download = async function(id, fileCabinet, filter) { diff --git a/back/methods/image/download.js b/back/methods/image/download.js index 201e16164..9ac06f30b 100644 --- a/back/methods/image/download.js +++ b/back/methods/image/download.js @@ -48,7 +48,7 @@ module.exports = Self => { path: `/:collection/:size/:id/download`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.download = async function(ctx, collection, size, id) { diff --git a/front/core/services/token.js b/front/core/services/token.js index 125de6b9a..028ebd841 100644 --- a/front/core/services/token.js +++ b/front/core/services/token.js @@ -59,7 +59,8 @@ export default class Token { getStorage(storage) { this.token = storage.getItem('vnToken'); - this.tokenMultimedia = storage.getItem('vnTokenMultimedia'); + // Cambio realizado temporalmente + this.tokenMultimedia = this.token; // storage.getItem('vnTokenMultimedia'); if (!this.token) return; const created = storage.getItem('vnTokenCreated'); this.created = created && new Date(created); diff --git a/modules/claim/back/methods/claim/claimPickupPdf.js b/modules/claim/back/methods/claim/claimPickupPdf.js index 4b66bd418..390be33b9 100644 --- a/modules/claim/back/methods/claim/claimPickupPdf.js +++ b/modules/claim/back/methods/claim/claimPickupPdf.js @@ -35,7 +35,7 @@ module.exports = Self => { path: '/:id/claim-pickup-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.claimPickupPdf = (ctx, id) => Self.printReport(ctx, id, 'claim-pickup-order'); diff --git a/modules/claim/back/methods/claim/downloadFile.js b/modules/claim/back/methods/claim/downloadFile.js index 61784f39e..7e49708f5 100644 --- a/modules/claim/back/methods/claim/downloadFile.js +++ b/modules/claim/back/methods/claim/downloadFile.js @@ -33,7 +33,7 @@ module.exports = Self => { path: `/:id/downloadFile`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.downloadFile = async function(ctx, id) { diff --git a/modules/client/back/methods/client/campaignMetricsPdf.js b/modules/client/back/methods/client/campaignMetricsPdf.js index 20c35494e..14ae8646d 100644 --- a/modules/client/back/methods/client/campaignMetricsPdf.js +++ b/modules/client/back/methods/client/campaignMetricsPdf.js @@ -46,7 +46,7 @@ module.exports = Self => { path: '/:id/campaign-metrics-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'campaign-metrics'); diff --git a/modules/entry/back/methods/entry/entryOrderPdf.js b/modules/entry/back/methods/entry/entryOrderPdf.js index 93c1b6bd9..2f6489d3f 100644 --- a/modules/entry/back/methods/entry/entryOrderPdf.js +++ b/modules/entry/back/methods/entry/entryOrderPdf.js @@ -34,7 +34,7 @@ module.exports = Self => { path: '/:id/entry-order-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.entryOrderPdf = (ctx, id) => Self.printReport(ctx, id, 'entry-order'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/download.js b/modules/invoiceOut/back/methods/invoiceOut/download.js index cb71121d5..24fb9fde3 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/download.js +++ b/modules/invoiceOut/back/methods/invoiceOut/download.js @@ -32,7 +32,7 @@ module.exports = Self => { path: '/:id/download', verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.download = async function(ctx, id, options) { diff --git a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js index 4f2a8aab3..13305f6ed 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js +++ b/modules/invoiceOut/back/methods/invoiceOut/downloadZip.js @@ -32,7 +32,7 @@ module.exports = Self => { path: '/downloadZip', verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.downloadZip = async function(ctx, ids, options) { diff --git a/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js b/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js index 0b08aec6d..a2d877189 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js +++ b/modules/invoiceOut/back/methods/invoiceOut/exportationPdf.js @@ -35,7 +35,7 @@ module.exports = Self => { path: '/:reference/exportation-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.exportationPdf = (ctx, reference) => Self.printReport(ctx, reference, 'exportation'); diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js index 6822e5a23..6208d0625 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceCsv.js @@ -38,7 +38,7 @@ module.exports = Self => { path: '/:reference/invoice-csv', verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.invoiceCsv = async reference => { diff --git a/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js b/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js index 6ac56b68c..6970bf368 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js +++ b/modules/invoiceOut/back/methods/invoiceOut/negativeBasesCsv.js @@ -40,7 +40,7 @@ module.exports = Self => { path: '/negativeBasesCsv', verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.negativeBasesCsv = async(ctx, options) => { diff --git a/modules/item/back/methods/item-image-queue/download.js b/modules/item/back/methods/item-image-queue/download.js index e1bc248ae..354771071 100644 --- a/modules/item/back/methods/item-image-queue/download.js +++ b/modules/item/back/methods/item-image-queue/download.js @@ -11,7 +11,7 @@ module.exports = Self => { path: `/download`, verb: 'POST', }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.download = async() => { diff --git a/modules/route/back/methods/route/downloadCmrsZip.js b/modules/route/back/methods/route/downloadCmrsZip.js index 43f6e9648..1ef25d175 100644 --- a/modules/route/back/methods/route/downloadCmrsZip.js +++ b/modules/route/back/methods/route/downloadCmrsZip.js @@ -30,7 +30,7 @@ module.exports = Self => { path: '/downloadCmrsZip', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.downloadCmrsZip = async function(ctx, ids, options) { diff --git a/modules/route/back/methods/route/downloadZip.js b/modules/route/back/methods/route/downloadZip.js index d7fc30aa3..b226cf7f8 100644 --- a/modules/route/back/methods/route/downloadZip.js +++ b/modules/route/back/methods/route/downloadZip.js @@ -30,7 +30,7 @@ module.exports = Self => { path: '/downloadZip', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.downloadZip = async function(ctx, id, options) { diff --git a/modules/route/back/methods/route/driverRoutePdf.js b/modules/route/back/methods/route/driverRoutePdf.js index e7b4dee17..9469356bb 100644 --- a/modules/route/back/methods/route/driverRoutePdf.js +++ b/modules/route/back/methods/route/driverRoutePdf.js @@ -35,7 +35,7 @@ module.exports = Self => { path: '/:id/driver-route-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); diff --git a/modules/supplier/back/methods/supplier/campaignMetricsPdf.js b/modules/supplier/back/methods/supplier/campaignMetricsPdf.js index 51c626e69..55767e9c6 100644 --- a/modules/supplier/back/methods/supplier/campaignMetricsPdf.js +++ b/modules/supplier/back/methods/supplier/campaignMetricsPdf.js @@ -45,7 +45,7 @@ module.exports = Self => { path: '/:id/campaign-metrics-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + // accessScopes: ['read:multimedia'] }); Self.campaignMetricsPdf = (ctx, id) => Self.printReport(ctx, id, 'supplier-campaign-metrics'); diff --git a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js index 9fa3c183e..29a859842 100644 --- a/modules/ticket/back/methods/ticket/deliveryNoteCsv.js +++ b/modules/ticket/back/methods/ticket/deliveryNoteCsv.js @@ -38,7 +38,7 @@ module.exports = Self => { path: '/:id/delivery-note-csv', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.deliveryNoteCsv = async id => { diff --git a/modules/ticket/back/methods/ticket/deliveryNotePdf.js b/modules/ticket/back/methods/ticket/deliveryNotePdf.js index adc9e4435..6155ff81e 100644 --- a/modules/ticket/back/methods/ticket/deliveryNotePdf.js +++ b/modules/ticket/back/methods/ticket/deliveryNotePdf.js @@ -42,7 +42,7 @@ module.exports = Self => { path: '/:id/delivery-note-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.deliveryNotePdf = (ctx, id) => Self.printReport(ctx, id, 'delivery-note'); diff --git a/modules/travel/back/methods/travel/extraCommunityPdf.js b/modules/travel/back/methods/travel/extraCommunityPdf.js index 73748ac50..0c7f0a682 100644 --- a/modules/travel/back/methods/travel/extraCommunityPdf.js +++ b/modules/travel/back/methods/travel/extraCommunityPdf.js @@ -79,7 +79,7 @@ module.exports = Self => { path: '/extra-community-pdf', verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.extraCommunityPdf = ctx => Self.printReport(ctx, null, 'extra-community'); diff --git a/modules/worker/back/methods/worker-dms/downloadFile.js b/modules/worker/back/methods/worker-dms/downloadFile.js index 08fbcf924..871bbffde 100644 --- a/modules/worker/back/methods/worker-dms/downloadFile.js +++ b/modules/worker/back/methods/worker-dms/downloadFile.js @@ -30,7 +30,7 @@ module.exports = Self => { path: `/:id/downloadFile`, verb: 'GET' }, - accessScopes: ['read:multimedia'] + //accessScopes: ['read:multimedia'] }); Self.downloadFile = async function(ctx, id) { From 9423a2d04351b165ddde6c5bb93f133599212bdf Mon Sep 17 00:00:00 2001 From: sergiodt Date: Thu, 4 Apr 2024 10:38:55 +0200 Subject: [PATCH 53/62] refs #3520 hotFix: hasUncheckedTickets --- .../ticket/back/methods/ticket-collection/hasUncheckedTicket.js | 2 +- .../methods/ticket-collection/spec/hasUncheckedTicket.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js index 1ea522de6..43f6faa96 100644 --- a/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js +++ b/modules/ticket/back/methods/ticket-collection/hasUncheckedTicket.js @@ -35,6 +35,6 @@ module.exports = Self => { WHERE tc.ticketFk = ? AND s.order < s2.id LIMIT 1;`, [ticketFk], myOptions); - return result.length > 0 && result[0]['ticketFk'] > 0; + return result[0]?.ticketFk > 0 && result[0].ticketFk; }; }; diff --git a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js index ae7a8e6ee..a75784a23 100644 --- a/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js +++ b/modules/ticket/back/methods/ticket-collection/spec/hasUncheckedTicket.spec.js @@ -27,7 +27,7 @@ describe('ticketCollection hasUncheckedTicket()', () => { }, myOptions); const result = await models.TicketCollection.hasUncheckedTicket(ticketFk, myOptions); - expect(result).toBe(true); + expect(result).toBeTruthy(); await tx.rollback(); } catch (e) { await tx.rollback(); From 8702a6808c8bddb28be5ee3c402ec922320e06f8 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 4 Apr 2024 11:25:03 +0200 Subject: [PATCH 54/62] hotfix: #7024 Modified duaInvoiceInBooking --- db/routines/vn/procedures/duaInvoiceInBooking.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql index 26580907c..f95e836b1 100644 --- a/db/routines/vn/procedures/duaInvoiceInBooking.sql +++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql @@ -33,6 +33,7 @@ BEGIN ii.operated = IFNULL(ii.operated,d.operated), ii.issued = IFNULL(ii.issued,d.issued), ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isBooked = TRUE, e.isConfirmed = TRUE WHERE d.id = vDuaFk; From 980127937094b5d7b53e45acc5e6bb812b93b9a6 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 4 Apr 2024 13:28:29 +0200 Subject: [PATCH 55/62] refs #169673 item_getSimilar --- db/routines/vn/procedures/item_getSimilar.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/item_getSimilar.sql b/db/routines/vn/procedures/item_getSimilar.sql index a61898756..f79bed375 100644 --- a/db/routines/vn/procedures/item_getSimilar.sql +++ b/db/routines/vn/procedures/item_getSimilar.sql @@ -60,7 +60,11 @@ BEGIN (i.value8 <=> its.value8) match8, a.available, IFNULL(ip.counter, 0) `counter`, - IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity, + CASE + WHEN b.groupingMode = 1 THEN b.grouping + WHEN b.groupingMode = 2 THEN b.packing + ELSE 1 + END AS minQuantity, iss.visible located FROM vn.item i JOIN cache.available a ON a.item_id = i.id From dd9c7283c3af4d2db3e1d50cb918fc284446892d Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 4 Apr 2024 13:32:39 +0200 Subject: [PATCH 56/62] hotFix: handle mail error --- back/methods/osticket/sendToSupport.js | 2 +- modules/ticket/back/methods/ticket/closure.js | 4 ++-- print/core/email.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js index 135774919..e17093839 100644 --- a/back/methods/osticket/sendToSupport.js +++ b/back/methods/osticket/sendToSupport.js @@ -46,7 +46,7 @@ module.exports = Self => { html += `${data}:
${tryParse(additionalData[data])}
`; const subjectReason = httpRequest?.data?.error; - smtp.send({ + await smtp.send({ to: `${config.app.reportEmail}, ${emailUser.email}`, subject: '[Support-Salix] ' + diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 1d3077b9d..647a98d13 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -175,7 +175,7 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) { to: config.app.reportEmail, subject: '[API] Nightly ticket closure report', html: body, - }); + }).catch(err => console.error(err)); } async function invalidEmail(ticket) { @@ -206,6 +206,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) { to: ticket.salesPersonEmail, subject: 'No se ha podido enviar el albarán', html: body, - }); + }).catch(err => console.error(err)); } }; diff --git a/print/core/email.js b/print/core/email.js index 2d1ee42cf..5de13099a 100644 --- a/print/core/email.js +++ b/print/core/email.js @@ -88,7 +88,7 @@ class Email extends Component { force: options.force }; - return smtp.send(mailOptions); + return await smtp.send(mailOptions); } } From f5943e44451c0f034797ba26d41f8af927d62721 Mon Sep 17 00:00:00 2001 From: jcasado Date: Thu, 4 Apr 2024 13:57:23 +0200 Subject: [PATCH 57/62] refs #6324 remove column and dependencies --- db/dump/fixtures.before.sql | 13 +------------ db/myt.config.yml | 11 +++++++++++ db/package.json | 13 +++++++++++++ db/versions/10977-wheatFern/00-firstScript.sql | 2 ++ 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100755 db/myt.config.yml create mode 100644 db/package.json create mode 100644 db/versions/10977-wheatFern/00-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 1dad68b2c..4ed91e1c0 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3223,7 +3223,6 @@ INSERT INTO vn.buy packing = 20, `grouping` = 1, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3262,7 +3261,6 @@ INSERT INTO vn.buy packing = 40, `grouping` = 5, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3301,7 +3299,6 @@ INSERT INTO vn.buy packing = 10, `grouping` = 5, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3348,7 +3345,6 @@ INSERT INTO vn.buy packing = 20, `grouping` = 4, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3387,7 +3383,6 @@ INSERT INTO vn.buy packing = 20, `grouping` = 1, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3427,7 +3422,6 @@ INSERT INTO vn.buy packing = 200, `grouping` = 30, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3467,7 +3461,6 @@ INSERT INTO vn.buy packing = 500, `grouping` = 10, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3507,7 +3500,6 @@ INSERT INTO vn.buy packing = 300, `grouping` = 50, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3547,7 +3539,6 @@ INSERT INTO vn.buy packing = 50, `grouping` = 5, groupingMode = 1, - packageFk = 94, price1 = 1, price2 = 1, price3 = 1, @@ -3588,7 +3579,6 @@ INSERT vn.buy packing = 5, `grouping` = 2, groupingMode = 1, - packageFk = 94, price1 = 7, price2 = 7, price3 = 7, @@ -3628,7 +3618,6 @@ INSERT vn.buy packing = 100, `grouping` = 5, groupingMode = 1, - packageFk = 94, price1 = 7, price2 = 7, price3 = 7, @@ -3745,4 +3734,4 @@ INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,new INSERT INTO `vn`.`supplierDms`(`supplierFk`, `dmsFk`, `editorFk`) VALUES - (1, 10, 9); \ No newline at end of file + (1, 10, 9); diff --git a/db/myt.config.yml b/db/myt.config.yml new file mode 100755 index 000000000..3fe7ad02f --- /dev/null +++ b/db/myt.config.yml @@ -0,0 +1,11 @@ +code: my-db +schemas: + - myt + - my_db +fixtures: + myt: + - version + - versionLog + my_db: + - table1 + - table2 diff --git a/db/package.json b/db/package.json new file mode 100644 index 000000000..0cc0ed1d8 --- /dev/null +++ b/db/package.json @@ -0,0 +1,13 @@ +{ + "name": "my-db", + "version": "1.0.0", + "author": "Me", + "description": "My database project", + "license": "GPL-3.0", + "repository": { + "type": "git" + }, + "dependencies": { + "@verdnatura/myt": "^1.6.9" + } +} \ No newline at end of file diff --git a/db/versions/10977-wheatFern/00-firstScript.sql b/db/versions/10977-wheatFern/00-firstScript.sql new file mode 100644 index 000000000..53c1a4fa6 --- /dev/null +++ b/db/versions/10977-wheatFern/00-firstScript.sql @@ -0,0 +1,2 @@ +-- Place your SQL code here +ALTER TABLE vn.buy DROP COLUMN packageFk; From f9ef45f1d9f8536b840487f3d6339e89055c15f6 Mon Sep 17 00:00:00 2001 From: jcasado Date: Thu, 4 Apr 2024 14:01:30 +0200 Subject: [PATCH 58/62] refs #6324 remove doc --- db/myt.config.yml | 11 ----------- db/package.json | 13 ------------- 2 files changed, 24 deletions(-) delete mode 100755 db/myt.config.yml delete mode 100644 db/package.json diff --git a/db/myt.config.yml b/db/myt.config.yml deleted file mode 100755 index 3fe7ad02f..000000000 --- a/db/myt.config.yml +++ /dev/null @@ -1,11 +0,0 @@ -code: my-db -schemas: - - myt - - my_db -fixtures: - myt: - - version - - versionLog - my_db: - - table1 - - table2 diff --git a/db/package.json b/db/package.json deleted file mode 100644 index 0cc0ed1d8..000000000 --- a/db/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "my-db", - "version": "1.0.0", - "author": "Me", - "description": "My database project", - "license": "GPL-3.0", - "repository": { - "type": "git" - }, - "dependencies": { - "@verdnatura/myt": "^1.6.9" - } -} \ No newline at end of file From a6e4bdd7ac09b6d052420f911d9377f9849fe83e Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 4 Apr 2024 15:02:41 +0200 Subject: [PATCH 59/62] refs #7167 deploy: dump --- db/dump/.dump/data.sql | 41 +- db/dump/.dump/privileges.sql | 16 +- db/dump/.dump/structure.sql | 1903 +++++++++-------- db/dump/.dump/triggers.sql | 55 +- .../02_alias_create_and_basic_data.spec.js | 4 +- e2e/tests.js | 6 +- 6 files changed, 1120 insertions(+), 905 deletions(-) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 8a419f697..8fbab9e56 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,7 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('vn-database','10962','5411433e529d50d68b3a0675b1a0a6215ea931ca','2024-03-25 17:47:37','10969'); +INSERT INTO `version` VALUES ('vn-database','10970','20e4ab1d2c2256749c0f76ba85f660d39ec417a2','2024-04-04 13:36:31','10979'); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); @@ -673,14 +673,21 @@ INSERT INTO `versionLog` VALUES ('vn-database','10874','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10876','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10878','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10879','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:00',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10880','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10881','00-alterTableNotification.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10881','01-notification.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10882','00-vehicle.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10883','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10884','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10885','00-revokeUpdateClient.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:57',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10887','00-schemaAndUser.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10887','01-tables.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:33:50',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10888','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-16 07:39:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10889','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-23 09:55:56',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10890','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-22 08:33:01',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10891','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10892','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10893','00-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10896','01-financialProductType.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10896','02-flight.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:12:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10896','03-gastos_resumen.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 08:13:00',NULL,NULL); @@ -706,6 +713,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','10913','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10914','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-28 11:52:54',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10915','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:26',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10918','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:01:27',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10919','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10922','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-02-29 13:44:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10923','00-createParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10923','01-aclParkingLog.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL); @@ -714,13 +722,32 @@ INSERT INTO `versionLog` VALUES ('vn-database','10925','00-firstScript.sql','jen INSERT INTO `versionLog` VALUES ('vn-database','10926','00-refactorClaimState.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:51',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10928','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:15:52',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10929','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-21 07:16:19',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10932','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10940','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-06 16:48:18',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10941','00-restoreVn2008Jerarquia.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 09:36:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10942','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-07 10:24:45',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10943','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-07 10:29:57',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10946','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-03-08 07:56:17',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','00-account.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','01-bs.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','02-edi.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','03-hedera.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','04-pbx.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:54',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','05-sage.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','06-salix.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','06-srt.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','07-util.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:55',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:56',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10953','08-vn2.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10956','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10957','00-aclTicketClone.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10959','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-18 13:32:25',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10962','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-03-25 08:27:35',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10968','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10969','00-aclSupplierDms.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10970','00-specialPrice.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-04 07:34:58',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10975','00-action.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:03:46',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','10975','01-expeditionFk.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2024-04-03 12:04:52',NULL,NULL); /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; @@ -736,7 +763,7 @@ INSERT INTO `role` VALUES (2,'customer','Privilegios básicos de un cliente',1,' INSERT INTO `role` VALUES (3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); INSERT INTO `role` VALUES (5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); INSERT INTO `role` VALUES (6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); -INSERT INTO `role` VALUES (9,'developer','Desarrolladores del sistema',1,'2017-05-19 09:04:58','2017-05-19 09:04:58',NULL); +INSERT INTO `role` VALUES (9,'developer','Desarrollador raso',1,'2017-05-19 09:04:58','2024-03-27 14:14:58',1437); INSERT INTO `role` VALUES (11,'account','Privilegios relacionados con el login',0,'2017-05-19 09:04:58','2017-09-20 19:06:35',NULL); INSERT INTO `role` VALUES (13,'teamBoss','Jefe de equipo/departamento',1,'2017-05-19 09:04:58','2021-06-30 15:29:30',NULL); INSERT INTO `role` VALUES (15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 09:04:58','2018-02-12 11:50:10',NULL); @@ -1309,7 +1336,7 @@ INSERT INTO `ACL` VALUES (274,'InvoiceInLog','*','READ','ALLOW','ROLE','administ INSERT INTO `ACL` VALUES (275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'); INSERT INTO `ACL` VALUES (278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'); -INSERT INTO `ACL` VALUES (279,'MailAlias','*','*','ALLOW','ROLE','marketing'); +INSERT INTO `ACL` VALUES (279,'MailAlias','*','READ','ALLOW','ROLE','marketing'); INSERT INTO `ACL` VALUES (283,'EntryObservation','*','*','ALLOW','ROLE','buyer'); INSERT INTO `ACL` VALUES (284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'); INSERT INTO `ACL` VALUES (285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'); @@ -1777,7 +1804,7 @@ INSERT INTO `ACL` VALUES (804,'DeviceProduction','*','READ','ALLOW','ROLE','empl INSERT INTO `ACL` VALUES (805,'Collection','assign','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (806,'ExpeditionPallet','getPallet','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (807,'MachineWorker','updateInTime','WRITE','ALLOW','ROLE','production'); -INSERT INTO `ACL` VALUES (808,'MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','production'); +INSERT INTO `ACL` VALUES (808,'MobileAppVersionControl','getVersion','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (809,'SaleTracking','delete','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (810,'SaleTracking','updateTracking','WRITE','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (811,'SaleTracking','setPicked','WRITE','ALLOW','ROLE','production'); @@ -1789,6 +1816,10 @@ INSERT INTO `ACL` VALUES (816,'WorkerActivity','*','*','ALLOW','ROLE','productio INSERT INTO `ACL` VALUES (817,'ParkingLog','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (818,'ExpeditionPallet','*','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (819,'Ticket','addSaleByCode','WRITE','ALLOW','ROLE','production'); +INSERT INTO `ACL` VALUES (820,'TicketCollection','*','READ','ALLOW','ROLE','production'); +INSERT INTO `ACL` VALUES (821,'Ticket','clone','WRITE','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (822,'SupplierDms','*','*','ALLOW','ROLE','employee'); +INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','itManagement'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); @@ -2492,7 +2523,7 @@ USE `cache`; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; INSERT INTO `cache` VALUES (1,'equalizator','00:19:00'); -INSERT INTO `cache` VALUES (2,'available','00:06:00'); +INSERT INTO `cache` VALUES (2,'available','00:01:00'); INSERT INTO `cache` VALUES (3,'stock','00:30:00'); INSERT INTO `cache` VALUES (4,'last_buy','23:59:00'); INSERT INTO `cache` VALUES (5,'weekly_sales','12:00:00'); diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 3aea52588..8293cc74c 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -45,6 +45,7 @@ INSERT IGNORE INTO `db` VALUES ('','account','salix','Y','Y','Y','Y','N','N','N INSERT IGNORE INTO `db` VALUES ('','mysql','salix','Y','N','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','psico','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','geo','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); +INSERT IGNORE INTO `db` VALUES ('','floranet','developer','Y','Y','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','tmp','guest','Y','Y','Y','Y','N','Y','N','N','N','N','Y','N','N','N','N','N','N','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','util','salix','Y','Y','Y','Y','N','N','N','N','N','N','Y','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','dipole','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); @@ -77,6 +78,7 @@ INSERT IGNORE INTO `db` VALUES ('','bi','developer','Y','Y','Y','Y','N','N','N' INSERT IGNORE INTO `db` VALUES ('','util','grafana','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','Y','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','mysql','developerBoss','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'); INSERT IGNORE INTO `db` VALUES ('','rfid','developerBoss','Y','Y','Y','Y','N','N','Y','N','N','N','N','N','N','N','N','N','Y','N','N','N'); +INSERT IGNORE INTO `db` VALUES ('','floranet','floranet','N','N','N','N','N','N','N','N','N','N','Y','Y','N','N','N','N','Y','N','N','N'); /*!40000 ALTER TABLE `db` ENABLE KEYS */; /*!40000 ALTER TABLE `tables_priv` DISABLE KEYS */; @@ -777,7 +779,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','logistic','PreciosEspecia INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','movingState','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferType','alexm@%','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferState','alexm@%','0000-00-00 00:00:00','Select',''); -INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicle','alexm@%','0000-00-00 00:00:00','Update',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','financial','vehicle','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','buffer','alexm@%','0000-00-00 00:00:00','Select,Insert,Update',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','bufferGroup','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); INSERT IGNORE INTO `tables_priv` VALUES ('','srt','maintenance','lastRFID','alexm@%','0000-00-00 00:00:00','Select',''); @@ -1373,6 +1375,9 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','administrative','accounting', INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','accounting','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','workerActivity','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert',''); INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDetail','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','deliveryBoss','vehicleState','jgallego@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','srt','grafana','expeditionState','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','specialPrice','jgallego@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; @@ -1657,9 +1662,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','account','guest','myUser_checkLogin INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','lang','FUNCTION','juan@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','grafana','firstdayofmonth','FUNCTION','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','financial','account_conciliacion_add','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','logistic','add_awb_component','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','claimManager','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','productionAssi','agencyModeImbalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','buy_getVolumeByEntry','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','entry_moveNotPrinted','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','buy_getVolume','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); @@ -1686,7 +1689,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','VN_CURDATE','FUNCTIO INSERT IGNORE INTO `procs_priv` VALUES ('','vn','marketingBoss','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','clientTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','client_checkBalance','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','addressTaxArea','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','absoluteInventoryHistory','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesPerson','client_getSalesPersonByTicket','FUNCTION','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','pbx','developer','clientFromPhone','FUNCTION','juan@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','production','log_addWithUser','PROCEDURE','juan@db-proxy2.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1694,6 +1697,7 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_ad INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_delete','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','adminBoss','balanceNestTree_move','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','financial','company_getSuppliersDebt','PROCEDURE','jgallego@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); +INSERT IGNORE INTO `procs_priv` VALUES ('','vn','buyer','multipleInventoryHistory','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','bi','salesAssistant','defaultersFromDate','PROCEDURE','juan@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updatepacking','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','buy_updategrouping','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); @@ -1712,8 +1716,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','duaInvoiceInB INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','itemshelvinglog_get','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','production','expedition_getstate','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','srt','production','expedition_scan','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_absoluto','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','historico_multiple','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','client_getDebt','PROCEDURE','guillermo@db-proxy2.static.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','util','guest','tx_commit','PROCEDURE','jenkins@db-proxy1.servers.dc.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','hrBoss','balance_create','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); @@ -1792,7 +1794,6 @@ INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','zone_getstate','PRO INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','worker_gethierarchy','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','workertimecontrol_weekcheckbreak','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','salesAssistant','ticket_split','PROCEDURE','alexm@db-proxy1.static.verdnatura.es','Execute','0000-00-00 00:00:00'); -INSERT IGNORE INTO `procs_priv` VALUES ('','vn2008','buyer','add_awb_component','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','employee','saletracking_new','PROCEDURE','alexm@pc325.algemesi.verdnatura.es','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','administrative','ticketnotinvoicedbyclient','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); INSERT IGNORE INTO `procs_priv` VALUES ('','vn','coolerBoss','workerjourney_replace','PROCEDURE','alexm@%','Execute','0000-00-00 00:00:00'); @@ -2047,6 +2048,7 @@ INSERT IGNORE INTO `global_priv` VALUES ('','entryEditor','{\"access\":0,\"vers INSERT IGNORE INTO `global_priv` VALUES ('','ext','{\"access\": 0, \"is_role\": true, \"version_id\": 100707}'); INSERT IGNORE INTO `global_priv` VALUES ('','financial','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); INSERT IGNORE INTO `global_priv` VALUES ('','financialBoss','{\"access\": 0, \"version_id\": 101106, \"is_role\": true}'); +INSERT IGNORE INTO `global_priv` VALUES ('','floranet','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','grafana','{\"access\":0,\"version_id\":101106,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','greenhouseBoss','{\"access\":0,\"version_id\":100707,\"is_role\":true}'); INSERT IGNORE INTO `global_priv` VALUES ('','guest','{\"access\": 0, \"max_questions\": 40000, \"max_updates\": 1000, \"max_connections\": 150000, \"max_user_connections\": 200, \"max_statement_time\": 0.000000, \"is_role\": true, \"version_id\": 101106}'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index db8d543b4..374dc9708 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -48,7 +48,7 @@ DROP TABLE IF EXISTS `accountConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `homedir` varchar(50) NOT NULL COMMENT 'The base folder for users home directory', `shell` varchar(50) NOT NULL COMMENT 'The default shell', `idBase` int(11) NOT NULL COMMENT 'Base id for Posix users and groups', @@ -56,7 +56,8 @@ CREATE TABLE `accountConfig` ( `max` smallint(6) NOT NULL COMMENT 'Maximum password age (seconds)', `warn` smallint(6) NOT NULL COMMENT 'Warn to change password when elapsed (seconds)', `inact` smallint(6) NOT NULL COMMENT 'Maximum inactivity time (seconds)', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `accountConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -113,13 +114,14 @@ DROP TABLE IF EXISTS `ldapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ldapConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `server` varchar(255) NOT NULL COMMENT 'The LDAP server access url', `rdn` varchar(255) NOT NULL COMMENT 'The LDAP user', `password` varchar(255) NOT NULL COMMENT 'The LDAP password', `userDn` varchar(255) DEFAULT NULL COMMENT 'The base DN for users', `groupDn` varchar(255) DEFAULT NULL COMMENT 'The base DN for groups', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `ldapConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='LDAP server configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -204,9 +206,10 @@ DROP TABLE IF EXISTS `mailConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `domain` varchar(255) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `mailConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -306,13 +309,14 @@ DROP TABLE IF EXISTS `roleConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `roleConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', + `id` int(10) unsigned NOT NULL, `mysqlPassword` varchar(255) NOT NULL COMMENT 'The password used for MySQL user roles, base64 encoded', `rolePrefix` char(2) NOT NULL, `userPrefix` char(2) DEFAULT NULL, `userHost` varchar(255) NOT NULL, `tplUser` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `roleConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Role configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -389,14 +393,15 @@ DROP TABLE IF EXISTS `sambaConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sambaConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `adDomain` varchar(255) NOT NULL COMMENT 'Active directory domain', `adController` varchar(255) NOT NULL COMMENT 'The hosname of domain controller', `adUser` varchar(255) DEFAULT NULL COMMENT 'Active directory user', `adPassword` varchar(255) DEFAULT NULL COMMENT 'Active directory password', `verifyCert` tinyint(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Whether to verify server certificate', `userDn` varchar(255) NOT NULL COMMENT 'Base DN for users without domain DN part', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `sambaConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for accounts'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -473,9 +478,10 @@ DROP TABLE IF EXISTS `userConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `userConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `loginKey` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `userConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -4562,9 +4568,10 @@ DROP TABLE IF EXISTS `nightTaskConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `nightTaskConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `logMail` varchar(255) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `nightTaskConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -4962,10 +4969,11 @@ DROP TABLE IF EXISTS `workerProductivityConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerProductivityConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `minSeconsPackager` int(11) DEFAULT NULL, `minSeconsItemPicker` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `workerProductivityConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9428,14 +9436,15 @@ DROP TABLE IF EXISTS `exchangeConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `exchangeConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `logMail` varchar(150) DEFAULT NULL COMMENT 'Mail where the log information is sent', `restrictToSenders` tinyint(4) NOT NULL COMMENT 'Whether to process mails only from known senders', `presaleFk` mediumint(8) unsigned DEFAULT NULL, `defaultKop` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `presale_id` (`presaleFk`), - CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `exchangeConfig_ibfk_1` FOREIGN KEY (`presaleFk`) REFERENCES `exchangeType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `exchangeConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9509,11 +9518,12 @@ DROP TABLE IF EXISTS `ftpConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ftpConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `host` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `user` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `password` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `ftpConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -9813,9 +9823,10 @@ DROP TABLE IF EXISTS `offerRefreshConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `offerRefreshConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `dayRange` int(10) unsigned DEFAULT NULL COMMENT 'range of days to update the photos of an article in seconds', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `offerRefreshConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -11774,7 +11785,7 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `defaultLang` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The default language if none is specified', `https` tinyint(3) unsigned NOT NULL COMMENT 'Wether to force de use of HTTPS', `cookieLife` smallint(5) unsigned NOT NULL COMMENT 'The cookies life, in days', @@ -11788,7 +11799,8 @@ CREATE TABLE `config` ( `pdfsDir` varchar(255) NOT NULL COMMENT 'Directory where PDFs are allocated', `dmsDir` varchar(255) DEFAULT NULL COMMENT 'Directory where documents are allocated', PRIMARY KEY (`id`), - KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.' + KEY `jwtkey_IX` (`jwtKey`) COMMENT 'Prueba de Ernesto 3.8.2020. MySQL se queja de no tener indices. Si, se que solo tiene un registro pero molesta para depurar otros.', + CONSTRAINT `config_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -11881,11 +11893,12 @@ DROP TABLE IF EXISTS `imageConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `imageConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', + `id` tinyint(3) unsigned NOT NULL, `maxSize` int(10) unsigned NOT NULL COMMENT 'Maximun size for uploaded images in MB', `useXsendfile` tinyint(4) NOT NULL COMMENT 'Whether to use the apache module XSendfile', `url` varchar(255) NOT NULL COMMENT 'Public URL where image are hosted', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `imageConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci COMMENT='Global image parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -11952,7 +11965,7 @@ DROP TABLE IF EXISTS `mailConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mailConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier', + `id` tinyint(3) unsigned NOT NULL, `host` varchar(255) NOT NULL DEFAULT 'localhost' COMMENT 'SMTP host', `port` smallint(6) NOT NULL DEFAULT 465 COMMENT 'SMTP port', `secure` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Wether to use a secure connection', @@ -11960,7 +11973,8 @@ CREATE TABLE `mailConfig` ( `senderName` varchar(75) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT 'The sender name', `user` varchar(50) DEFAULT NULL COMMENT 'SMTP user', `password` varchar(100) DEFAULT NULL COMMENT 'SMTP password, base64 encoded', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `mailConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -12407,7 +12421,7 @@ DROP TABLE IF EXISTS `orderConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `orderConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `employeeFk` int(10) unsigned NOT NULL, `defaultAgencyFk` int(11) DEFAULT NULL, `guestMethod` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, @@ -12423,7 +12437,8 @@ CREATE TABLE `orderConfig` ( CONSTRAINT `orderConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `vn`.`company` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_1` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, CONSTRAINT `orderConfig_ibfk_3` FOREIGN KEY (`guestAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) ON UPDATE CASCADE, - CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`) + CONSTRAINT `orderConfig_ibfk_4` FOREIGN KEY (`defaultAgencyFk`) REFERENCES `vn`.`agencyMode` (`id`), + CONSTRAINT `orderConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -12674,7 +12689,7 @@ DROP TABLE IF EXISTS `tpvConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `currency` smallint(5) unsigned NOT NULL, `terminal` tinyint(3) unsigned NOT NULL, `transactionType` tinyint(3) unsigned NOT NULL, @@ -12687,7 +12702,8 @@ CREATE TABLE `tpvConfig` ( `merchantUrl` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, PRIMARY KEY (`id`), KEY `employee_id` (`employeeFk`), - CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE + CONSTRAINT `employee_id` FOREIGN KEY (`employeeFk`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `tpvConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Virtual TPV parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -12713,14 +12729,15 @@ DROP TABLE IF EXISTS `tpvImapConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tpvImapConfig` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `id` tinyint(3) unsigned NOT NULL, `host` varchar(150) NOT NULL, `user` varchar(50) NOT NULL, `pass` varchar(50) NOT NULL, `cleanPeriod` varchar(15) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `successFolder` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `errorFolder` varchar(150) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `tpvImapConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='IMAP configuration parameters for virtual TPV'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -13090,7 +13107,7 @@ BEGIN WHERE c.available > 0 GROUP BY c.item_id; - CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode); + CALL vn.catalog_calculate(vDelivery, vAddress, vAgencyMode, FALSE); DROP TEMPORARY TABLE tmp.item; END ;; @@ -13194,7 +13211,7 @@ BEGIN ENGINE = MEMORY SELECT vSelf itemFk; - CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); + CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE); SELECT l.warehouseFk, w.name warehouse, p.`grouping`, p.price, p.rate, l.available @@ -14370,7 +14387,7 @@ BEGIN WHERE orderFk = vSelf GROUP BY itemFk; - CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); + CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE); DROP TEMPORARY TABLE tmp.item; END ;; @@ -14452,7 +14469,7 @@ BEGIN FROM `order` WHERE id = vSelf; - CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode); + CALL vn.catalog_calculate(vDate, vAddress, vAgencyMode, FALSE); IF account.myUser_getName() = 'visitor' THEN UPDATE tmp.ticketCalculateItem @@ -16137,10 +16154,11 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `sundayFestive` tinyint(4) NOT NULL, `countryPrefix` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `config_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -16183,13 +16201,14 @@ DROP TABLE IF EXISTS `followmeConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `followmeConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `music` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `context` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `takeCall` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `declineCall` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `timeout` int(11) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `followmeConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -16400,7 +16419,7 @@ DROP TABLE IF EXISTS `sipConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sipConfig` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `id` mediumint(8) unsigned NOT NULL, `host` varchar(40) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL, `deny` varchar(95) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, `permit` varchar(95) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, @@ -16421,7 +16440,8 @@ CREATE TABLE `sipConfig` ( `disallow` varchar(100) DEFAULT 'all', `allow` varchar(100) DEFAULT 'g729;ilbc;gsm;ulaw;alaw', `qualify` enum('yes','no') DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `sipConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Default values for SIP accounts'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -17431,13 +17451,14 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `pendingTaxAccount` varchar(100) DEFAULT NULL COMMENT 'Cuenta contable IVA pendiente', `nontaxableTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Operaciones exentas', `pendingServiceTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Import. bienes y serv. corrientes pdte. liquidar', `definitiveExportTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Exportaciones definitivas', `shipmentTransactionTypeFk` tinyint(4) DEFAULT NULL COMMENT 'Transacción Envíos definitivos a Canarias, Ceuta y Melilla', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `config_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19487,11 +19508,12 @@ DROP TABLE IF EXISTS `accessTokenConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accessTokenConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `renewPeriod` int(10) unsigned DEFAULT NULL, `courtesyTime` int(10) unsigned DEFAULT NULL, `renewInterval` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `accessTokenConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19563,10 +19585,11 @@ DROP TABLE IF EXISTS `printConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `printConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `itRecipient` varchar(50) DEFAULT NULL COMMENT 'IT recipients for report mailing', `incidencesEmail` varchar(50) DEFAULT NULL COMMENT 'CAU destinatary email', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `printConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Print service config'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19858,7 +19881,7 @@ CREATE TABLE `config` ( `bufferWidthMargin` int(11) NOT NULL DEFAULT 100 COMMENT 'margen mínimo para que una caja pueda entrar en un buffer', `bufferDefault` int(11) NOT NULL DEFAULT 26 COMMENT 'buffer por defecto si no se encuentra otro', `bufferLength` int(11) NOT NULL DEFAULT 13000 COMMENT 'Longitud de los buffers, en mm', - `id` int(11) NOT NULL DEFAULT 1, + `id` int(10) unsigned NOT NULL, `maxBoxesInBuffer` int(11) NOT NULL DEFAULT 8 COMMENT 'max numero de cajas por buffer para declararlo full', `isEnteringBlocked` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'bloquea la entrada de nuevas cajas al sorter', `isAuto` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'deja el sorter en auto por un buffer', @@ -19876,7 +19899,8 @@ CREATE TABLE `config` ( `isBalanced` tinyint(1) NOT NULL DEFAULT 1, `testMode` tinyint(1) NOT NULL DEFAULT 0, `isAllowedUnloading` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Permite que se pueda cambiar el mode de los buffers a UNLOADING', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `config_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -19959,6 +19983,8 @@ CREATE TABLE `expeditionLog` ( PRIMARY KEY (`id`), KEY `expeditionLog_FK_1` (`bufferFk`), KEY `expeditionLog_FK_2` (`antennaFk`), + KEY `expeditionLog_action_IDX` (`action`) USING BTREE, + KEY `expeditionLog_expeditionFk_IDX` (`expeditionFk`) USING BTREE, CONSTRAINT `expeditionLog_FK_1` FOREIGN KEY (`bufferFk`) REFERENCES `buffer` (`id`) ON UPDATE CASCADE, CONSTRAINT `expeditionLog_FK_2` FOREIGN KEY (`antennaFk`) REFERENCES `antenna` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; @@ -24422,7 +24448,7 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `dbVersion` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The current database version', `hasTriggersDisabled` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Defines if triggers are disabled', `environment` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'The current Database environment', @@ -24430,7 +24456,8 @@ CREATE TABLE `config` ( `mockUtcTime` datetime DEFAULT NULL, `mockTime` datetime DEFAULT NULL, `mockEnabled` tinyint(3) unsigned NOT NULL DEFAULT 0, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `config_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration table'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -24494,7 +24521,7 @@ DROP TABLE IF EXISTS `notification`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `notification` ( - `id` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `description` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), @@ -24527,9 +24554,10 @@ DROP TABLE IF EXISTS `notificationConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `notificationConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `cleanDays` mediumint(9) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `notificationConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -24601,9 +24629,10 @@ DROP TABLE IF EXISTS `versionConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `versionConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `realm` varchar(16) DEFAULT NULL COMMENT 'Data set on which the project runs', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `versionConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -26608,10 +26637,11 @@ DROP TABLE IF EXISTS `accountingConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `accountingConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `minDate` date NOT NULL, `maxDate` date NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `accountingConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27041,12 +27071,13 @@ DROP TABLE IF EXISTS `auctionConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `auctionConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `conversionCoefficient` double NOT NULL DEFAULT 1 COMMENT 'value used to calculate the used space of an item in a container', `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT 7 COMMENT 'Default warehouse used for the calculation', PRIMARY KEY (`id`), KEY `auctionConfig_FK` (`warehouseFk`), - CONSTRAINT `auctionConfig_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) + CONSTRAINT `auctionConfig_FK` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`), + CONSTRAINT `auctionConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27058,13 +27089,14 @@ DROP TABLE IF EXISTS `autoRadioConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `autoRadioConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `password` varchar(45) DEFAULT NULL, `user` varchar(45) DEFAULT NULL, `url` varchar(75) DEFAULT NULL, `client` int(32) DEFAULT NULL, `center` varchar(2) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `autoRadioConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27371,10 +27403,11 @@ DROP TABLE IF EXISTS `bankEntityConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bankEntityConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `bicLength` tinyint(4) DEFAULT 11 COMMENT 'Tamaño del campo bic', `defaultBankId` int(11) NOT NULL DEFAULT 3117 COMMENT 'Id del banco por defecto', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `bankEntityConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27459,12 +27492,13 @@ DROP TABLE IF EXISTS `bionicConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `bionicConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `generalInflationCoeficient` double(10,2) NOT NULL, `minimumDensityVolumetricWeight` double(10,2) NOT NULL, `verdnaturaVolumeBox` int(11) NOT NULL, `itemCarryBox` int(11) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `bionicConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -27765,9 +27799,9 @@ CREATE TABLE `buy` ( `freightValue` decimal(10,3) NOT NULL DEFAULT 0.000, `isIgnored` tinyint(1) NOT NULL DEFAULT 0, `stickers` int(11) NOT NULL DEFAULT 0, - `packing` int(11) DEFAULT 0, + `packing` int(11) NOT NULL DEFAULT 1 CHECK (`packing` > 0), `grouping` smallint(5) unsigned NOT NULL DEFAULT 1, - `groupingMode` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=sin obligar 1=groping 2=packing', + `groupingMode` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=sin obligar 1=grouping 2=packing', `containerFk` smallint(5) unsigned DEFAULT NULL, `comissionValue` decimal(10,3) NOT NULL DEFAULT 0.000, `packageValue` decimal(10,3) NOT NULL DEFAULT 0.000, @@ -27789,6 +27823,7 @@ CREATE TABLE `buy` ( `itemOriginalFk` int(11) DEFAULT NULL COMMENT 'Item original de la entrada', `editorFk` int(10) unsigned DEFAULT NULL, `packageFk` varchar(10) GENERATED ALWAYS AS (`packagingFk`) VIRTUAL, + `buyerFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `CompresId_Trabajador` (`workerFk`), KEY `Id_Cubo` (`packagingFk`), @@ -27820,9 +27855,10 @@ DROP TABLE IF EXISTS `buyConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `buyConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `monthsAgo` int(11) NOT NULL DEFAULT 6 COMMENT 'Meses desde la última compra', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `buyConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28046,12 +28082,13 @@ DROP TABLE IF EXISTS `chatConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `chatConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `host` varchar(255) NOT NULL, `api` varchar(255) NOT NULL, `user` varchar(50) NOT NULL, `password` varchar(50) NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `chatConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28122,9 +28159,10 @@ DROP TABLE IF EXISTS `claimConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `claimConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `maxResponsibility` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `claimConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -28529,7 +28567,7 @@ DROP TABLE IF EXISTS `clientConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `clientConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `riskTolerance` int(11) DEFAULT NULL COMMENT 'Maximo riesgo de un cliente para preparar su pedido', `maxCreditRows` int(11) DEFAULT NULL COMMENT 'Máximo número de registros a mantener en la tabla clientCredit', `maxPriceIncreasingRatio` decimal(2,2) NOT NULL DEFAULT 0.25 COMMENT 'máximo recobro permitido', @@ -28544,7 +28582,8 @@ CREATE TABLE `clientConfig` ( KEY `clientNewConfigPayMethod_FK` (`defaultPayMethodFk`), KEY `clientNewConfigMandateType_FK` (`defaultMandateTypeFk`), CONSTRAINT `clientNewConfigMandateType_FK` FOREIGN KEY (`defaultMandateTypeFk`) REFERENCES `mandateType` (`id`), - CONSTRAINT `clientNewConfigPayMethod_FK` FOREIGN KEY (`defaultPayMethodFk`) REFERENCES `payMethod` (`id`) + CONSTRAINT `clientNewConfigPayMethod_FK` FOREIGN KEY (`defaultPayMethodFk`) REFERENCES `payMethod` (`id`), + CONSTRAINT `clientConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29174,7 +29213,7 @@ CREATE TABLE `company` ( `stamp` longblob DEFAULT NULL, `created` timestamp NOT NULL ON UPDATE current_timestamp(), `clientFk` int(11) DEFAULT NULL, - `sage200Company` int(2) DEFAULT NULL, + `sage200Company__` int(2) DEFAULT NULL COMMENT '@deprecated 06/03/2024', `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL COMMENT 'Cuenta por defecto para ingresos desde este pais', `isDefaulter` tinyint(4) NOT NULL DEFAULT 0, `companyGroupFk` int(11) NOT NULL DEFAULT 1 COMMENT 'usado para calcular los greuges ', @@ -29276,10 +29315,11 @@ DROP TABLE IF EXISTS `comparativeAddConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `comparativeAddConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `period` int(10) unsigned DEFAULT NULL COMMENT 'The number of periods to be regressed for insertion in vn.comparative', `week` int(10) unsigned DEFAULT NULL COMMENT 'The number of weeks to exceed for recalculating the last period', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `comparativeAddConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29291,12 +29331,13 @@ DROP TABLE IF EXISTS `comparativeConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `comparativeConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `defaultDayRange` int(10) unsigned DEFAULT NULL COMMENT 'Rango de días predeterminado si no se especifica', `weekRange` int(10) unsigned DEFAULT NULL COMMENT 'La cantidad de semanas que se restarán y sumarán', `maxDayRange` int(10) unsigned DEFAULT NULL COMMENT 'El rango máximo de días antes de utilizar el rango de días predeterminado', `minDayRange` int(10) unsigned DEFAULT NULL COMMENT 'El rango mínimo de días antes de utilizar el rango de días predeterminado', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `comparativeConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -29407,7 +29448,7 @@ DROP TABLE IF EXISTS `config`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `config` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `ochoa` int(10) unsigned NOT NULL, `invoiceOutFk` int(11) DEFAULT 0, `inventoried` datetime DEFAULT NULL, @@ -29446,7 +29487,8 @@ CREATE TABLE `config` ( `comparativeLastBuyScope` int(11) DEFAULT NULL COMMENT 'Rango en el que se busca la última entrada de un artículo', `mainWarehouseFk` smallint(6) unsigned NOT NULL DEFAULT 60, PRIMARY KEY (`id`), - KEY `fechainv_idx` (`inventoried`) + KEY `fechainv_idx` (`inventoried`), + CONSTRAINT `config_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -30166,10 +30208,11 @@ DROP TABLE IF EXISTS `deviceProductionConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `deviceProductionConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `isAllUsersallowed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Permite que cualquier usuario pueda loguearse', `isTractorHuntingMode` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Habilita el modo cazador para usuarios que no se han logeado un tractor para sacar', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `deviceProductionConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -30388,10 +30431,11 @@ DROP TABLE IF EXISTS `docuwareConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `docuwareConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `url` varchar(75) DEFAULT NULL, `cookie` varchar(1000) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `docuwareConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31719,7 +31763,7 @@ DROP TABLE IF EXISTS `floramondoConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `floramondoConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `nextLanded` datetime DEFAULT NULL, `warehouseInFk` smallint(6) unsigned DEFAULT NULL, `MaxLatestDeliveryHour` int(11) DEFAULT NULL, @@ -31729,7 +31773,8 @@ CREATE TABLE `floramondoConfig` ( `daysToKeepItem` int(4) DEFAULT NULL COMMENT 'Número de dias para mantener artículos', PRIMARY KEY (`id`), KEY `floramondoConfigWarehouseIn_idx` (`warehouseInFk`), - CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `floramondoConfigWarehouseInFk` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `floramondoConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31764,9 +31809,10 @@ DROP TABLE IF EXISTS `franceExpressConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `franceExpressConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `path` varchar(100) DEFAULT '\\\\server\\agencies\\franceexpress\\expeditions', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `franceExpressConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31860,7 +31906,7 @@ DROP TABLE IF EXISTS `glsConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `glsConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `service` int(1) DEFAULT NULL, `schedule` int(1) DEFAULT NULL, `token` varchar(45) DEFAULT NULL, @@ -31870,7 +31916,8 @@ CREATE TABLE `glsConfig` ( `refund` int(1) DEFAULT NULL, `weight` int(1) DEFAULT NULL, `density` int(11) NOT NULL DEFAULT 42, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `glsConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -31933,12 +31980,13 @@ DROP TABLE IF EXISTS `greugeConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `greugeConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `freightPickUpPrice` decimal(10,2) NOT NULL, `yearsToDelete` int(11) DEFAULT NULL, `maxPercentToWrong` decimal(10,2) DEFAULT NULL COMMENT 'Porcentaje del precio del ticket que es considerado error', `lastNotifyCheck` timestamp NULL DEFAULT NULL COMMENT 'Última ejecución del procedimiento que revisa los greuges anormales', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `greugeConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32149,7 +32197,7 @@ DROP TABLE IF EXISTS `inventoryConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `inventoryConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `maxRecentInventories` int(11) DEFAULT NULL COMMENT 'The maximum number of recent inventories to retain without deletion', `daysInPastForInventory` int(11) DEFAULT NULL COMMENT 'The number of days in the past to consider for inventory calculations', `warehouseOutFk` smallint(6) unsigned DEFAULT NULL COMMENT 'The identifier for the inventory output warehouse', @@ -32161,7 +32209,8 @@ CREATE TABLE `inventoryConfig` ( KEY `inventoryConfig_agencyMode_FK` (`agencyModeFk`), CONSTRAINT `inventoryConfig_agencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), CONSTRAINT `inventoryConfig_supplier_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`), - CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) + CONSTRAINT `inventoryConfig_warehouse_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`), + CONSTRAINT `inventoryConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32340,7 +32389,7 @@ DROP TABLE IF EXISTS `invoiceInConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceInConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `retentionRate` int(3) NOT NULL, `retentionName` varchar(25) NOT NULL, `sageWithholdingFk` smallint(6) NOT NULL, @@ -32348,7 +32397,8 @@ CREATE TABLE `invoiceInConfig` ( `taxRowLimit` int(11) DEFAULT 4 COMMENT 'Número máximo de líneas de IVA que puede tener una factura', PRIMARY KEY (`id`), KEY `invoiceInConfig_sageWithholdingFk` (`sageWithholdingFk`), - CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `invoiceInConfig_sageWithholdingFk` FOREIGN KEY (`sageWithholdingFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `invoiceInConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32621,10 +32671,11 @@ DROP TABLE IF EXISTS `invoiceOutConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `invoiceOutConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `parallelism` int(10) unsigned NOT NULL DEFAULT 1, `refLen` tinyint(3) unsigned NOT NULL DEFAULT 5 COMMENT 'Invoice reference identifier length', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `invoiceOutConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32972,7 +33023,7 @@ DROP TABLE IF EXISTS `itemConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `itemConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `isItemTagTriggerDisabled` tinyint(1) NOT NULL DEFAULT 1, `monthToDeactivate` int(3) NOT NULL DEFAULT 24, `wasteRecipients` varchar(50) NOT NULL COMMENT 'Weekly waste report schedule recipients', @@ -32983,7 +33034,8 @@ CREATE TABLE `itemConfig` ( `downloadMaxAttempts` tinyint(3) DEFAULT NULL COMMENT 'Intentos máximos para que se borre', PRIMARY KEY (`id`), KEY `itemConfig_FK` (`defaultTag`), - CONSTRAINT `itemConfig_FK` FOREIGN KEY (`defaultTag`) REFERENCES `tag` (`id`) + CONSTRAINT `itemConfig_FK` FOREIGN KEY (`defaultTag`) REFERENCES `tag` (`id`), + CONSTRAINT `itemConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -33287,7 +33339,7 @@ CREATE TABLE `itemShelving` ( `visible` int(11) NOT NULL DEFAULT 0, `created` timestamp NOT NULL DEFAULT current_timestamp(), `grouping` smallint(5) unsigned DEFAULT NULL, - `packing` int(11) unsigned DEFAULT NULL, + `packing` int(11) NOT NULL DEFAULT 1 CHECK (`packing` > 0), `packagingFk` varchar(10) DEFAULT NULL, `userFk` int(10) unsigned DEFAULT NULL, `isChecked` tinyint(1) DEFAULT NULL COMMENT 'Este valor cambia al escanear un carro. True: Existe. False: Nuevo. Null: No escaneado', @@ -34024,9 +34076,10 @@ DROP TABLE IF EXISTS `machineWorkerConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `machineWorkerConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `maxHours` smallint(5) unsigned NOT NULL COMMENT 'Indicates how many hours a user record is reviewed to update or insert', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `machineWorkerConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -34174,11 +34227,12 @@ DROP TABLE IF EXISTS `mdbConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mdbConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `issueTrackerUrl` varchar(255) NOT NULL, `issueNumberRegex` varchar(255) NOT NULL, `chatDestination` varchar(255) NOT NULL COMMENT 'User (@) or channel (#) to send the message', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `mdbConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Global configuration parameters for Access'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -34401,13 +34455,14 @@ DROP TABLE IF EXISTS `mrwConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `mrwConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `url` varchar(100) DEFAULT NULL, `user` varchar(100) DEFAULT NULL, `password` varchar(100) DEFAULT NULL, `franchiseCode` varchar(100) DEFAULT NULL, `subscriberCode` varchar(100) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `mrwConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -34668,7 +34723,7 @@ DROP TABLE IF EXISTS `osTicketConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `osTicketConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `host` varchar(100) DEFAULT NULL, `user` varchar(100) DEFAULT NULL, `password` varchar(100) DEFAULT NULL, @@ -34683,7 +34738,8 @@ CREATE TABLE `osTicketConfig` ( `responseType` varchar(100) DEFAULT NULL, `fromEmailId` int(11) DEFAULT NULL, `replyTo` varchar(100) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `osTicketConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -34800,7 +34856,7 @@ DROP TABLE IF EXISTS `packagingConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `packagingConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `upperGap` int(11) NOT NULL, `previousPreparationMinimumSize` int(11) NOT NULL, `defaultConveyorBuildingClass` int(11) NOT NULL, @@ -34813,7 +34869,8 @@ CREATE TABLE `packagingConfig` ( KEY `packagingConfig_FK` (`defaultSmallPackageFk`), KEY `packagingConfig_FK_1` (`defaultBigPackageFk`), CONSTRAINT `packagingConfig_FK` FOREIGN KEY (`defaultSmallPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, - CONSTRAINT `packagingConfig_FK_1` FOREIGN KEY (`defaultBigPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE + CONSTRAINT `packagingConfig_FK_1` FOREIGN KEY (`defaultBigPackageFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, + CONSTRAINT `packagingConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -34939,12 +34996,13 @@ DROP TABLE IF EXISTS `packingSiteConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `packingSiteConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `shinobiUrl` varchar(255) NOT NULL, `shinobiToken` varchar(255) NOT NULL, `shinobiGroupKey` varchar(255) NOT NULL, `avgBoxingTime` int(3) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `packingSiteConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35769,7 +35827,7 @@ CREATE TABLE `productionConfig` ( `ticketTrolleyMax` int(10) unsigned NOT NULL DEFAULT 4 COMMENT 'numero máximo de tickets por carro para asignar baldas en una colección', `rookieDays` int(11) NOT NULL DEFAULT 3 COMMENT 'dias en que se cuida con especial cuidado los pedidos de un cliente por ser nuevo o recuperado', `notBuyingMonths` int(11) NOT NULL DEFAULT 3 COMMENT 'numero de meses que han de pasar desde su ultima compra para considerar nueva la siguiente compra', - `id` int(11) NOT NULL DEFAULT 1, + `id` int(10) unsigned NOT NULL, `isZoneClosedByExpeditionActivated` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'activa el procedimiento vn.zone_getClosed', `maxNotReadyCollections` int(11) NOT NULL DEFAULT 5, `minTicketsToCloseZone` int(11) DEFAULT 15 COMMENT 'mínimo numero de tickets que deben de tener expediciones para cerrar una zona', @@ -35794,7 +35852,8 @@ CREATE TABLE `productionConfig` ( KEY `productionConfig_FK_2` (`addressSelfConsumptionFk`), CONSTRAINT `productionConfig_FK` FOREIGN KEY (`shortageAddressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, CONSTRAINT `productionConfig_FK_1` FOREIGN KEY (`clientSelfConsumptionFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE + CONSTRAINT `productionConfig_FK_2` FOREIGN KEY (`addressSelfConsumptionFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, + CONSTRAINT `productionConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -35861,12 +35920,10 @@ DROP TABLE IF EXISTS `professionalCategory`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `professionalCategory` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL, - `level` int(11) unsigned DEFAULT NULL, - `dayBreak` int(11) unsigned DEFAULT NULL, + `description` varchar(50) NOT NULL, `code` varchar(25) DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `prefessionalCategory_UN` (`name`), + UNIQUE KEY `prefessionalCategory_UN` (`description`), UNIQUE KEY `code` (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36111,6 +36168,23 @@ CREATE TABLE `punchState` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Table for storing punches that have cars with errors'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `quality` +-- + +DROP TABLE IF EXISTS `quality`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `quality` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + `isVisible` tinyint(1) NOT NULL DEFAULT 1, + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Valores usados en el tag calidad'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `queuePriority` -- @@ -36171,12 +36245,13 @@ DROP TABLE IF EXISTS `rateConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `rateConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `rate0` int(11) DEFAULT NULL, `rate1` int(11) DEFAULT NULL, `rate2` int(11) DEFAULT NULL, `rate3` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `rateConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36636,7 +36711,8 @@ CREATE TABLE `routeConfig` ( `truckerBusinessProfessionalCategoryFk` int(11) NOT NULL DEFAULT 42, PRIMARY KEY (`id`), KEY `routeConfigCompany_Fk` (`defaultCompanyFk`), - CONSTRAINT `routeConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`) + CONSTRAINT `routeConfigCompany_Fk` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`), + CONSTRAINT `routeConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37301,13 +37377,14 @@ DROP TABLE IF EXISTS `salespersonConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `salespersonConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `manaMaxRate` decimal(3,2) DEFAULT 0.05 COMMENT 'Valor máximo a recficar en una línea por el maná de un comercial', `manaMinRate` decimal(3,2) DEFAULT -0.05 COMMENT 'Valor mínimo a recficar en una línea por el maná de un comercial', `manaDateFrom` date NOT NULL DEFAULT '2023-01-01' COMMENT 'first date to count mana', `manaFromDays` int(11) NOT NULL DEFAULT 90 COMMENT 'Range of days from mana calculation', `manaToDays` int(11) NOT NULL DEFAULT 30 COMMENT 'Range of days to mana calculation', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `salespersonConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37513,10 +37590,11 @@ DROP TABLE IF EXISTS `sendingConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sendingConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `defaultWeight` int(11) NOT NULL DEFAULT 13, `defaultPackages` int(11) NOT NULL DEFAULT 1, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `sendingConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37851,11 +37929,12 @@ DROP TABLE IF EXISTS `smsConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `smsConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `uri` varchar(255) NOT NULL, `title` varchar(50) NOT NULL, `apiKey` varchar(50) DEFAULT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `smsConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='SMS configuration parameters'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37930,15 +38009,18 @@ DROP TABLE IF EXISTS `specialPrice`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `specialPrice` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT 0, - `itemFk` int(11) NOT NULL DEFAULT 0, - `value` double NOT NULL DEFAULT 0, + `clientFk` int(11) DEFAULT NULL, + `itemFk` int(11) NOT NULL, + `value` decimal(10,2) NOT NULL, + `started` date NOT NULL DEFAULT '2024-01-01', + `ended` date DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `Id_Cliente_2` (`clientFk`,`itemFk`), KEY `Id_Article` (`itemFk`), KEY `Id_Cliente` (`clientFk`), CONSTRAINT `sp_article_id` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, - CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE + CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `check_date_range` CHECK (`ended` is null or `ended` >= `started`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38795,13 +38877,14 @@ DROP TABLE IF EXISTS `ticketConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ticketConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `scopeDays` tinyint(3) DEFAULT NULL, `pickingDelay` int(11) NOT NULL DEFAULT 10 COMMENT 'minutos de cortesia desde que se crea un ticket hasta que se puede preparar', `packagingInvoicingDated` date NOT NULL DEFAULT '2017-11-21' COMMENT 'Fecha desde la cual se gestiona el registro de embalajes de tickets (tabla vn.ticketPackaging)', `packingDelay` int(11) DEFAULT 1 COMMENT 'Horas que marcará el retraso respecto hora de cierre web del ticket', `daysForWarningClaim` int(11) NOT NULL DEFAULT 2 COMMENT 'dias restantes hasta que salte el aviso de reclamación fuera de plazo', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `ticketConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39549,10 +39632,11 @@ DROP TABLE IF EXISTS `tillConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tillConfig` ( - `id` int(11) NOT NULL, + `id` int(10) unsigned NOT NULL, `openingBalance` decimal(10,2) NOT NULL, `updated` timestamp NOT NULL DEFAULT current_timestamp(), - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `tillConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -39841,7 +39925,7 @@ DROP TABLE IF EXISTS `travelConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `travelConfig` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `warehouseInFk` smallint(6) unsigned NOT NULL DEFAULT 8 COMMENT 'Warehouse de origen', `warehouseOutFk` smallint(6) unsigned NOT NULL DEFAULT 60 COMMENT 'Warehouse destino', `agencyFk` int(11) NOT NULL DEFAULT 1378 COMMENT 'Agencia por defecto', @@ -39854,7 +39938,8 @@ CREATE TABLE `travelConfig` ( CONSTRAINT `travelConfig_FK` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelConfig_FK_1` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `travelConfig_FK_2` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + CONSTRAINT `travelConfig_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40264,7 +40349,7 @@ DROP TABLE IF EXISTS `viaexpressConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `viaexpressConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `url` varchar(100) NOT NULL, `client` varchar(100) NOT NULL, `user` varchar(100) NOT NULL, @@ -40274,7 +40359,8 @@ CREATE TABLE `viaexpressConfig` ( `agencyModeFk` int(11) DEFAULT NULL COMMENT 'Indica el agencyMode que es interdia', PRIMARY KEY (`id`), KEY `viaexpressConfig_agencyMode_Fk` (`agencyModeFk`), - CONSTRAINT `viaexpressConfig_agencyMode_Fk` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) + CONSTRAINT `viaexpressConfig_agencyMode_Fk` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), + CONSTRAINT `viaexpressConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40328,13 +40414,14 @@ DROP TABLE IF EXISTS `wagonConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `wagonConfig` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `width` int(11) unsigned DEFAULT 1350, `height` int(11) unsigned DEFAULT 1900, `maxWagonHeight` int(11) unsigned DEFAULT 200, `minHeightBetweenTrays` int(11) unsigned DEFAULT 50, `maxTrays` int(11) unsigned DEFAULT 6, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `wagonConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40739,7 +40826,7 @@ DROP TABLE IF EXISTS `workerConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `businessUpdated` date DEFAULT NULL, `roleFk` int(10) unsigned NOT NULL COMMENT 'Rol por defecto al dar de alta un trabajador nuevo', `businessTypeFk` varchar(100) DEFAULT NULL COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo', @@ -40748,7 +40835,8 @@ CREATE TABLE `workerConfig` ( KEY `workerConfig_FK` (`roleFk`), KEY `workerConfig_FK_1` (`payMethodFk`), CONSTRAINT `workerConfig_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE, - CONSTRAINT `workerConfig_FK_1` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `workerConfig_FK_1` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `workerConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -41237,7 +41325,7 @@ DROP TABLE IF EXISTS `workerTimeControlConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `workerTimeControlConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `dayBreak` int(11) NOT NULL, `dayBreakDriver` int(11) NOT NULL, `shortWeekBreak` int(11) NOT NULL, @@ -41264,7 +41352,8 @@ CREATE TABLE `workerTimeControlConfig` ( `maxTimeToBreak` int(11) DEFAULT 3600, `maxWorkShortCycle` int(10) unsigned DEFAULT 561600 COMMENT 'Máximo tiempo que un trabajador puede estar trabajando con el que adquirirá el derecho a un descanso semanal corto', `maxWorkLongCycle` int(10) unsigned DEFAULT 950400 COMMENT 'Máximo tiempo que un trabajador puede estar trabajando con el que adquirirá el derecho a un descanso semanal largo', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `workerTimeControlConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='All values in seconds'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -41455,9 +41544,10 @@ DROP TABLE IF EXISTS `zipConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `zipConfig` ( - `id` double(10,2) NOT NULL, + `id` int(10) unsigned NOT NULL, `maxSize` int(11) DEFAULT NULL COMMENT 'in MegaBytes', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `zipConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -41533,10 +41623,11 @@ DROP TABLE IF EXISTS `zoneConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `zoneConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int(10) unsigned NOT NULL, `scope` int(10) unsigned NOT NULL, `forwardDays` int(10) NOT NULL DEFAULT 7 COMMENT 'days forward to show zone_upcomingDeliveries', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `zoneConfig_check` CHECK (`id` = 1) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -41788,9 +41879,9 @@ DELIMITER ;; /*!50003 SET @saved_cs_client = @@character_set_client */ ;; /*!50003 SET @saved_cs_results = @@character_set_results */ ;; /*!50003 SET @saved_col_connection = @@collation_connection */ ;; -/*!50003 SET character_set_client = utf8mb3 */ ;; -/*!50003 SET character_set_results = utf8mb3 */ ;; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ;; +/*!50003 SET character_set_client = utf8mb4 */ ;; +/*!50003 SET character_set_results = utf8mb4 */ ;; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ;; /*!50003 SET @saved_sql_mode = @@sql_mode */ ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; @@ -41798,9 +41889,8 @@ DELIMITER ;; /*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `clientsDisable` ON SCHEDULE EVERY 1 MONTH STARTS '2023-06-01 00:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN UPDATE account.user u JOIN client c ON c.id = u.id - JOIN clientType ct ON ct.id = c.typeFk SET u.active = FALSE - WHERE ct.code = 'normal' + WHERE c.typeFk = 'normal' AND u.id NOT IN ( SELECT DISTINCT c.id FROM client c @@ -42261,6 +42351,7 @@ BEGIN CALL vn.addressTaxArea(); SELECT areaFk INTO vTaxArea FROM tmp.addressTaxArea; + DROP TEMPORARY TABLE tmp.addressCompany, tmp.addressTaxArea; @@ -43905,13 +43996,16 @@ BEGIN SELECT rate3 INTO price FROM vn.priceFixed - WHERE itemFk = vItemFk + WHERE itemFk = vItemFk AND util.VN_CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; - SELECT `value` INTO price + SELECT `value` INTO price FROM vn.specialPrice - WHERE itemFk = vItemFk - AND clientFk = vClientFk ; + WHERE itemFk = vItemFk + AND (clientFk = vClientFk OR clientFk IS NULL) + AND started <= util.VN_CURDATE() + AND (ended >= util.VN_CURDATE() OR ended IS NULL) + ORDER BY id DESC LIMIT 1; RETURN price; END ;; DELIMITER ; @@ -46706,6 +46800,121 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `absoluteInventoryHistory` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `absoluteInventoryHistory`( + vItemFk INT, + vWarehouseFk INT, + vDate DATETIME +) +BEGIN +/** +* Calcula y proporciona un historial de inventario absoluto +* para un artículo específico en un almacén dado +* hasta una fecha determinada. +* +* @param vItemFk Id de artículo +* @param vWarehouseFk Id de almacén +* @param vDate Fecha +*/ + DECLARE vCalculatedInventory INT; + DECLARE vToday DATETIME DEFAULT util.VN_CURDATE(); + DECLARE vStartDate DATE DEFAULT '2001-01-01'; + + CREATE OR REPLACE TEMPORARY TABLE tHistoricalPast + ENGINE = MEMORY + SELECT * + FROM ( + SELECT tr.landed `date`, + b.quantity input, + NULL `output`, + tr.isReceived ok, + s.name alias, + e.invoiceNumber reference, + e.id id, + tr.isDelivered f5 + FROM buy b + JOIN `entry` e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + WHERE tr.landed >= vStartDate + AND s.id <> (SELECT supplierFk FROM inventoryConfig) + AND vWarehouseFk IN (tr.warehouseInFk, 0) + AND b.itemFk = vItemFk + AND NOT e.isExcludedFromAvailable + AND NOT e.isRaid + UNION ALL + SELECT tr.shipped, + NULL, + b.quantity, + tr.isDelivered, + s.name, + e.invoiceNumber, + e.id, + tr.isDelivered + FROM buy b + JOIN `entry` e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + WHERE tr.shipped >= vStartDate + AND vWarehouseFk = tr.warehouseOutFk + AND s.id <> (SELECT supplierFk FROM inventoryConfig) + AND b.itemFk = vItemFk + AND NOT e.isExcludedFromAvailable + AND NOT e.isRaid + UNION ALL + SELECT t.shipped, + NULL, + m.quantity, + (m.isPicked OR t.isLabeled OR t.refFk IS NOT NULL), + t.nickname, + t.refFk, + t.id, + t.isPrinted + FROM sale m + JOIN ticket t ON t.id = m.ticketFk + JOIN client c ON c.id = t.clientFk + WHERE t.shipped >= vStartDate + AND m.itemFk = vItemFk + AND vWarehouseFk IN (t.warehouseFk, 0) + ) t1 + ORDER BY `date`, input DESC, ok DESC; + + SELECT SUM(input) - SUM(`output`) INTO vCalculatedInventory + FROM tHistoricalPast + WHERE `date` < vDate; + + SELECT p1.*, NULL v_virtual + FROM ( + SELECT vDate `date`, + vCalculatedInventory input, + NULL `output`, + 1 ok, + 'Inventario calculado' alias, + '' reference, + 0 id, + 1 f5 + UNION ALL + SELECT * + FROM tHistoricalPast + WHERE `date` >= vDate + ) p1; + + DROP TEMPORARY TABLE tHistoricalPast; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `addNoteFromDelivery` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48312,7 +48521,7 @@ BEGIN ENGINE = MEMORY SELECT vItemFk itemFk; - CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); + CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, TRUE); DROP TEMPORARY TABLE tmp.item; END ;; DELIMITER ; @@ -48330,7 +48539,11 @@ DELIMITER ; /*!50003 SET character_set_results = utf8mb4 */ ; /*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`( + vLanded DATE, + vAddressFk INT, + vAgencyModeFk INT, + vShowExpiredZones BOOLEAN) BEGIN /** * Calcula los articulos disponibles y sus precios @@ -48356,7 +48569,7 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); + CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, vShowExpiredZones); DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; CREATE TEMPORARY TABLE tmp.ticketLot( @@ -48540,7 +48753,7 @@ BEGIN * Calcula los componentes de los articulos de tmp.ticketLot * * @param vZoneFk para calcular el transporte - * @param vAddressFk Consignatario + * @param vAddressFk Consignatario * @param vShipped dia de salida del pedido * @param vWarehouseFk warehouse de salida del pedido * @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) @@ -48554,7 +48767,20 @@ BEGIN SELECT clientFk INTO vClientFK FROM address WHERE id = vAddressFk; - + + CREATE OR REPLACE TEMPORARY TABLE tSpecialPrice + (INDEX (itemFk)) + ENGINE = MEMORY + SELECT * FROM ( + SELECT * + FROM specialPrice + WHERE (clientFk = vClientFk OR clientFk IS NULL) + AND started <= vShipped + AND (ended >= vShipped OR ended IS NULL) + ORDER BY (clientFk = vClientFk) DESC, id DESC + LIMIT 10000000000000000000) t + GROUP BY itemFk; + CREATE OR REPLACE TEMPORARY TABLE tmp.ticketComponentCalculate (PRIMARY KEY (itemFk, warehouseFk)) ENGINE = MEMORY @@ -48566,7 +48792,7 @@ BEGIN IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, IFNULL(pf.`grouping`, b.`grouping`) `grouping`, ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, - tl.buyFk, + tl.buyFk, i.typeFk, IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping FROM tmp.ticketLot tl @@ -48574,8 +48800,7 @@ BEGIN JOIN item i ON i.id = tl.itemFk JOIN itemType it ON it.id = i.typeFk JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN specialPrice sp ON sp.itemFk = i.id - AND sp.clientFk = vClientFk + LEFT JOIN tSpecialPrice sp ON sp.itemFk = i.id LEFT JOIN ( SELECT * FROM ( SELECT pf.itemFk, @@ -48593,7 +48818,7 @@ BEGIN LIMIT 10000000000000000000 ) tpf GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk + ) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.merchandise @@ -48625,10 +48850,10 @@ BEGIN FROM tmp.ticketComponent tc JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk GROUP BY tc.itemFk, warehouseFk; - + -- RECOBRO INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, c2.id, + SELECT tcb.warehouseFk, tcb.itemFk, c2.id, ROUND(tcb.base * LEAST( MAX(GREATEST(IFNULL(cr.priceIncreasing,0), @@ -48659,29 +48884,29 @@ BEGIN ROUND(base * wm.pricesModifierRate, 3) manaAuto FROM tmp.ticketComponentBase tcb JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk + JOIN workerMana wm ON c.salesPersonFk = wm.workerFk JOIN vn.component c2 ON c2.code = 'autoMana' WHERE wm.isPricesModifierActivated HAVING manaAuto <> 0; - + -- Precios especiales INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) SELECT tcb.warehouseFk, tcb.itemFk, c2.id, GREATEST( - IFNULL(ROUND(tcb.base * c2.tax, 4), 0), + IFNULL(ROUND(tcb.base * c2.tax, 4), 0), IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3 ) cost FROM tmp.ticketComponentBase tcb JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount' - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk + JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk + LEFT JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk JOIN vn.item i ON i.id = tcb.itemFk WHERE sp.value IS NULL AND i.supplyResponseFk IS NULL; - -- Individual + -- Individual INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) SELECT tcb.warehouseFk, tcb.itemFk, @@ -48692,14 +48917,14 @@ BEGIN JOIN vn.client c ON c.id = vClientFk JOIN vn.businessType bt ON bt.code = c.businessTypeFk WHERE bt.code = 'individual'; - + -- Venta por paquetes INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 + SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 FROM tmp.ticketComponentCalculate tcc JOIN vn.component c2 ON c2.code = 'salePerPackage' JOIN buy b ON b.id = tcc.buyFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk + LEFT JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk WHERE sp.value IS NULL; CREATE OR REPLACE TEMPORARY TABLE tmp.`zone` (INDEX (id)) @@ -48707,7 +48932,7 @@ BEGIN SELECT vZoneFk id; CALL zone_getOptionsForShipment(vShipped, TRUE); - + -- Reparto INSERT INTO tmp.ticketComponent SELECT tcc.warehouseFK, @@ -48721,7 +48946,7 @@ BEGIN JOIN agencyMode am ON am.id = z.agencyModeFk JOIN vn.volumeConfig vc JOIN vn.component c2 ON c2.code = 'delivery' - LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk + LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk AND ic.itemFk = tcc.itemFk HAVING cost <> 0; @@ -48738,7 +48963,7 @@ BEGIN sp.value - SUM(tcc.cost) sumCost FROM tmp.ticketComponentCopy tcc JOIN component c ON c.id = tcc.componentFk - JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk + JOIN tSpecialPrice sp ON sp.itemFk = tcc.itemFk JOIN vn.component c2 ON c2.code = 'specialPrices' WHERE c.classRate IS NULL AND tcc.warehouseFk = vWarehouseFk @@ -48774,9 +48999,9 @@ BEGIN CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 + WHERE IFNULL(tcs.classRate, 1) = 1 AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) GROUP BY tcs.warehouseFk, tcs.itemFk; @@ -48813,13 +49038,14 @@ BEGIN SELECT * FROM tmp.ticketComponentRate ORDER BY price LIMIT 10000000000000000000 ) t GROUP BY itemFk, warehouseFk, `grouping`; - + DROP TEMPORARY TABLE tmp.ticketComponentCalculate, tmp.ticketComponentSum, tmp.ticketComponentBase, tmp.ticketComponentRate, - tmp.ticketComponentCopy; + tmp.ticketComponentCopy, + tSpecialPrice; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48911,7 +49137,7 @@ BEGIN DECLARE v1Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 1 YEAR; DECLARE v2Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 2 YEAR; DECLARE v4Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 4 YEAR; - DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR; + DECLARE v5Years DATE DEFAULT util.VN_CURDATE() - INTERVAL 5 YEAR; DECLARE vTrashId VARCHAR(15); DECLARE vCompanyBlk INT; @@ -48929,8 +49155,9 @@ BEGIN DELETE IGNORE FROM expedition WHERE created < v26Months; DELETE FROM sms WHERE created < v18Months; DELETE FROM saleTracking WHERE created < v1Years; + DELETE FROM productionError WHERE dated < v1Years; DELETE FROM ticketTracking WHERE created < v18Months; - DELETE tobs FROM ticketObservation tobs + DELETE tobs FROM ticketObservation tobs JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < v5Years; DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < v1Years; @@ -49012,12 +49239,12 @@ BEGIN FROM travel t LEFT JOIN entry e ON e.travelFk = t.id WHERE t.shipped < v3Months AND e.travelFk IS NULL; - + UPDATE dms d - JOIN dmsType dt ON dt.id = d.dmsTypeFk - SET d.dmsTypeFk = vTrashId + JOIN dmsType dt ON dt.id = d.dmsTypeFk + SET d.dmsTypeFk = vTrashId WHERE created < util.VN_CURDATE() - INTERVAL dt.monthToDelete MONTH; - + -- borrar entradas sin compras CREATE OR REPLACE TEMPORARY TABLE tEntryToDelete SELECT e.* @@ -49035,7 +49262,7 @@ BEGIN CREATE OR REPLACE TEMPORARY TABLE tRouteToDelete SELECT * FROM route r - WHERE created < v4Years; + WHERE created < v4Years; UPDATE tRouteToDelete tmp JOIN dms d ON d.id = tmp.gestdocFk @@ -49079,7 +49306,7 @@ BEGIN DELETE FROM mail WHERE creationDate < v2Months; DELETE FROM split WHERE dated < v18Months; DELETE FROM remittance WHERE dated < v18Months; - + CREATE OR REPLACE TEMPORARY TABLE tTicketDelete SELECT DISTINCT tl.originFk ticketFk FROM ticketLog tl @@ -49088,11 +49315,11 @@ BEGIN FROM ticket t JOIN ticketLog tl ON tl.originFk = t.id LEFT JOIN ticketWeekly tw ON tw.ticketFk = t.id - WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31' + WHERE t.shipped BETWEEN '2000-01-01' AND '2000-12-31' AND t.isDeleted AND tw.ticketFk IS NULL GROUP BY t.id - ) sub ON sub.ids = tl.id + ) sub ON sub.ids = tl.id WHERE tl.creationDate <= v2Months; DELETE t FROM ticket t @@ -50566,6 +50793,13 @@ proc:BEGIN DECLARE vHasTooMuchCollections BOOL; DECLARE vLockTime INT DEFAULT 15; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('collection_assign'); + + RESIGNAL; + END; + -- Si hay colecciones sin terminar, sale del proceso CALL collection_get(vUserFk); @@ -50873,14 +51107,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `collection_new` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_new`(vUserFk INT, OUT vCollectionFk INT) proc:BEGIN @@ -50911,6 +51145,7 @@ proc:BEGIN DECLARE vLockName VARCHAR(215); DECLARE vLockTime INT DEFAULT 15; DECLARE vFreeWagonFk INT; + DECLARE c1 CURSOR FOR SELECT ticketFk, `lines`, m3 FROM tmp.productionBuffer @@ -50927,13 +51162,21 @@ proc:BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + IF vLockName IS NOT NULL THEN + DO RELEASE_LOCK(vLockName); + END IF; + + RESIGNAL; + END; + SELECT pc.ticketTrolleyMax * o.numberOfWagons, pc.hasUniqueCollectionTime, w.code, o.warehouseFk, o.itemPackingTypeFk, st.code, - CONCAT('collection_new', o.warehouseFk, ':',o.itemPackingTypeFk), o.numberOfWagons, o.trainFk, o.linesLimit, @@ -50944,7 +51187,6 @@ proc:BEGIN vWarehouseFk, vItemPackingTypeFk, vStateFk, - vLockName, vWagons, vTrainFk, vLinesLimit, @@ -50954,6 +51196,12 @@ proc:BEGIN JOIN state st ON st.`code` = 'ON_PREPARATION' JOIN operator o ON o.workerFk = vUserFk; + SET vLockName = CONCAT_WS('/', + 'collection_new', + vWarehouseFk, + vItemPackingTypeFk + ); + IF NOT GET_LOCK(vLockName, vLockTime) THEN LEAVE proc; END IF; @@ -51091,7 +51339,8 @@ proc:BEGIN @lines:= COUNT(*) + @lines, COUNT(*) `lines`, MAX(i.`size`) height, - @volume := SUM(sv.volume) + @volume volume + @volume := SUM(sv.volume) + @volume, + SUM(sv.volume) volume FROM saleVolume sv JOIN sale s ON s.id = sv.saleFk JOIN item i ON i.id = s.itemFk @@ -51134,13 +51383,13 @@ proc:BEGIN UPDATE tTrain SET ticketFk = vFirstTicketFk WHERE wagon = vFreeWagonFk; - + -- Se anulan el resto de carros libres para que sólo uno lleve un pedido excesivo DELETE tt.* FROM tTrain tt LEFT JOIN ( - SELECT DISTINCT wagon - FROM tTrain + SELECT DISTINCT wagon + FROM tTrain WHERE ticketFk IS NOT NULL ) nn ON nn.wagon = tt.wagon WHERE nn.wagon IS NULL; @@ -51155,7 +51404,7 @@ proc:BEGIN FETCH c1 INTO vTicketFk, vTicketLines, vTicketVolume; IF vDone THEN LEAVE read_loop; - END IF; + END IF; END IF; END LOOP; CLOSE c1; @@ -51384,14 +51633,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `company_getSuppliersDebt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getSuppliersDebt`(vSelf INT, vMonthsAgo INT) BEGIN @@ -51432,7 +51681,7 @@ BEGIN IF (p.currencyFk = vCurrencyEuroFk, p.amount, p.divisa) AS amount, p.dueDated < vStartingDate isBeforeStarting, p.currencyFk - FROM payment p + FROM payment p WHERE p.received > vStartDate AND p.companyFk = vSelf UNION ALL @@ -51440,9 +51689,9 @@ BEGIN r.companyFk, - IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue) AS Total, rv.dueDated < vStartingDate isBeforeStarting, - r.currencyFk - FROM invoiceIn r - INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk + r.currencyFk + FROM invoiceIn r + INNER JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk WHERE r.issued > vStartDate AND r.isBooked AND r.companyFk = vSelf @@ -51494,11 +51743,11 @@ BEGIN -IF (r.currencyFk = vCurrencyEuroFk, rv.amount, rv.foreignValue), r.currencyFk, FALSE isPayment, - TRUE - FROM invoiceIn r + TRUE + FROM invoiceIn r LEFT JOIN tOpeningBalances si ON r.companyFk = si.companyFk AND r.supplierFk = si.supplierFk - AND r.currencyFk = si.currencyFk + AND r.currencyFk = si.currencyFk JOIN invoiceInDueDay rv ON r.id = rv.invoiceInFk WHERE rv.dueDated >= vStartingDate AND (si.closingBalances IS NULL OR si.closingBalances <> 0) @@ -51563,7 +51812,7 @@ BEGIN AND vp.supplierFk = rd.supplierFk AND vp.companyFk = rd.companyFk AND vp.currencyFk = rd.currencyFk - WHERE vp.isPayment = FALSE; + WHERE NOT vp.isPayment; SELECT vp.expirationId, vp.dated, @@ -51578,14 +51827,14 @@ BEGIN vp.isReconciled, vp.endingBalance, cr.amount clientRiskAmount, - co.CEE + co.CEE FROM tPendingDuedates vp LEFT JOIN supplier s ON s.id = vp.supplierFk LEFT JOIN client c ON c.fi = s.nif LEFT JOIN clientRisk cr ON cr.clientFk = c.id - LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id - LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk - LEFT JOIN country co ON co.id = be.countryFk + LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id + LEFT JOIN bankEntity be ON be.id = sa.bankEntityFk + LEFT JOIN country co ON co.id = be.countryFk AND cr.companyFk = vp.companyFk; DROP TEMPORARY TABLE tOpeningBalances; @@ -51921,6 +52170,61 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `creditInsurance_getRisk` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `creditInsurance_getRisk`() +BEGIN +/** + * Devuelve el riesgo de los clientes que estan asegurados + */ + CREATE OR REPLACE TEMPORARY TABLE tmp.client_list + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT * FROM ( + SELECT cc.client Id_Cliente, ci.grade + FROM creditClassification cc + JOIN creditInsurance ci ON cc.id = ci.creditClassification + WHERE dateEnd IS NULL + ORDER BY ci.creationDate DESC + LIMIT 10000000000000000000) t1 + GROUP BY Id_Cliente; + + CALL vn2008.risk_vs_client_list(util.VN_CURDATE()); + + SELECT + c.id, + c.name, + c.credit clientCredit, + c.creditInsurance solunion, + CAST(r.risk AS DECIMAL(10,0)) risk, + CAST(c.creditInsurance - r.risk AS DECIMAL(10,0)) riskAlive, + cac.invoiced billedAnnually, + c.dueDay, + ci.grade, + c2.country + FROM tmp.client_list ci + LEFT JOIN tmp.risk r ON r.Id_Cliente = ci.Id_Cliente + JOIN client c ON c.id = ci.Id_Cliente + JOIN bs.clientAnnualConsumption cac ON c.id = cac.clientFk + JOIN country c2 ON c2.id = c.countryFk + GROUP BY c.id; + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `crypt` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -52590,6 +52894,7 @@ BEGIN ii.operated = IFNULL(ii.operated,d.operated), ii.issued = IFNULL(ii.issued,d.issued), ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isBooked = TRUE, e.isConfirmed = TRUE WHERE d.id = vDuaFk; @@ -53179,6 +53484,41 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `entry_checkBooked` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_checkBooked`( + vSelf INT +) +BEGIN +/** + * Comprueba si una entrada está contabilizada, + * y si lo está retorna un throw. + * + * @param vSelf Id de entrada + */ + DECLARE vIsBooked BOOL; + + SELECT isBooked INTO vIsBooked + FROM `entry` + WHERE id = vSelf; + + IF vIsBooked THEN + CALL util.throw('Entry is already booked'); + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `entry_checkPackaging` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -55898,14 +56238,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `inventory_repair` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `inventory_repair`() BEGIN @@ -55945,7 +56285,7 @@ BEGIN LEFT JOIN origin o ON o.id = i.originFk ) ON it.id = i.typeFk LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO'; + WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO'; DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk; CREATE TEMPORARY TABLE tmp.lastEntryOk @@ -56002,11 +56342,6 @@ BEGIN JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk SET b.price2 = eo.price2 WHERE b.price2 = 0 ; - UPDATE buy b - JOIN tmp.lastEntry lt ON lt.buyFk = b.id - JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk - SET b.packing = eo.packing WHERE b.packing = 0; - UPDATE buy b JOIN tmp.lastEntry lt ON lt.buyFk = b.id JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk @@ -56504,20 +56839,15 @@ BEGIN * @param vInvoiceInFk Id de factura recibida */ DECLARE vRate DOUBLE DEFAULT 1; - DECLARE vDated DATE; DECLARE vExpenseFk VARCHAR(10); - SELECT MAX(rr.dated) INTO vDated + SELECT `value` INTO vRate FROM referenceRate rr JOIN invoiceIn ii ON ii.id = vInvoiceInFk WHERE rr.dated <= ii.issued - AND rr.currencyFk = ii.currencyFk; - - IF vDated THEN - SELECT `value` INTO vRate - FROM referenceRate - WHERE dated = vDated; - END IF; + AND rr.currencyFk = ii.currencyFk + ORDER BY dated DESC + LIMIT 1; DELETE FROM invoiceInTax WHERE invoiceInFk = vInvoiceInFk; @@ -63333,6 +63663,28 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `multipleInventoryHistory` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `multipleInventoryHistory`( + vItemFk INT) +BEGIN + DECLARE vDateInventory DATETIME; + SELECT inventoried INTO vDateInventory FROM config; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `mysqlConnectionsSorter_kill` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -64686,16 +65038,22 @@ BEGIN -- Rellena la tabla tmp.errorsByChecker con fallos de revisores CREATE OR REPLACE TEMPORARY TABLE tmp.errorsByChecker ENGINE = MEMORY - SELECT st.workerFk, - COUNT(t.id) errors - FROM saleMistake sm - JOIN saleTracking st ON sm.saleFk = st.saleFk - JOIN `state` s2 ON s2.id = st.stateFk - JOIN sale s ON s.id = sm.saleFk - JOIN ticket t on t.id = s.ticketFk - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) - AND s2.code IN ('OK','PREVIOUS_PREPARATION','PREPARED','CHECKED') - GROUP BY st.workerFk; + WITH rankedWorkers AS ( + SELECT sm.id, + st.workerFk, + ROW_NUMBER() OVER(PARTITION BY sm.id ORDER BY s2.`order`) rnk + FROM vn.saleMistake sm + JOIN vn.saleTracking st ON sm.saleFk = st.saleFk + JOIN vn.`state` s2 ON s2.id = st.stateFk + JOIN vn.sale s ON s.id = sm.saleFk + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + AND s2.code IN ('OK', 'PREVIOUS_PREPARATION', 'PREPARED', 'CHECKED') + ) + SELECT workerFk, COUNT(*) errors + FROM rankedWorkers + WHERE rnk = 1 + GROUP BY workerFk; -- Rellena la tabla tmp.expeditionErrors con fallos de expediciones CREATE OR REPLACE TEMPORARY TABLE tmp.expeditionErrors @@ -66608,6 +66966,301 @@ BEGIN END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `sale_boxPickingPrint` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`jenkins`@`10.0.%.%` PROCEDURE `sale_boxPickingPrint`( + IN vPrinterFk INT, + IN vSaleFk INT, + IN vPacking INT, + IN vSectorFk INT, + IN vUserFk INT, + IN vPackagingFk INT, + IN vPackingSiteFk INT) +BEGIN +/** Splits a line of sale to a different ticket and prints the transport sticker + */ + DECLARE vAgencyModeFk INT; + DECLARE vConcept VARCHAR(30); + DECLARE vExpeditionFk INT; + DECLARE vItemFk INT; + DECLARE vItemShelvingFk INT; + DECLARE vItemShelvingSaleFk INT; + DECLARE vItemShelvingSaleFk_old INT; + DECLARE vLastExpeditionTimeStamp DATETIME; + DECLARE vMaxPhoneLength INT DEFAULT 11; + DECLARE vMaxStreetLength INT DEFAULT 36; + DECLARE vNewSaleFk INT; + DECLARE vNewTicketFk INT; + DECLARE vParkingCode VARCHAR(10); + DECLARE vQuantity INT; + DECLARE vRemainder INT DEFAULT 0; + DECLARE vRemainderSaleFk INT; + DECLARE vShelving VARCHAR(10); + DECLARE vTicketFk INT; + + SELECT s.quantity, + s.quantity MOD vPacking, + s.ticketFk, + s.itemFk, + s.concept + INTO vQuantity, + vRemainder, + vTicketFk, + vItemFk, + vConcept + FROM sale s + WHERE s.id = vSaleFk; + + IF vRemainder THEN + UPDATE sale SET quantity = quantity - vRemainder WHERE id = vSaleFk; + + INSERT INTO sale(ticketFk, itemFk, quantity, price, discount, concept) + SELECT ticketFk, itemFk, vRemainder, price, discount, concept + FROM sale + WHERE id = vSaleFk; + + SET vRemainderSaleFk = LAST_INSERT_ID(); + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT vRemainderSaleFk, componentFk, value + FROM saleComponent + WHERE saleFk = vSaleFk; + END IF; + +w1: WHILE vQuantity >= vPacking DO + + SET vItemShelvingFk = NULL; + + SELECT sub.id + INTO vItemShelvingFk + FROM productionConfig pc + JOIN ( + SELECT ish.id, + ish.visible - IFNULL(SUM(iss.quantity),0) available, + p.pickingOrder, + ish.created + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + LEFT JOIN itemShelvingSale iss + ON iss.itemShelvingFk = ish.id + AND iss.created >= CURDATE() + AND iss.isPicked = FALSE + WHERE ish.itemFk = vItemFk + AND p.sectorFk = vSectorFk + GROUP BY ish.id + HAVING available >= vPacking) sub + ORDER BY IF(pc.orderMode = 'Location',sub.pickingOrder, sub.created) + LIMIT 1; + + IF vItemShelvingFk THEN + INSERT INTO itemShelvingSale + SET itemShelvingFk = vItemShelvingFk, + saleFk = vSaleFk, + quantity = vPacking, + userFk = vUserFk, + isPicked = TRUE; + + SET vItemShelvingSaleFk = LAST_INSERT_ID(); + + UPDATE sale SET isPicked = FALSE WHERE id = vSaleFk; + ELSE + LEAVE w1; + END IF; + + SET vNewTicketFk = NULL; + + SELECT MAX(t.id) INTO vNewTicketFk + FROM ticket t + JOIN ticketLastState tls ON tls.ticketFk = t.id + JOIN (SELECT addressFk, clientFk, date(shipped) shipped, warehouseFk + FROM ticket + WHERE id = vTicketFk) tt + ON tt.addressFk = t.addressFk + AND tt.clientFk = t.clientFk + AND t.shipped BETWEEN tt.shipped AND util.dayend(tt.shipped) + AND t.warehouseFk = tt.warehouseFk + WHERE tls.name = 'Encajado' ; + + IF ISNULL(vNewTicketFk) THEN + INSERT INTO ticket( clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority, + clonedFrom) + SELECT clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority, + id + FROM ticket + WHERE id = vTicketFk; + + SET vNewTicketFk = LAST_INSERT_ID(); + + INSERT INTO ticketTracking(ticketFk, stateFk, userFk) + SELECT vNewTicketFk, id, vUserFk + FROM state + WHERE code = 'PACKED'; + END IF; + + UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk; + + UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk; + + SET vNewSaleFk = NULL; + + SELECT MAX(id) INTO vNewSaleFk + FROM sale + WHERE ticketFk = vNewTicketFk + AND itemFk = vItemFk; + + IF vNewSaleFk THEN + UPDATE sale + SET quantity = quantity + vPacking + WHERE id = vNewSaleFk; + + SET vItemShelvingSaleFk_old = NULL; + + SELECT MAX(id) INTO vItemShelvingSaleFk_old + FROM itemShelvingSale + WHERE itemShelvingFk = vItemShelvingFk + AND saleFk = vNewSaleFk; + + IF vItemShelvingSaleFk_old THEN + UPDATE itemShelvingSale + SET quantity = quantity + vPacking + WHERE id = vItemShelvingSaleFk_old; + + DELETE FROM itemShelvingSale + WHERE id = vItemShelvingSaleFk; + + SET vItemShelvingSaleFk = vItemShelvingSaleFk_old; + ELSE + UPDATE itemShelvingSale + SET saleFk = vNewSaleFk + WHERE id = vItemShelvingSaleFk; + END IF; + ELSE + INSERT INTO sale(ticketFk, itemFk, concept, quantity, discount, price) + SELECT vNewTicketFk, itemFk, concept, vPacking, discount, price + FROM sale + WHERE id = vSaleFk; + + SET vNewSaleFk = LAST_INSERT_ID(); + + INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge) + SELECT vNewSaleFk, componentFk, value, isGreuge + FROM saleComponent + WHERE saleFk = vSaleFk; + + UPDATE itemShelvingSale + SET saleFk = vNewSaleFk + WHERE id = vItemShelvingSaleFk; + END IF; + + INSERT IGNORE INTO saleTracking(saleFk, isChecked, workerFk, stateFk) + SELECT vNewSaleFk, TRUE, vUserFk, id + FROM state + WHERE code = 'PREPARED'; + + SELECT agencyModeFk INTO vAgencyModeFk + FROM ticket + WHERE id = vNewTicketFk; + + INSERT INTO expedition( + agencyModeFk, + ticketFk, + freightItemFk, + workerFk, + packagingFk, + itemPackingTypeFk, + hostFk, + packingSiteFk, + monitorId, + started, + ended + ) + SELECT vAgencyModeFk, + vNewTicketFk, + i.id, + vUserFk, + vPackagingFk, + ps.code, + h.code, + vPackingSiteFk, + ps.monitorId, + IFNULL(vLastExpeditionTimeStamp, NOW()), + NOW() + FROM packingSite ps + JOIN host h ON h.id = ps.hostFk + JOIN item i ON i.name = 'Shipping cost' + WHERE ps.id = vPackingSiteFk + LIMIT 1; + + SET vExpeditionFk = LAST_INSERT_ID(); + + SET vLastExpeditionTimeStamp = NOW(); + + CALL dipole.expedition_Add(vExpeditionFk,vPrinterFk, TRUE); + + SELECT shelvingFk, p.code + INTO vShelving, vParkingCode + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + WHERE ish.id = vItemShelvingFk; + + UPDATE dipole.expedition_PrintOut + SET isPrinted = FALSE, + itemFk = vItemFk, + quantity = vPacking, + longName = vConcept, + shelvingFk = vShelving, + parkingCode = vParkingCode, + phone = RIGHT(phone,vMaxPhoneLength), + street = RIGHT(street, vMAxStreetLength) + WHERE expeditionFk = vExpeditionFk; + + DELETE FROM sale + WHERE quantity = 0 + AND id = vSaleFk; + END WHILE; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66703,6 +67356,7 @@ BEGIN JOIN parking p ON p.id = sh.parkingFk JOIN tmp.productionBuffer pb ON pb.ticketFk = s.ticketFk JOIN agencyMode am ON am.id = pb.agencyModeFk + JOIN agency a ON a .id = am.agencyFk LEFT JOIN routesMonitor rm ON rm.routeFk = pb.routeFk LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk @@ -66717,6 +67371,7 @@ BEGIN AND ((rm.bufferFk AND rm.isPickingAllowed) OR am.code = 'REC_ALG') AND pb.shipped = vDated + AND a.isOwn GROUP BY s.id ORDER BY etd; @@ -67377,14 +68032,14 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `sale_replaceItem` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_replaceItem`(vSaleFk INT, vNewItemFk INT, vQuantity INT) BEGIN @@ -67464,7 +68119,9 @@ BEGIN vNewItemFk); SELECT price INTO vNewPrice - FROM tmp.ticketCalculateItem; + FROM tmp.ticketComponentPrice + ORDER BY (vQuantity % `grouping`) ASC + LIMIT 1; IF vNewPrice IS NULL THEN CALL util.throw('price retrieval failed'); @@ -67491,7 +68148,7 @@ BEGIN price) SELECT vTicketFk, vNewItemFk, - CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName), + CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ', i.name), vFinalPrice FROM vn.item i WHERE id = vNewItemFk; @@ -68212,50 +68869,6 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `solunionRiskRequest` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `solunionRiskRequest`() -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; - CREATE TEMPORARY TABLE tmp.client_list - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc - JOIN vn.creditInsurance ci ON cc.id = ci.creditClassification - WHERE dateEnd IS NULL - ORDER BY ci.creationDate DESC - LIMIT 10000000000000000000) t1 GROUP BY Id_Cliente; - - CALL vn2008.risk_vs_client_list(util.VN_CURDATE()); - - SELECT - c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo, - cast(c.creditInsurance - r.risk as decimal(10,0)) margen_vivo, - f.Consumo consumo_anual, c.Vencimiento, ci.grade - FROM - vn2008.Clientes c - JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente - JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente - JOIN bi.facturacion_media_anual f ON c.Id_Cliente = f.Id_Cliente - GROUP BY Id_cliente; - - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `stockBuyedByWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -69197,7 +69810,7 @@ BEGIN SELECT id itemFk FROM vn.item WHERE typeFk = vTypeFk; - CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); + CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk, FALSE); DROP TEMPORARY TABLE tmp.item; DROP TEMPORARY TABLE tmp.ticketLot; END ;; @@ -69242,56 +69855,11 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE) BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE vNewTicketFk INT; - DECLARE vOldSaleFk INT; - DECLARE vNewSaleFk INT; - - DECLARE cur1 CURSOR FOR - SELECT id - FROM vn.sale - WHERE ticketFk = vTicketFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SET vNewShipped = IFNULL(vNewShipped, util.VN_CURDATE()); - - CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.ticket - SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed), - shipped = vNewShipped - WHERE id = vNewTicketFk; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vOldSaleFk; - - IF done THEN - LEAVE read_loop; - END IF; - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed) - SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed - FROM vn.sale - WHERE id = vOldSaleFk; - - SELECT max(id) INTO vNewSaleFk - FROM vn.sale - WHERE ticketFk = vNewTicketFk; - - INSERT INTO vn.saleComponent(saleFk, componentFk, value, isGreuge) - SELECT vNewSaleFk, componentFk, value, isGreuge - FROM vn.saleComponent - WHERE saleFk = vOldSaleFk; - - END LOOP; - CLOSE cur1; - + DECLARE vNewTicketFk INT; + + CALL ticket_cloneAll(vTicketFk, vNewShipped, TRUE, vNewTicketFk); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -71099,6 +71667,74 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_cloneAll` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneAll`(vTicketFk INT, vNewShipped DATE, vWithWarehouse BOOLEAN, OUT vNewTicketFk INT) +BEGIN + + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vOldSaleFk INT; + DECLARE vNewSaleFk INT; + + DECLARE cur1 CURSOR FOR + SELECT id + FROM sale + WHERE ticketFk = vTicketFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET vNewShipped = IFNULL(vNewShipped, util.VN_CURDATE()); + + CALL ticket_Clone(vTicketFk, vNewTicketFk); + + UPDATE ticket + SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed), + shipped = vNewShipped, + warehouseFk = IF(vWithWarehouse, warehouseFk, NULL) + WHERE id = vNewTicketFk; + + OPEN cur1; + + read_loop: LOOP + + FETCH cur1 INTO vOldSaleFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + INSERT INTO sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed) + SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed + FROM sale + WHERE id = vOldSaleFk; + + SELECT max(id) INTO vNewSaleFk + FROM sale + WHERE ticketFk = vNewTicketFk; + + INSERT INTO saleComponent(saleFk, componentFk, value, isGreuge) + SELECT vNewSaleFk, componentFk, value, isGreuge + FROM saleComponent + WHERE saleFk = vOldSaleFk; + + END LOOP; + + CLOSE cur1; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `ticket_cloneWeekly` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78445,7 +79081,7 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`() BEGIN /** - * Calcula si para un mismo codigo postal y dia + * Calcula si para un mismo codigo postal y dia * hay mas de una zona configurada y manda correo * */ @@ -78453,17 +79089,18 @@ BEGIN DECLARE vZoneFk INT; DECLARE vIsDone INT DEFAULT FALSE; DECLARE vTableCollisions TEXT; + DECLARE json_data JSON; DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption; - + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; DROP TEMPORARY TABLE IF EXISTS tmp.zone; CREATE TEMPORARY TABLE tmp.zone - SELECT z.id + SELECT z.id FROM zone z JOIN agencyMode am ON am.id = z.agencyModeFk JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE dm.code IN ('AGENCY','DELIVERY'); + WHERE dm.code IN ('AGENCY','DELIVERY'); CALL zone_getOptionsForShipment(util.VN_CURDATE(),FALSE); @@ -78478,7 +79115,7 @@ BEGIN PRIMARY KEY zoneFkk (zoneFk, geoFk), INDEX(geoFk)) ENGINE = MyISAM; - + OPEN cur1; cur1Loop: LOOP SET vIsDone = FALSE; @@ -78486,82 +79123,63 @@ BEGIN IF vIsDone THEN LEAVE cur1Loop; END IF; - + CALL zone_getLeaves(vZoneFk, NULL, NULL, TRUE); - myLoop: LOOP + myLoop: LOOP SET vGeoFk = NULL; - SELECT geoFk INTO vGeoFk + SELECT geoFk INTO vGeoFk FROM tmp.zoneNodes zn WHERE NOT isChecked LIMIT 1; - + IF vGeoFk IS NULL THEN LEAVE myLoop; END IF; - + CALL zone_getLeaves(vZoneFk, vGeoFk, NULL, TRUE); UPDATE tmp.zoneNodes - SET isChecked = TRUE + SET isChecked = TRUE WHERE geoFk = vGeoFk; END LOOP; END LOOP; CLOSE cur1; - DELETE FROM tmp.zoneNodes + DELETE FROM tmp.zoneNodes WHERE sons > 0; - + DROP TEMPORARY TABLE IF EXISTS geoCollision; CREATE TEMPORARY TABLE geoCollision SELECT z.agencyModeFk, zn.geoFk, zw.warehouseFk FROM tmp.zoneNodes zn JOIN zone z ON z.id = zn.zoneFk - JOIN zoneWarehouse zw ON z.id = zw.zoneFk + JOIN zoneWarehouse zw ON z.id = zw.zoneFk GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk HAVING count(*) > 1; - - SELECT '
{{$t('street')}}{{$t('street')}} {{ticket.street}} {{$t('postcode')}} {{ticket.postalCode}}
- - - - - - - - ' INTO vTableCollisions; - - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT 'pepe@verdnatura.es' receiver, - 'noreply@verdnatura.es' replyTo, - CONCAT('Colisiones en zonas ', util.VN_CURDATE()) subject, - CONCAT(vTableCollisions, - GROUP_CONCAT(sub.td SEPARATOR ''), - '
C.PostalNúmero de zonaPrecioZonaAlmacénSalix
') body - FROM(SELECT - CONCAT(' - ', zn.name, ' - ', zoneFk,' - ', z.price,' - ', z.name,' - ', w.name, ' - ', CONCAT('' - 'https://salix.verdnatura.es/#!/zone/', - zoneFk, - '/location?q=%7B%22search%22:%22', - zn.name, - '%22%7D'),' - ') td - FROM tmp.zoneNodes zn - JOIN zone z ON z.id = zn.zoneFk - JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk - JOIN warehouse w ON w.id = gc.warehouseFk) sub; - - DROP TEMPORARY TABLE - geoCollision, + + -- Recojo los datos de la zona que ha dado conflicto + SELECT JSON_ARRAYAGG( + JSON_OBJECT( + 'zoneFk', zoneFk, + 'zn', JSON_OBJECT('name', zn.name), + 'z', JSON_OBJECT('name', z.name,'price', z.price), + 'w', JSON_OBJECT('name', w.name) + ) + ) FROM tmp.zoneNodes zn + JOIN zone z ON z.id = zn.zoneFk + JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk + JOIN warehouse w ON w.id = gc.warehouseFk + INTO json_data; + + -- Creo un registro de la notificacion 'zone-included' para reportar via email + SELECT util.notification_send( + 'zone-included', + JSON_OBJECT('zoneCollisions',json_data), + account.myUser_getId() + ); + + DROP TEMPORARY TABLE + geoCollision, tmp.zone, tmp.zoneNodes; END ;; @@ -82131,7 +82749,6 @@ SET character_set_client = utf8; 1 AS `abbreviation`, 1 AS `Id_Proveedores_account`, 1 AS `gerente_id`, - 1 AS `digito_factura`, 1 AS `phytosanitary`, 1 AS `CodigoEmpresa`, 1 AS `empresa_grupo`, @@ -84113,80 +84730,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `add_awb_component` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `add_awb_component`(IN vAwbFk SMALLINT) -BEGIN - - DECLARE vShipped DATE; - DECLARE vHasStems BOOLEAN; - - SELECT t.shipped, IF(a.stems, TRUE, FALSE) - INTO vShipped, vHasStems - FROM vn.travel t - JOIN vn.awb a ON a.id = t.awbFk - WHERE awbFk = vAwbFk - LIMIT 1; - - INSERT IGNORE INTO awb_component (awb_id,Id_Proveedor,awb_component_type_id,awb_role_id,awb_unit_id,value,Id_Moneda) - SELECT id, Id_Proveedor, awb_component_type_id, awb_role_id,awb_unit_id, LEAST(GREATEST(value1, IFNULL(min_value, value1)), IFNULL(max_value, value1)), Id_Moneda - FROM ( - SELECT a.id, - IFNULL(act.carguera_id, - CASE awb_role_id - WHEN 1 THEN a.carguera_id - WHEN 2 THEN a.transitario_id - WHEN 3 THEN f.airline_id - END - ) Id_Proveedor, - act.awb_component_type_id, - act.awb_role_id, - act.awb_unit_id, - value * - CASE awb_unit_id - WHEN '1000Tj-20' THEN ((CAST(stems AS SIGNED) - 20000)/1000) + (min_value / value) - WHEN '1000Tj-10' THEN ((CAST(stems AS SIGNED) - 10000)/1000) + (min_value / value) - WHEN '100GW' THEN peso/100 - WHEN 'AWB' THEN 1 -- No action - WHEN 'FB' THEN hb/2 - WHEN 'GW' THEN peso - WHEN 'TW' THEN GREATEST(peso,volume_weight) - WHEN 'PN' THEN LEAST(90, value + a.propertyNumber * 10) - END value1, - value, - act.Id_Moneda, - act.min_value, - act.max_value - FROM awb a - JOIN flight f ON f.flight_id = a.flight_id - LEFT JOIN awb_component_template act ON - ((IFNULL(act.carguera_id, a.carguera_id) = a.carguera_id AND awb_role_id = 1) - OR (IFNULL(act.carguera_id, a.transitario_id) = a.transitario_id AND awb_role_id = 2) - OR (IFNULL(act.airline_id, f.airline_id) = f.airline_id AND awb_role_id = 3) - OR (awb_role_id = 4)) - AND IFNULL(act.airport_out, f.airport_out) = f.airport_out - AND IFNULL(act.airport_in, f.airport_in) = f.airport_in - AND IFNULL(act.airline_id, f.airline_id) = f.airline_id - AND INSTR(IFNULL(act.days, WEEKDAY(vShipped) + 1),WEEKDAY(vShipped) + 1) - JOIN awb_component_type acty ON acty.awb_component_type_id = act.awb_component_type_id - WHERE a.id = vAwbFk AND Fecha <= vShipped - AND (vHasStems = TRUE OR acty.hasStems) - ORDER BY Fecha DESC, act.days DESC LIMIT 10000000000000000000 - ) t; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `agencia_volume` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -84244,69 +84787,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `agencyModeImbalance` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyModeImbalance`(vStarted DATE, vEnded DATE) -BEGIN -/** - * Devuelve el valor de los precios teorico, practico de las agencias - * y si ademas es de mrw lo compara con su fichero previamente procesado - * - * @param vEktFk Identificador de edi.ekt - */ - DECLARE vEndedDayEnd DATETIME; - - SET vEndedDayEnd = util.dayEnd(vEnded); - - SELECT t.id ticketFk,t.addressFk, - CAST(v.amount AS DECIMAL (10,2)) AS VN, - CAST(v.amount - e.shipping_charge AS DECIMAL (10,2)) AS Difer, - CAST(mrwPrice AS DECIMAL (10,2)) mrwPrice, - CAST(e.shipping_charge - mrwPrice AS DECIMAL (10,2)) mrwDifference, - CAST(e.shipping_charge AS DECIMAL (10,2)) AS teorico, - CAST(e.extraCharge AS DECIMAL (10,2)) AS extraCharge, - t.packages, t.clientFk, - t.zoneFk, a.provinceFk, mrwCount - FROM vn.ticket t - LEFT JOIN - (SELECT ticketFk, SUM(amount) amount, fc.shipped - FROM vn.sale_freightComponent fc - JOIN vn.ticket t ON t.id = fc.ticketFk - JOIN tmp.agencyMode am ON am.agencyModeFk = t.agencyModeFk - WHERE fc.shipped BETWEEN vStarted AND vEndedDayEnd - GROUP BY ticketFk) v ON t.id = v.ticketFk - LEFT JOIN (SELECT t.id, - SUM(t.zonePrice) shipping_charge, - SUM(IFNULL(aex.price,0)) extraCharge - FROM vn.ticket t - LEFT JOIN vn.expedition e ON e.ticketFk = t.id - LEFT JOIN vn.packaging p ON p.id = e.packagingFk - JOIN tmp.agencyMode amc ON amc.agencyModeFk = t.agencyModeFk - JOIN vn.agencyMode am ON am.id = amc.agencyModeFk - LEFT JOIN vn.agencyExtraCharge aex ON p.width+p.depth+p.height BETWEEN aex.sizeMin AND aex.sizeMax AND aex.agencyFk = am.agencyFk - WHERE t.shipped BETWEEN vStarted AND vEndedDayEnd - GROUP BY t.id - ) e ON t.id = e.id - LEFT JOIN (SELECT ticketFk, SUM(price) mrwPrice, COUNT(*) mrwCount - FROM vn.mrw - GROUP BY ticketFk) mrw ON mrw.ticketFk = t.id - JOIN vn.address a ON a.id = t.addressFk - JOIN tmp.agencyMode am ON am.agencyModeFk = t.agencyModeFk - WHERE t.shipped BETWEEN vStarted AND vEndedDayEnd; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `article` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -84778,329 +85258,6 @@ DELIMITER ; /*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `historico_absoluto` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `historico_absoluto`(IN idART INT, IN wh INT, IN datfecha DATETIME) -BEGIN - - DECLARE inv_calculado INT; - DECLARE inv INT; - DECLARE today DATETIME; - DECLARE fecha_inv DATETIME; - - SET today = util.VN_CURDATE(); - - CREATE OR REPLACE TEMPORARY TABLE historico_pasado - SELECT * - FROM ( - SELECT TR.landing Fecha, - C.Cantidad Entrada, - NULL Salida, - (TR.received != FALSE) OK, - P.Proveedor Alias, - E.Referencia Referencia, - E.Id_Entrada id, - TR.delivered F5 - FROM Compres C -- mirar perque no entra en received - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - INNER JOIN Proveedores P USING (Id_Proveedor) - WHERE TR.landing >= '2001-01-01' - AND Id_proveedor <> 4 - AND wh IN (TR.warehouse_id , 0) - AND C.Id_Article = idART - AND E.Inventario = 0 - AND E.Redada = 0 - UNION ALL - SELECT TR.shipment Fecha, - NULL Entrada, - C.Cantidad Salida, - TR.delivered OK, - P.Proveedor Alias, - E.Referencia Referencia, - E.Id_Entrada id, - TR.delivered F5 - FROM Compres C - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - INNER JOIN Proveedores P USING (Id_Proveedor) - WHERE TR.shipment >= '2001-01-01' - AND wh = TR.warehouse_id_out - AND Id_Proveedor <> 4 - AND C.Id_Article = idART - AND E.Inventario = 0 - AND E.Redada = 0 - UNION ALL - SELECT T.Fecha Fecha, - NULL Entrada, - M.Cantidad Salida, - (M.OK <> 0 OR T.Etiquetasemitidas <> 0 OR T.Factura IS NOT NULL) OK, - T.Alias Alias, - T.Factura Referencia, - T.Id_Ticket, - T.PedidoImpreso - FROM Movimientos M - INNER JOIN Tickets T USING (Id_Ticket) - JOIN Clientes C ON C.Id_Cliente = T.Id_Cliente - WHERE T.Fecha >= '2001-01-01' - AND M.Id_Article = idART - AND wh IN (T.warehouse_id , 0) - ) t1 - ORDER BY Fecha, Entrada DESC, OK DESC; - - SELECT sum(Entrada) - sum(Salida) INTO inv_calculado - FROM historico_pasado - WHERE Fecha < datfecha; - - SELECT p1.*, NULL v_virtual - FROM( - SELECT datfecha Fecha, - inv_calculado Entrada, - NULL Salida, - 1 OK, - 'Inventario calculado' Alias, - '' Referencia, 0 id, - 1 F5 - UNION ALL - SELECT * - FROM historico_pasado - WHERE Fecha >= datfecha - ) p1; - - DROP TEMPORARY TABLE historico_pasado; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -/*!50003 DROP PROCEDURE IF EXISTS `historico_multiple` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `historico_multiple`(IN vItemFk INT) -BEGIN - - DECLARE vDateInventory DATETIME; - - SELECT Fechainventario INTO vDateInventory FROM tblContadores; - - SET @a = 0; - - DROP TEMPORARY TABLE IF EXISTS hm1; - - CREATE TEMPORARY TABLE hm1 - SELECT DATE(Fecha) as Fecha, - Entrada, - Salida, - OK, - Referencia, - Historia.id, - - wh, - - `name` as wh_name - - FROM - - ( SELECT TR.landing as Fecha, - C.Cantidad as Entrada, - NULL as Salida, - - IF(warehouse_id = 44, 1, warehouse_id) as wh, - (TR.received != FALSE) as OK, - E.Referencia as Referencia, - E.Id_Entrada as id - - - - FROM Compres C - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - WHERE TR.landing >= vDateInventory - AND C.Id_Article = vItemFk - AND E.Redada = 0 - - AND C.Cantidad <> 0 - - UNION ALL - - SELECT TR.shipment as Fecha, - NULL as Entrada, - C.Cantidad as Salida, - warehouse_id_out as wh, - TR.delivered as OK, - E.Referencia as Referencia, - E.Id_Entrada as id - - FROM Compres C - INNER JOIN Entradas E USING (Id_Entrada) - INNER JOIN travel TR ON TR.id = E.travel_id - WHERE TR.shipment >= vDateInventory - AND C.Id_Article = vItemFk - - AND E.Redada = 0 - - AND C.Cantidad <> 0 - - UNION ALL - - SELECT T.Fecha as Fecha, - NULL as Entrada, - M.Cantidad as Salida, - warehouse_id as wh, - (M.OK <> 0 OR T.Etiquetasemitidas <> 0 OR T.Factura IS NOT NULL) as OK, - T.Factura as Referencia, - T.Id_Ticket as id - - FROM Movimientos M - INNER JOIN Tickets T USING (Id_Ticket) - WHERE T.Fecha >= vDateInventory - AND M.Id_Article = vItemFk - - ) AS Historia - - INNER JOIN warehouse ON warehouse.id = Historia.wh - ORDER BY Fecha, Entrada DESC, OK DESC; - - - DROP TEMPORARY TABLE IF EXISTS hm2; - DROP TEMPORARY TABLE IF EXISTS hm3; - DROP TEMPORARY TABLE IF EXISTS hm4; - DROP TEMPORARY TABLE IF EXISTS hm5; - DROP TEMPORARY TABLE IF EXISTS hm6; - DROP TEMPORARY TABLE IF EXISTS hm7; - DROP TEMPORARY TABLE IF EXISTS hm8; - CREATE TEMPORARY TABLE hm2 SELECT * FROM hm1 WHERE wh = 19; - CREATE TEMPORARY TABLE hm3 SELECT * FROM hm1 WHERE wh = 7; - CREATE TEMPORARY TABLE hm4 SELECT * FROM hm1 WHERE wh = 60; - CREATE TEMPORARY TABLE hm5 SELECT * FROM hm1 WHERE wh = 5; - CREATE TEMPORARY TABLE hm6 SELECT * FROM hm1 WHERE wh = 17; - CREATE TEMPORARY TABLE hm7 SELECT * FROM hm1 WHERE wh = 37; - CREATE TEMPORARY TABLE hm8 SELECT * FROM hm1 WHERE wh = 55; - - SELECT * FROM - - ( - - SELECT Fecha, Entrada as BOGEntrada, Salida as BOGSalida, OK as BOGOK, Referencia as BOGReferencia, id as BOGid, - - NULL AS VNHEntrada, NULL AS VNHSalida, NULL AS VNHOK, NULL AS VNHReferencia, NULL AS VNHid, - - NULL AS ALGEntrada, NULL AS ALGSalida, NULL AS ALGOK, NULL AS ALGReferencia, NULL AS ALGid, - - NULL AS MADEntrada, NULL AS MADSalida, NULL AS MADOK, NULL AS MADReferencia, NULL AS MADid, - - NULL AS MCFEntrada, NULL AS MCFSalida, NULL AS MCFOK, NULL AS MCFReferencia, NULL AS MCFid, - - NULL AS VILEntrada, NULL AS VILSalida, NULL AS VILOK, NULL AS VILReferencia, NULL AS VILid, - - NULL AS BAREntrada, NULL AS BARSalida, NULL AS BAROK, NULL AS BARReferencia, NULL AS BARid - - FROM hm2 - - - UNION ALL - - SELECT Fecha - , NULL, NULL, NULL, NULL, NULL - ,Entrada, Salida, OK, Referencia, id - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - FROM hm3 - - - - UNION ALL - - SELECT Fecha - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , Entrada, Salida, OK, Referencia, id - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - FROM hm4 - - UNION ALL - - SELECT Fecha - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , Entrada, Salida, OK, Referencia, id - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - FROM hm5 - - UNION ALL - - SELECT Fecha - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , Entrada, Salida, OK, Referencia, id - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - FROM hm6 - - UNION ALL - - SELECT Fecha - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , Entrada, Salida, OK, Referencia, id - , NULL, NULL, NULL, NULL, NULL - - - FROM hm7 - - UNION ALL - - SELECT Fecha - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , NULL, NULL, NULL, NULL, NULL - , Entrada, Salida, OK, Referencia, id - - FROM hm8 - - ) sub - - ORDER BY Fecha, BOGEntrada IS NULL, VNHEntrada IS NULL, ALGEntrada IS NULL, MADEntrada IS NULL, MCFEntrada IS NULL, VILEntrada IS NULL, BAREntrada IS NULL; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; /*!50003 DROP PROCEDURE IF EXISTS `raidUpdate` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -88222,7 +88379,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPersonSince` AS select `b`.`workerFk` AS `workerFk`,min(`b`.`started`) AS `started` from ((`business` `b` join `worker` `w` on(`w`.`id` = `b`.`workerFk`)) left join `professionalCategory` `pc` on(`pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk`)) where `pc`.`name` = 'Aux ventas' group by `b`.`workerFk` */; +/*!50001 VIEW `salesPersonSince` AS select `b`.`workerFk` AS `workerFk`,min(`b`.`started`) AS `started` from ((`business` `b` join `worker` `w` on(`w`.`id` = `b`.`workerFk`)) left join `professionalCategory` `pc` on(`pc`.`id` = `b`.`workerBusinessProfessionalCategoryFk`)) where `pc`.`description` = 'Aux ventas' group by `b`.`workerFk` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -90280,7 +90437,7 @@ USE `vn2008`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `empresa` AS select `c`.`id` AS `id`,`c`.`code` AS `abbreviation`,`c`.`supplierAccountFk` AS `Id_Proveedores_account`,`c`.`workerManagerFk` AS `gerente_id`,`c`.`sage200Company` AS `digito_factura`,`c`.`phytosanitary` AS `phytosanitary`,`c`.`companyCode` AS `CodigoEmpresa`,`c`.`companyGroupFk` AS `empresa_grupo`,`c`.`isDefaulter` AS `morosidad`,`c`.`expired` AS `baja`,`c`.`register` AS `registro`,`c`.`registered` AS `alta`,`c`.`logo` AS `logo`,`c`.`isOfficial` AS `oficial`,`c`.`hasCyc` AS `cyc`,`c`.`rgb` AS `rgb`,`c`.`email` AS `mail`,`c`.`stamp` AS `cuno`,`c`.`created` AS `ODBC_DATE`,`c`.`clientFk` AS `Id_Cliente` from `vn`.`company` `c` */; +/*!50001 VIEW `empresa` AS select `c`.`id` AS `id`,`c`.`code` AS `abbreviation`,`c`.`supplierAccountFk` AS `Id_Proveedores_account`,`c`.`workerManagerFk` AS `gerente_id`,`c`.`phytosanitary` AS `phytosanitary`,`c`.`companyCode` AS `CodigoEmpresa`,`c`.`companyGroupFk` AS `empresa_grupo`,`c`.`isDefaulter` AS `morosidad`,`c`.`expired` AS `baja`,`c`.`register` AS `registro`,`c`.`registered` AS `alta`,`c`.`logo` AS `logo`,`c`.`isOfficial` AS `oficial`,`c`.`hasCyc` AS `cyc`,`c`.`rgb` AS `rgb`,`c`.`email` AS `mail`,`c`.`stamp` AS `cuno`,`c`.`created` AS `ODBC_DATE`,`c`.`clientFk` AS `Id_Cliente` from `vn`.`company` `c` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -91086,4 +91243,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-03-26 6:55:36 +-- Dump completed on 2024-04-04 13:00:28 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index 515a09a23..00aa7fed3 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -2289,17 +2289,26 @@ trig: BEGIN DECLARE vGroupingMode TINYINT; DECLARE vGenericFk INT; DECLARE vGenericInDate BOOL; + DECLARE vBuyerFk INT; IF @isModeInventory THEN LEAVE trig; END IF; + CALL entry_checkBooked(NEW.entryFk); IF NEW.printedStickers <> 0 THEN CALL util.throw('it is not possible to create buy lines with printedstickers other than 0'); END IF; SET NEW.editorFk = account.myUser_getId(); + SELECT it.workerFk INTO vBuyerFk + FROM item i + JOIN itemType it ON it.id = i.typeFk + WHERE i.id = NEW.itemFk; + + SET NEW.buyerFk = vBuyerFk; + CALL buy_checkGrouping(NEW.`grouping`); SELECT t.warehouseInFk, t.landed @@ -2409,11 +2418,13 @@ trig:BEGIN DECLARE vGenericInDate BOOL; DECLARE vIsInventory BOOL; DECLARE vDefaultEntry INT; + DECLARE vBuyerFk INT; IF @isTriggerDisabled THEN LEAVE trig; END IF; + CALL entry_checkBooked(OLD.entryFk); SET NEW.editorFk = account.myUser_getId(); SELECT defaultEntry INTO vDefaultEntry @@ -2467,6 +2478,15 @@ trig:BEGIN SET NEW.isIgnored = TRUE; END IF; + IF NOT (NEW.itemFk <=> OLD.itemFk) THEN + SELECT it.workerFk INTO vBuyerFk + FROM item i + JOIN itemType it ON it.id = i.typeFk + WHERE i.id = NEW.itemFk; + + SET NEW.buyerFk = vBuyerFk; + END IF; + IF NOT (NEW.itemFk <=> OLD.itemFk) OR NOT (OLD.entryFk <=> NEW.entryFk) THEN CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck @@ -2557,10 +2577,11 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete` - BEFORE DELETE ON buy - FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeDelete` + BEFORE DELETE ON `buy` + FOR EACH ROW BEGIN + CALL entry_checkBooked(OLD.entryFk); IF OLD.printedStickers <> 0 THEN CALL util.throw("it is not possible to delete buys with printed labels "); END IF; @@ -4674,9 +4695,13 @@ BEGIN DECLARE vIsVirtual BOOL; DECLARE vPrintedCount INT; DECLARE vHasDistinctWarehouses BOOL; + + IF NEW.isBooked = OLD.isBooked THEN + CALL entry_checkBooked(OLD.id); + END IF; SET NEW.editorFk = account.myUser_getId(); - + IF NOT (NEW.travelFk <=> OLD.travelFk) THEN IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN @@ -4777,6 +4802,7 @@ DELIMITER ;; BEFORE DELETE ON `entry` FOR EACH ROW BEGIN + CALL entry_checkBooked(OLD.id); DELETE FROM buy WHERE entryFk = OLD.id; END */;; DELIMITER ; @@ -10087,6 +10113,10 @@ BEGIN CALL util.throw('The travel has entries with booked invoices'); END IF; END IF; + + IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN + CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries'); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10126,10 +10156,6 @@ BEGIN CALL buy_checkItem(); END IF; END IF; - - IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN - CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries'); - END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10836,6 +10862,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10856,6 +10883,7 @@ DELIMITER ;; FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10865,11 +10893,11 @@ DELIMITER ; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb3 */ ; -/*!50003 SET character_set_results = utf8mb3 */ ; -/*!50003 SET collation_connection = utf8mb3_general_ci */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneIncluded_afterDelete` AFTER DELETE ON `zoneIncluded` @@ -10880,6 +10908,7 @@ BEGIN `changedModel` = 'zoneIncluded', `changedModelId` = OLD.zoneFk, `userFk` = account.myUser_getId(); + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10962,4 +10991,4 @@ USE `vn2008`; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-03-26 6:55:58 +-- Dump completed on 2024-04-04 13:00:45 diff --git a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js index dd35dd740..43d854392 100644 --- a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js @@ -1,14 +1,14 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('Account Alias create and basic data path', () => { +fdescribe('Account Alias create and basic data path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('developer', 'account'); + await page.loginAndModule('itManagement', 'account'); await page.accessToSection('account.alias'); }); diff --git a/e2e/tests.js b/e2e/tests.js index 829056f4c..288d2ca4d 100644 --- a/e2e/tests.js +++ b/e2e/tests.js @@ -20,11 +20,7 @@ process.on('warning', warning => { }); async function test() { - const opts = getopts(process.argv.slice(2), { - boolean: ['show'] - }); - if (opts.show) - process.env.E2E_SHOW = true; + process.env.E2E_SHOW = true; console.log('Building and running DB container.'); const myt = new Myt(); From 7ea917dc4db761955007c73bbd4667a0e44b8e9c Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 5 Apr 2024 07:49:37 +0200 Subject: [PATCH 60/62] hotfix: #6875 packing DEFAULT 1 --- db/routines/vn/procedures/inventoryMake.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/inventoryMake.sql b/db/routines/vn/procedures/inventoryMake.sql index ed6a7fa43..a40093679 100644 --- a/db/routines/vn/procedures/inventoryMake.sql +++ b/db/routines/vn/procedures/inventoryMake.sql @@ -114,7 +114,7 @@ BEGIN quantity int(11) DEFAULT '0', buyingValue decimal(10,4) DEFAULT '0.0000', freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', + packing int(11) DEFAULT '1', `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', groupingMode tinyint(4) NOT NULL DEFAULT 0 , comissionValue decimal(10,3) DEFAULT '0.000', From 2f4cd2bc7bb0f1373776f4daa1432faf9a3f6789 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 5 Apr 2024 10:05:51 +0200 Subject: [PATCH 61/62] refs #7167 fix: acl mailAlias --- db/dump/.dump/data.sql | 4 ++-- db/dump/.dump/structure.sql | 5 +++-- db/dump/.dump/triggers.sql | 2 +- e2e/paths/14-account/02_alias_create_and_basic_data.spec.js | 2 +- e2e/tests.js | 6 +++++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 8fbab9e56..3779a5812 100644 --- a/db/dump/.dump/data.sql +++ b/db/dump/.dump/data.sql @@ -3,7 +3,7 @@ USE `util`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSERT INTO `version` VALUES ('vn-database','10970','20e4ab1d2c2256749c0f76ba85f660d39ec417a2','2024-04-04 13:36:31','10979'); +INSERT INTO `version` VALUES ('vn-database','10970','7ea917dc4db761955007c73bbd4667a0e44b8e9c','2024-04-05 07:49:24','10981'); INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL); INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL); @@ -1819,7 +1819,7 @@ INSERT INTO `ACL` VALUES (819,'Ticket','addSaleByCode','WRITE','ALLOW','ROLE','p INSERT INTO `ACL` VALUES (820,'TicketCollection','*','READ','ALLOW','ROLE','production'); INSERT INTO `ACL` VALUES (821,'Ticket','clone','WRITE','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (822,'SupplierDms','*','*','ALLOW','ROLE','employee'); -INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','itManagement'); +INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','developer'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index 374dc9708..5cc320fd4 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -28028,6 +28028,7 @@ CREATE TABLE `category` ( `id` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(45) NOT NULL, `nick` varchar(3) NOT NULL, + `name` varchar(45) GENERATED ALWAYS AS (`description`) VIRTUAL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -56055,7 +56056,7 @@ BEGIN quantity int(11) DEFAULT '0', buyingValue decimal(10,4) DEFAULT '0.0000', freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', + packing int(11) DEFAULT '1', `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', groupingMode tinyint(4) NOT NULL DEFAULT 0 , comissionValue decimal(10,3) DEFAULT '0.000', @@ -91243,4 +91244,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-04-04 13:00:28 +-- Dump completed on 2024-04-05 7:59:52 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index 00aa7fed3..fd73baf16 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -10991,4 +10991,4 @@ USE `vn2008`; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-04-04 13:00:45 +-- Dump completed on 2024-04-05 8:00:14 diff --git a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js index 43d854392..840fb8afe 100644 --- a/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/02_alias_create_and_basic_data.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Account Alias create and basic data path', () => { +describe('Account Alias create and basic data path', () => { let browser; let page; diff --git a/e2e/tests.js b/e2e/tests.js index 288d2ca4d..829056f4c 100644 --- a/e2e/tests.js +++ b/e2e/tests.js @@ -20,7 +20,11 @@ process.on('warning', warning => { }); async function test() { - process.env.E2E_SHOW = true; + const opts = getopts(process.argv.slice(2), { + boolean: ['show'] + }); + if (opts.show) + process.env.E2E_SHOW = true; console.log('Building and running DB container.'); const myt = new Myt(); From 0b96471c7de81e81b932a63ac8d141e38c350f33 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 8 Apr 2024 09:27:07 +0200 Subject: [PATCH 62/62] feat: refs #6714 Added businessType zone_getAddresses --- db/routines/vn/procedures/zone_getAddresses.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/zone_getAddresses.sql b/db/routines/vn/procedures/zone_getAddresses.sql index 1412c7ab3..ce7b0204e 100644 --- a/db/routines/vn/procedures/zone_getAddresses.sql +++ b/db/routines/vn/procedures/zone_getAddresses.sql @@ -28,7 +28,7 @@ BEGIN SELECT c.id clientFk, c.name, c.phone, - c.mobile, + bt.description, c.salesPersonFk, u.name username, aai.invoiced, @@ -44,10 +44,11 @@ BEGIN LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = c.id LEFT JOIN vn.annualAverageInvoiced aai ON aai.clientFk = c.id JOIN vn.clientType ct ON ct.code = c.typeFk + JOIN vn.businessType bt ON bt.code = c.businessTypeFk WHERE a.isActive AND c.isActive AND ct.code = 'normal' - AND c.businessTypeFk <> 'worker' + AND bt.code <> 'worker' GROUP BY c.id; DROP TEMPORARY TABLE tmp.zoneNodes;