From 4f6ae220e1773141b8edf34ca96c3535627999c4 Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 19 Feb 2024 15:10:34 +0100 Subject: [PATCH 01/28] 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/28] 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 9a0b4ef6744640b00dca8f6bdfb4bac1dd7812c5 Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 5 Mar 2024 08:36:19 +0100 Subject: [PATCH 03/28] 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 04/28] 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 05/28] 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 06/28] 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 07/28] 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 ff459ea3be23e076474551f90d18a0fdaf158e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 13 Mar 2024 12:18:43 +0100 Subject: [PATCH 08/28] fix: closeTicket idem salix refs #6549 --- db/routines/vn/procedures/invoiceOut_new.sql | 9 ++- .../10949-limeLaurel/00-firstScript.sql | 5 ++ .../ticket/back/methods/ticket/closeAll.js | 67 +++++++++++++++++++ .../assets/css/import.js | 11 +++ .../invoice-ticket-closure.html | 13 ++++ .../invoice-ticket-closure.js | 19 ++++++ .../invoice-ticket-closure/locale/en.yml | 5 ++ .../invoice-ticket-closure/locale/es.yml | 4 ++ 8 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 db/versions/10949-limeLaurel/00-firstScript.sql create mode 100644 print/templates/email/invoice-ticket-closure/assets/css/import.js create mode 100644 print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html create mode 100644 print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js create mode 100644 print/templates/email/invoice-ticket-closure/locale/en.yml create mode 100644 print/templates/email/invoice-ticket-closure/locale/es.yml diff --git a/db/routines/vn/procedures/invoiceOut_new.sql b/db/routines/vn/procedures/invoiceOut_new.sql index 8c35ce75f..1b486df86 100644 --- a/db/routines/vn/procedures/invoiceOut_new.sql +++ b/db/routines/vn/procedures/invoiceOut_new.sql @@ -68,16 +68,21 @@ BEGIN DELETE ti.* FROM tmp.ticketToInvoice ti JOIN ticket t ON t.id = ti.id + LEFT JOIN address a ON a.id = t.addressFk JOIN sale s ON s.ticketFk = t.id JOIN item i ON i.id = s.itemFk JOIN supplier su ON su.id = t.companyFk JOIN client c ON c.id = t.clientFk - LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id AND itc.countryFk = su.countryFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = su.countryFk WHERE (YEAR(t.shipped) < 2001 AND t.isDeleted) OR c.isTaxDataChecked = FALSE OR t.isDeleted OR c.hasToInvoice = FALSE - OR itc.id IS NULL; + OR itc.id IS NULL + OR a.id IS NULL + OR (vTaxArea = 'WORLD' + AND (a.customsAgentFk IS NULL OR a.incotermsFk IS NULL)); SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 INTO vIsAnySaleToInvoice diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql new file mode 100644 index 000000000..0e2fdaf0c --- /dev/null +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -0,0 +1,5 @@ +INSERT INTO util.notification (id, name, description) + SELECT MAX(id) + 1, + 'invoice-ticket-closure', + 'Tickets not invoiced during the nightly closure ticket process' + FROM util.notification; diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 46c45aa92..829889e9c 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -58,6 +58,73 @@ module.exports = Self => { GROUP BY t.id `, [toDate, toDate]); + await Self.rawSql(` + WITH ticketNotInvoiceable AS( + SELECT JSON_OBJECT( + 'tickets', + JSON_ARRAYAGG( + JSON_OBJECT( + 'ticketId', ticketFk, + 'reason', + LEFT(reason,LENGTH(reason) - 2) + ) + ))errors + FROM ( + SELECT ticketFk, + CONCAT_WS('', + IF(hasErrorToInvoice, 'Facturar, ', ''), + IF(hasErrorTaxDataChecked, 'Datos comprobados, ', ''), + IF(hasErrorDeleted, 'Eliminado, ', ''), + IF(hasErrorItemTaxCountry, 'Impuesto no informado, ', ''), + IF(hasErrorAddress, 'Sin dirección, ', ''), + IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones, ', '')) reason + FROM ( + SELECT t.id ticketFk, + SUM(NOT c.hasToInvoice) hasErrorToInvoice, + SUM(NOT c.isTaxDataChecked) hasErrorTaxDataChecked, + SUM(t.isDeleted) hasErrorDeleted, + SUM(itc.id IS NULL) hasErrorItemTaxCountry, + SUM(a.id IS NULL) hasErrorAddress, + SUM(ios.code IS NOT NULL + AND(ad.customsAgentFk IS NULL + OR ad.incotermsFk IS NULL)) hasErrorInfoTaxAreaWorld + FROM ticket t + LEFT JOIN address ad ON ad.id = t.addressFk + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN supplier su ON su.id = t.companyFk + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN warehouse wh ON wh.id = t.warehouseFk AND wh.hasComission + JOIN ticketState ts ON ts.ticketFk = t.id + JOIN alertLevel al ON al.id = ts.alertLevel + JOIN client c ON c.id = t.clientFk + JOIN province p ON p.id = c.provinceFk + LEFT JOIN autonomy a ON a.id = p.autonomyFk + JOIN country co ON co.id = p.countryFk + LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = su.countryFk + LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD' + AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M') + WHERE (al.code = 'PACKED' + OR (am.code = 'refund' AND al.code != 'delivered')) + AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + AND t.refFk IS NULL + AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice) + GROUP BY ticketFk + HAVING hasErrorToInvoice + OR NOT hasErrorTaxDataChecked + OR hasErrorDeleted + OR hasErrorItemTaxCountry + OR hasErrorAddress + OR hasErrorInfoTaxAreaWorld + )sub + )sub2 + ) SELECT IF(errors = '{"tickets": null}', + 'No errors', + util.notification_send('invoice-ticket-closure', errors, NULL)) + FROM ticketNotInvoiceable`, [toDate, toDate]); + await closure(ctx, Self, tickets); await Self.rawSql(` diff --git a/print/templates/email/invoice-ticket-closure/assets/css/import.js b/print/templates/email/invoice-ticket-closure/assets/css/import.js new file mode 100644 index 000000000..4b4bb7086 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/assets/css/import.js @@ -0,0 +1,11 @@ +const Stylesheet = require(`vn-print/core/stylesheet`); + +const path = require('path'); +const vnPrintPath = path.resolve('print'); + +module.exports = new Stylesheet([ + `${vnPrintPath}/common/css/spacing.css`, + `${vnPrintPath}/common/css/misc.css`, + `${vnPrintPath}/common/css/layout.css`, + `${vnPrintPath}/common/css/email.css`]) + .mergeStyles(); diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html new file mode 100644 index 000000000..051fa2cf8 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html @@ -0,0 +1,13 @@ + +
+
+

{{ $t('title') }} {{ $t('total') }}: {{tickets.length}}

+
+
+
+

{{ $t('ticketId') }}: {{ticket.ticketId}}

+

{{ $t('description') }}: {{ticket.description}}

+
+
+
+
\ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js new file mode 100644 index 000000000..6d12aa247 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js @@ -0,0 +1,19 @@ +const Component = require(`vn-print/core/component`); +const emailBody = new Component(); + +module.exports = { + name: 'invoice-ticket-closure', + components: { + 'email-body': emailBody.build(), + }, + props: { + ticketId: { + type: Number, + required: true + }, + description: { + type: String, + required: true + } + } +}; diff --git a/print/templates/email/invoice-ticket-closure/locale/en.yml b/print/templates/email/invoice-ticket-closure/locale/en.yml new file mode 100644 index 000000000..70345dc81 --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/locale/en.yml @@ -0,0 +1,5 @@ + +subject: Nightly ticket closing process report +title: Nightly ticket closing process report +description: Description +ticketId: Ticket No \ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/locale/es.yml b/print/templates/email/invoice-ticket-closure/locale/es.yml new file mode 100644 index 000000000..e21332f1b --- /dev/null +++ b/print/templates/email/invoice-ticket-closure/locale/es.yml @@ -0,0 +1,4 @@ +subject: Informe proceso de cierre de tickets nocturno +title: Informe proceso de cierre de tickets nocturno +description: Descripción +ticketId: Ticket nº \ 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/28] 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/28] 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/28] 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/28] 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 77d1a38a87eac61c3ce19fc217b3aaf2aaa29636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Wed, 13 Mar 2024 18:51:11 +0100 Subject: [PATCH 13/28] fix: closeTicket idem salix refs #6549 --- db/versions/10949-limeLaurel/00-firstScript.sql | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index 0e2fdaf0c..7b1758285 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -3,3 +3,12 @@ INSERT INTO util.notification (id, name, description) 'invoice-ticket-closure', 'Tickets not invoiced during the nightly closure ticket process' FROM util.notification; + +INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) + SELECT MAX(id), 108 + FROM util.notification; + +INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) + SELECT MAX(id), 108 + FROM util.notification; + \ No newline at end of file From 1315a854a93fc7be7c02c9eab7cf7cca503871d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Mon, 18 Mar 2024 18:15:05 +0100 Subject: [PATCH 14/28] fix: closeTicket idem salix Refs: #6549 --- db/versions/10949-limeLaurel/00-firstScript.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index 7b1758285..ca221501e 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -1,14 +1,14 @@ -INSERT INTO util.notification (id, name, description) - SELECT MAX(id) + 1, - 'invoice-ticket-closure', + INSERT INTO util.notification ( name, description) + SELECT 'invoice-ticket-closure', 'Tickets not invoiced during the nightly closure ticket process' FROM util.notification; + +SET @notificationFk =LAST_INSERT_ID(); INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) - SELECT MAX(id), 108 + SELECT @notificationFk, 108 FROM util.notification; INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) - SELECT MAX(id), 108 - FROM util.notification; - \ No newline at end of file + SELECT @notificationFk, 108 + FROM util.notification; \ No newline at end of file From f6ba5224e608ef83c66421c15cbf51a69c2559e3 Mon Sep 17 00:00:00 2001 From: jcasado Date: Fri, 22 Mar 2024 15:00:30 +0100 Subject: [PATCH 15/28] 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 09e1e4de19e5829c8993a6a93356049e8bd17af0 Mon Sep 17 00:00:00 2001 From: jcasado Date: Wed, 3 Apr 2024 07:23:36 +0200 Subject: [PATCH 16/28] 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 0f8b80d533477dd0def25a2313cbd8136df5e237 Mon Sep 17 00:00:00 2001 From: jcasado Date: Thu, 4 Apr 2024 09:40:43 +0200 Subject: [PATCH 17/28] 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 f5943e44451c0f034797ba26d41f8af927d62721 Mon Sep 17 00:00:00 2001 From: jcasado Date: Thu, 4 Apr 2024 13:57:23 +0200 Subject: [PATCH 18/28] 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 19/28] 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 75a4d6947fe07eb3a35da93086eb8ba2b1c66fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 14:20:55 +0200 Subject: [PATCH 20/28] fix: closeTicket idem salix Refs: #6549 --- .../invoice-ticket-closure/invoice-ticket-closure.html | 4 ++-- .../invoice-ticket-closure/invoice-ticket-closure.js | 10 +++------- .../email/invoice-ticket-closure/locale/en.yml | 3 +-- .../email/invoice-ticket-closure/locale/es.yml | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html index 051fa2cf8..2effa8917 100644 --- a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.html @@ -1,12 +1,12 @@
-

{{ $t('title') }} {{ $t('total') }}: {{tickets.length}}

+

{{ $t('title') }}


{{ $t('ticketId') }}: {{ticket.ticketId}}

-

{{ $t('description') }}: {{ticket.description}}

+

{{ $t('reason') }}: {{ticket.reason}}


diff --git a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js index 6d12aa247..31690ecbd 100644 --- a/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js +++ b/print/templates/email/invoice-ticket-closure/invoice-ticket-closure.js @@ -1,5 +1,5 @@ const Component = require(`vn-print/core/component`); -const emailBody = new Component(); +const emailBody = new Component('email-body'); module.exports = { name: 'invoice-ticket-closure', @@ -7,13 +7,9 @@ module.exports = { 'email-body': emailBody.build(), }, props: { - ticketId: { - type: Number, + tickets: { + type: Array, required: true }, - description: { - type: String, - required: true - } } }; diff --git a/print/templates/email/invoice-ticket-closure/locale/en.yml b/print/templates/email/invoice-ticket-closure/locale/en.yml index 70345dc81..844dada7a 100644 --- a/print/templates/email/invoice-ticket-closure/locale/en.yml +++ b/print/templates/email/invoice-ticket-closure/locale/en.yml @@ -1,5 +1,4 @@ - subject: Nightly ticket closing process report title: Nightly ticket closing process report -description: Description +reason: Reason ticketId: Ticket No \ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/locale/es.yml b/print/templates/email/invoice-ticket-closure/locale/es.yml index e21332f1b..a8e67f18f 100644 --- a/print/templates/email/invoice-ticket-closure/locale/es.yml +++ b/print/templates/email/invoice-ticket-closure/locale/es.yml @@ -1,4 +1,4 @@ subject: Informe proceso de cierre de tickets nocturno title: Informe proceso de cierre de tickets nocturno -description: Descripción +reason: Motivo ticketId: Ticket nº \ No newline at end of file From 9fcad457a70fb0d127669e49980350e0236395bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 14:46:51 +0200 Subject: [PATCH 21/28] fix: closeTicket idem salix Refs: #6549 --- .../ticket/back/methods/ticket/closeAll.js | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index 61de1cd04..c14f33346 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -62,14 +62,15 @@ module.exports = Self => { await Self.rawSql(` WITH ticketNotInvoiceable AS( SELECT JSON_OBJECT( - 'tickets', - JSON_ARRAYAGG( - JSON_OBJECT( - 'ticketId', ticketFk, - 'reason', - LEFT(reason,LENGTH(reason) - 2) + 'tickets', + JSON_ARRAYAGG( + JSON_OBJECT( + 'ticketId', ticketFk, + 'reason', + LEFT(reason,LENGTH(reason) - 2) + ) ) - ))errors + )errors FROM ( SELECT ticketFk, CONCAT_WS('', @@ -87,8 +88,8 @@ module.exports = Self => { SUM(itc.id IS NULL) hasErrorItemTaxCountry, SUM(a.id IS NULL) hasErrorAddress, SUM(ios.code IS NOT NULL - AND(ad.customsAgentFk IS NULL - OR ad.incotermsFk IS NULL)) hasErrorInfoTaxAreaWorld + AND(ad.customsAgentFk IS NULL + OR ad.incotermsFk IS NULL)) hasErrorInfoTaxAreaWorld FROM ticket t LEFT JOIN address ad ON ad.id = t.addressFk JOIN sale s ON s.ticketFk = t.id @@ -107,14 +108,13 @@ module.exports = Self => { AND itc.countryFk = su.countryFk LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD' AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M') - WHERE (al.code = 'PACKED' - OR (am.code = 'refund' AND al.code != 'delivered')) - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) + AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND t.refFk IS NULL AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice) GROUP BY ticketFk HAVING hasErrorToInvoice - OR NOT hasErrorTaxDataChecked + OR hasErrorTaxDataChecked OR hasErrorDeleted OR hasErrorItemTaxCountry OR hasErrorAddress @@ -130,12 +130,12 @@ module.exports = Self => { await Self.rawSql(` UPDATE ticket t - JOIN ticketState ts ON t.id = ts.ticketFk - JOIN alertLevel al ON al.id = ts.alertLevel - JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - JOIN zone z ON z.id = t.zoneFk - SET t.routeFk = NULL + JOIN ticketState ts ON t.id = ts.ticketFk + JOIN alertLevel al ON al.id = ts.alertLevel + JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN zone z ON z.id = t.zoneFk + SET t.routeFk = NULL WHERE DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) AND al.code NOT IN('DELIVERED','PACKED') From a6e4bdd7ac09b6d052420f911d9377f9849fe83e Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 4 Apr 2024 15:02:41 +0200 Subject: [PATCH 22/28] 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('fields.previousSalesVolume')}}:{{$t('fields.previousSellsVolume')}}: -
- -
+
{{$t('fields.forecastedSalesVolume')}}: -
- -
-
{{$t('fields.forecastedPurchases')}}: -
- -
+
{{$t('fields.personFilling')}}: -
- -
+
{{$t('fields.phone')}}: -
- -
+
- - - - - - - - ' 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 fe0afe30bf91c78a5629fcc071de3fd40c99f73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 17:50:39 +0200 Subject: [PATCH 23/28] fix: closeTicket idem salix Refs: #6549 --- .../10949-limeLaurel/00-firstScript.sql | 12 +++++---- .../ticket/back/methods/ticket/closeAll.js | 26 +++++++++---------- .../invoice-ticket-closure/locale/en.yml | 2 +- .../invoice-ticket-closure/locale/es.yml | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index ca221501e..58d50e125 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -6,9 +6,11 @@ SET @notificationFk =LAST_INSERT_ID(); INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) - SELECT @notificationFk, 108 - FROM util.notification; - + SELECT @notificationFk,id + FROM account.role + WHERE name ='administrative'; + INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) - SELECT @notificationFk, 108 - FROM util.notification; \ No newline at end of file + SELECT @notificationFk, id + FROM account.`user` + WHERE `name` = 'admon'; diff --git a/modules/ticket/back/methods/ticket/closeAll.js b/modules/ticket/back/methods/ticket/closeAll.js index c14f33346..3e35c5ebc 100644 --- a/modules/ticket/back/methods/ticket/closeAll.js +++ b/modules/ticket/back/methods/ticket/closeAll.js @@ -53,8 +53,8 @@ module.exports = Self => { JOIN province p ON p.id = c.provinceFk JOIN country co ON co.id = p.countryFk LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk - WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')) - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) + AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) AND t.refFk IS NULL GROUP BY t.id `, [toDate, toDate]); @@ -66,20 +66,19 @@ module.exports = Self => { JSON_ARRAYAGG( JSON_OBJECT( 'ticketId', ticketFk, - 'reason', - LEFT(reason,LENGTH(reason) - 2) + 'reason', reason ) ) )errors FROM ( SELECT ticketFk, - CONCAT_WS('', - IF(hasErrorToInvoice, 'Facturar, ', ''), - IF(hasErrorTaxDataChecked, 'Datos comprobados, ', ''), - IF(hasErrorDeleted, 'Eliminado, ', ''), - IF(hasErrorItemTaxCountry, 'Impuesto no informado, ', ''), - IF(hasErrorAddress, 'Sin dirección, ', ''), - IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones, ', '')) reason + CONCAT_WS(', ', + IF(hasErrorToInvoice, 'Facturar', NULL), + IF(hasErrorTaxDataChecked, 'Datos comprobados', NULL), + IF(hasErrorDeleted, 'Eliminado', NULL), + IF(hasErrorItemTaxCountry, 'Impuesto no informado', NULL), + IF(hasErrorAddress, 'Sin dirección', NULL), + IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones', NULL)) reason FROM ( SELECT t.id ticketFk, SUM(NOT c.hasToInvoice) hasErrorToInvoice, @@ -109,7 +108,7 @@ module.exports = Self => { LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD' AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M') WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered')) - AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?) + AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) AND t.refFk IS NULL AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice) GROUP BY ticketFk @@ -136,8 +135,7 @@ module.exports = Self => { JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk JOIN zone z ON z.id = t.zoneFk SET t.routeFk = NULL - WHERE DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) - AND util.dayEnd(?) + WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?) AND al.code NOT IN('DELIVERED','PACKED') AND t.routeFk AND z.name LIKE '%MADRID%'`, [toDate, toDate], {userId: ctx.req.accessToken.userId}); diff --git a/print/templates/email/invoice-ticket-closure/locale/en.yml b/print/templates/email/invoice-ticket-closure/locale/en.yml index 844dada7a..fef73d23f 100644 --- a/print/templates/email/invoice-ticket-closure/locale/en.yml +++ b/print/templates/email/invoice-ticket-closure/locale/en.yml @@ -1,4 +1,4 @@ subject: Nightly ticket closing process report title: Nightly ticket closing process report reason: Reason -ticketId: Ticket No \ No newline at end of file +ticketId: Ticket \ No newline at end of file diff --git a/print/templates/email/invoice-ticket-closure/locale/es.yml b/print/templates/email/invoice-ticket-closure/locale/es.yml index a8e67f18f..7d146b83d 100644 --- a/print/templates/email/invoice-ticket-closure/locale/es.yml +++ b/print/templates/email/invoice-ticket-closure/locale/es.yml @@ -1,4 +1,4 @@ subject: Informe proceso de cierre de tickets nocturno title: Informe proceso de cierre de tickets nocturno reason: Motivo -ticketId: Ticket nº \ No newline at end of file +ticketId: Ticket \ No newline at end of file From 2f4cd2bc7bb0f1373776f4daa1432faf9a3f6789 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 5 Apr 2024 10:05:51 +0200 Subject: [PATCH 24/28] 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 cedfdbb421f2dbfacc1855a5bf4d12092551d008 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Fri, 5 Apr 2024 13:22:54 +0200 Subject: [PATCH 25/28] fix: closeTicket idem salix Refs: #6549 --- .../10949-limeLaurel/00-firstScript.sql | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/db/versions/10949-limeLaurel/00-firstScript.sql b/db/versions/10949-limeLaurel/00-firstScript.sql index 58d50e125..cc0bcc96b 100644 --- a/db/versions/10949-limeLaurel/00-firstScript.sql +++ b/db/versions/10949-limeLaurel/00-firstScript.sql @@ -1,16 +1,15 @@ - INSERT INTO util.notification ( name, description) - SELECT 'invoice-ticket-closure', - 'Tickets not invoiced during the nightly closure ticket process' - FROM util.notification; - -SET @notificationFk =LAST_INSERT_ID(); + INSERT INTO util.notification ( name, description) + SELECT 'invoice-ticket-closure', + 'Tickets not invoiced during the nightly closure ticket process'; + + SET @notificationFk =LAST_INSERT_ID(); -INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) - SELECT @notificationFk,id - FROM account.role - WHERE name ='administrative'; + INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk) + SELECT @notificationFk,id + FROM account.role + WHERE name ='administrative'; -INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) - SELECT @notificationFk, id - FROM account.`user` - WHERE `name` = 'admon'; + INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk) + SELECT @notificationFk, id + FROM account.`user` + WHERE `name` = 'admon'; From 0b96471c7de81e81b932a63ac8d141e38c350f33 Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 8 Apr 2024 09:27:07 +0200 Subject: [PATCH 26/28] 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; From ccc644c298460f48bb6a129bc18d1c31968e89e1 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 8 Apr 2024 13:07:04 +0200 Subject: [PATCH 27/28] fix: refs #6021 dump, floranet schema added --- db/dump/.dump/data.sql | 6 +- db/dump/.dump/privileges.sql | 1 + db/dump/.dump/structure.sql | 419 ++++++++++++++++++++++++++++++++++- db/dump/.dump/triggers.sql | 8 +- myt.config.yml | 1 + 5 files changed, 430 insertions(+), 5 deletions(-) diff --git a/db/dump/.dump/data.sql b/db/dump/.dump/data.sql index 3779a5812..8b6a01c61 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','7ea917dc4db761955007c73bbd4667a0e44b8e9c','2024-04-05 07:49:24','10981'); +INSERT INTO `version` VALUES ('vn-database','10970','273507d3b711f272078e83880802d0ef7278d062','2024-04-05 10:33:29','10983'); 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); @@ -762,7 +762,7 @@ INSERT INTO `role` VALUES (1,'employee','Empleado básico',1,'2017-05-19 09:04:5 INSERT INTO `role` VALUES (2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 09:04:58','2023-06-02 22:33:28',NULL); 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 (6,'guest','Privilegios para usuarios no autenticados',1,'2017-05-19 09:04:58','2024-04-06 12:05:08',1437); 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); @@ -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','developer'); +INSERT INTO `ACL` VALUES (823,'MailAlias','*','*','ALLOW','ROLE','developerBoss'); INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee'); INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee'); diff --git a/db/dump/.dump/privileges.sql b/db/dump/.dump/privileges.sql index 8293cc74c..491459986 100644 --- a/db/dump/.dump/privileges.sql +++ b/db/dump/.dump/privileges.sql @@ -1378,6 +1378,7 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','maintenanceBos','machineDetai 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',''); +INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','claimRatio','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select',''); /*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */; /*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */; diff --git a/db/dump/.dump/structure.sql b/db/dump/.dump/structure.sql index 5cc320fd4..023a997d3 100644 --- a/db/dump/.dump/structure.sql +++ b/db/dump/.dump/structure.sql @@ -11740,6 +11740,417 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Current Database: `floranet` +-- + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `floranet` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci */; + +USE `floranet`; + +-- +-- Table structure for table `addressPostCode` +-- + +DROP TABLE IF EXISTS `addressPostCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `addressPostCode` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `addressFk` int(11) NOT NULL, + `postCode` varchar(30) NOT NULL, + `hoursInAdvance` int(10) unsigned NOT NULL DEFAULT 24, + `dayOfWeek` int(10) unsigned NOT NULL, + `deliveryCost` decimal(10,2) NOT NULL DEFAULT 0.00, + PRIMARY KEY (`id`), + UNIQUE KEY `addressPostCode_unique` (`postCode`,`addressFk`,`dayOfWeek`), + KEY `addressPostCode_address_FK` (`addressFk`), + CONSTRAINT `addressPostCode_address_FK` FOREIGN KEY (`addressFk`) REFERENCES `vn`.`address` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Client''s address registered for floranet network'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `builder` +-- + +DROP TABLE IF EXISTS `builder`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `builder` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) NOT NULL, + `elementFk` int(11) NOT NULL, + `quantity` int(10) unsigned NOT NULL DEFAULT 1, + PRIMARY KEY (`id`), + KEY `builder_FK` (`itemFk`), + KEY `builder_FK_1` (`elementFk`), + CONSTRAINT `builder_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `builder_FK_1` FOREIGN KEY (`elementFk`) REFERENCES `element` (`itemFk`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Links handmade products with their elements'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `catalogue` +-- + +DROP TABLE IF EXISTS `catalogue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `catalogue` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) DEFAULT NULL, + `price` decimal(10,2) NOT NULL, + `itemFk` int(11) NOT NULL, + `dated` date DEFAULT NULL, + `postalCode` varchar(12) DEFAULT NULL, + `type` varchar(50) DEFAULT NULL, + `image` varchar(255) DEFAULT NULL, + `description` text DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + `payed` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `itemFk` (`itemFk`), + CONSTRAINT `catalogue_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `element` +-- + +DROP TABLE IF EXISTS `element`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `element` ( + `itemFk` int(11) NOT NULL, + `typeFk` smallint(5) unsigned DEFAULT NULL, + `size` int(11) DEFAULT NULL, + `inkFk` char(3) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL, + `originFk` tinyint(2) unsigned DEFAULT NULL, + `name` varchar(30) DEFAULT NULL, + `quantity` int(11) NOT NULL DEFAULT 1, + PRIMARY KEY (`itemFk`), + KEY `element_FK` (`itemFk`), + KEY `element_FK_1` (`typeFk`), + KEY `element_FK_2` (`inkFk`), + KEY `element_FK_3` (`originFk`), + CONSTRAINT `element_FK` FOREIGN KEY (`itemFk`) REFERENCES `vn`.`item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `element_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `vn`.`itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `element_FK_2` FOREIGN KEY (`inkFk`) REFERENCES `vn`.`ink` (`id`) ON UPDATE CASCADE, + CONSTRAINT `element_FK_3` FOREIGN KEY (`originFk`) REFERENCES `vn`.`origin` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='Filtro para localizar posibles items que coincidan con la descripción'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `order` +-- + +DROP TABLE IF EXISTS `order`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `order` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `catalogueFk` int(11) DEFAULT NULL, + `customerName` varchar(100) DEFAULT NULL, + `email` varchar(100) DEFAULT NULL, + `customerPhone` varchar(15) DEFAULT NULL, + `message` varchar(255) DEFAULT NULL, + `deliveryName` varchar(100) DEFAULT NULL, + `address` varchar(200) DEFAULT NULL, + `deliveryPhone` varchar(100) DEFAULT NULL, + `isPaid` tinyint(1) NOT NULL DEFAULT 0, + `payed` datetime DEFAULT NULL, + `created` timestamp NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `catalogueFk` (`catalogueFk`), + CONSTRAINT `order_ibfk_1` FOREIGN KEY (`catalogueFk`) REFERENCES `catalogue` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping events for database 'floranet' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `clean` */; +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 = 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 */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `clean` ON SCHEDULE EVERY 1 DAY STARTS '2024-01-01 23:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN + DELETE + FROM `order` + WHERE created < CURDATE() + AND isPaid = FALSE; + + DELETE c.* + FROM catalogue c + LEFT JOIN `order` o ON o.catalogueFk = c.id + WHERE c.created < CURDATE() + AND o.id IS NULL; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!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 */ ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + +-- +-- Dumping routines for database 'floranet' +-- +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 DROP PROCEDURE IF EXISTS `catalogue_get` */; +/*!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 `catalogue_get`(vLanded DATE, vPostalCode VARCHAR(15)) + READS SQL DATA +BEGIN +/** + * Returns list, price and all the stuff regarding the floranet items + * + * @param vLanded Delivery date + * @param vPostalCode Delivery address postal code + */ + DECLARE vLastCatalogueFk INT; + + START TRANSACTION; + + SELECT * FROM catalogue FOR UPDATE; + + SELECT MAX(id) INTO vLastCatalogueFk + FROM catalogue; + + INSERT INTO catalogue( + name, + price, + itemFk, + dated, + postalCode, + `type`, + image, + description + ) + SELECT i.name, + i.`size`, + i.id, + vLanded, + vPostalCode, + it.name, + CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image), + i.description + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + WHERE it.code IN ('FNR','FNP'); + + SELECT * + FROM catalogue + WHERE id > IFNULL(vLastCatalogueFk,0); + + COMMIT; + +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 `contact_request` */; +/*!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 `contact_request`( + vName VARCHAR(100), + vPhone VARCHAR(15), + vEmail VARCHAR(100), + vMessage TEXT) + READS SQL DATA +BEGIN +/** + * Set actions for contact request. + * + * @param vPostalCode Delivery address postal code + */ + +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 `deliveryDate_get` */; +/*!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 `deliveryDate_get`(vPostalCode VARCHAR(15)) + READS SQL DATA +BEGIN +/** + * Returns available dates for this postalCode, in the next seven days + * + * @param vPostalCode Delivery address postal code + */ + DECLARE vCurrentDayOfWeek INT; + + SET vCurrentDayOfWeek = DAYOFWEEK(NOW()); + + SELECT DISTINCT nextDay + FROM ( + SELECT CURDATE() + INTERVAL IF( + apc.dayOfWeek >= vCurrentDayOfWeek, + apc.dayOfWeek - vCurrentDayOfWeek, + 7 - apc.dayOfWeek + ) DAY nextDay, + NOW() + INTERVAL apc.hoursInAdvance - 12 HOUR minDeliveryTime + FROM addressPostCode apc + WHERE apc.postCode = vPostalCode + HAVING nextDay > minDeliveryTime) sub; +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 `order_confirm` */; +/*!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 `order_confirm`(vCatalogueFk INT) + READS SQL DATA +BEGIN +/** Update order.isPaid field + * + * @param vCatalogueFk floranet.catalogue.id + * + * @returns floranet.order.isPaid + */ + UPDATE `order` + SET isPaid = TRUE, + payed = NOW() + WHERE catalogueFk = vCatalogueFk; + + SELECT isPaid + FROM `order` + WHERE catalogueFk = vCatalogueFk; +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 `order_put` */; +/*!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 `order_put`(vOrder JSON) + READS SQL DATA +BEGIN +/** + * Get and process an order + * + * @param vOrder Data of the order + * + * Customer data: , , + * + * Item data: , + * + * Delivery data: ,
, + * + */ + INSERT IGNORE INTO `order`( + catalogueFk, + customerName, + email, + customerPhone, + message, + deliveryName, + address, + deliveryPhone + ) + VALUES (JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.catalogueFk')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.customerName')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.email')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.customerPhone')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.message')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.deliveryName')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.address')), + JSON_UNQUOTE(JSON_EXTRACT(vOrder,'$.deliveryPhone')) + ); + + SELECT LAST_INSERT_ID() orderFk; +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 `sliders_get` */; +/*!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 `sliders_get`() + READS SQL DATA +BEGIN +/** + * Returns list of url for sliders + */ + SELECT + CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image) url, + i.longName + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + WHERE it.code IN ('FNR','FNP'); + +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 */ ; + -- -- Current Database: `hedera` -- @@ -86045,6 +86456,12 @@ USE `edi`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; +-- +-- Current Database: `floranet` +-- + +USE `floranet`; + -- -- Current Database: `hedera` -- @@ -91244,4 +91661,4 @@ USE `vn2008`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-04-05 7:59:52 +-- Dump completed on 2024-04-08 7:13:58 diff --git a/db/dump/.dump/triggers.sql b/db/dump/.dump/triggers.sql index fd73baf16..cdf611d5b 100644 --- a/db/dump/.dump/triggers.sql +++ b/db/dump/.dump/triggers.sql @@ -820,6 +820,12 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Current Database: `floranet` +-- + +USE `floranet`; + -- -- Current Database: `hedera` -- @@ -10991,4 +10997,4 @@ USE `vn2008`; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-04-05 8:00:14 +-- Dump completed on 2024-04-08 7:14:22 diff --git a/myt.config.yml b/myt.config.yml index d7d1ad181..2ac8b8e5e 100755 --- a/myt.config.yml +++ b/myt.config.yml @@ -11,6 +11,7 @@ schemas: - cache - dipole - edi + - floranet - hedera - pbx - psico From 2eb229adf72819078e9a241048c40508f780f26d Mon Sep 17 00:00:00 2001 From: Pako Date: Mon, 8 Apr 2024 14:30:46 +0200 Subject: [PATCH 28/28] catalogue fixed --- .../floranet/procedures/catalogue_get.sql | 20 +++++++++++++++---- .../floranet/procedures/sliders_get.sql | 3 ++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/db/routines/floranet/procedures/catalogue_get.sql b/db/routines/floranet/procedures/catalogue_get.sql index b6ec61522..e45fa7ddf 100644 --- a/db/routines/floranet/procedures/catalogue_get.sql +++ b/db/routines/floranet/procedures/catalogue_get.sql @@ -4,7 +4,7 @@ DELIMITER $$ $$ CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15)) READS SQL DATA -BEGIN +proc:BEGIN /** * Returns list, price and all the stuff regarding the floranet items * @@ -12,10 +12,22 @@ BEGIN * @param vPostalCode Delivery address postal code */ DECLARE vLastCatalogueFk INT; + DECLARE vLockName VARCHAR(20); + DECLARE vLockTime INT; - START TRANSACTION; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK(vLockName); - SELECT * FROM catalogue FOR UPDATE; + RESIGNAL; + END; + + SET vLockName = 'catalogue_get'; + SET vLockTime = 15; + + IF NOT GET_LOCK(vLockName, vLockTime) THEN + LEAVE proc; + END IF; SELECT MAX(id) INTO vLastCatalogueFk FROM catalogue; @@ -46,7 +58,7 @@ BEGIN FROM catalogue WHERE id > IFNULL(vLastCatalogueFk,0); - COMMIT; + DO RELEASE_LOCK(vLockName); END$$ DELIMITER ; diff --git a/db/routines/floranet/procedures/sliders_get.sql b/db/routines/floranet/procedures/sliders_get.sql index 2f77b8534..bd791dec7 100644 --- a/db/routines/floranet/procedures/sliders_get.sql +++ b/db/routines/floranet/procedures/sliders_get.sql @@ -13,7 +13,8 @@ BEGIN i.longName FROM vn.item i JOIN vn.itemType it ON it.id = i.typeFk - WHERE it.code IN ('FNR','FNP'); + WHERE it.code IN ('FNR','FNP') + LIMIT 3; END$$ DELIMITER ; \ No newline at end of file