From e8dc6eafdcb8cf99f5bb105bb0f2c0df007b1796 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 27 Jun 2024 10:18:43 +0200 Subject: [PATCH 1/3] refs #7640 multiple inventory --- .../vn/procedures/multipleInventory.sql | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/db/routines/vn/procedures/multipleInventory.sql b/db/routines/vn/procedures/multipleInventory.sql index 2a28aa9a0..1bbf4c6c7 100644 --- a/db/routines/vn/procedures/multipleInventory.sql +++ b/db/routines/vn/procedures/multipleInventory.sql @@ -1,9 +1,9 @@ -DELIMITER $$ +DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`multipleInventory`( vDate DATE, vWarehouseFk TINYINT, vMaxDays TINYINT -) +) proc: BEGIN DECLARE vDateTomorrow DATE DEFAULT vDate + INTERVAL 1 DAY; DECLARE vDateFrom DATE DEFAULT vDate; @@ -36,9 +36,12 @@ proc: BEGIN ADD `life` TINYINT NOT NULL DEFAULT '0'; -- Calculo del inventario - UPDATE tmp.itemInventory ai - JOIN ( - SELECT itemFk Id_Article, SUM(quantity) Subtotal + CREATE OR REPLACE TEMPORARY TABLE tItemInventoryCalc + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT itemFk, + SUM(quantity) quantity, + SUM(quantity) visible FROM ( SELECT s.itemFk, - s.quantity quantity FROM sale s @@ -69,18 +72,13 @@ proc: BEGIN AND w.isComparative AND NOT e.isExcludedFromAvailable AND NOT e.isRaid - ) sub2 - GROUP BY itemFk - ) sub ON ai.id = sub.Id_Article - SET ai.inventory = sub.Subtotal, - ai.visible = sub.Subtotal, - ai.avalaible = sub.Subtotal, - ai.sd = sub.Subtotal; + ) sub + GROUP BY itemFk; -- Cálculo del visible - UPDATE tmp.itemInventory ai + UPDATE tItemInventoryCalc iic JOIN ( - SELECT itemFk Id_Article, SUM(quantity) Subtotal + SELECT itemFk, SUM(quantity) visible FROM ( SELECT s.itemFk, s.quantity FROM sale s @@ -117,8 +115,15 @@ proc: BEGIN AND w.isComparative ) sub2 GROUP BY itemFk - ) sub ON ai.id = sub.Id_Article - SET ai.visible = ai.visible + sub.Subtotal; + ) sub ON sub.itemFk = iic.itemFk + SET iic.visible = iic.visible + sub.visible; + + UPDATE tmp.itemInventory ai + JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id + SET ai.inventory = iic.quantity, + ai.visible = iic.visible, + ai.avalaible = iic.quantity, + ai.sd = iic.quantity; -- Calculo del disponible CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc @@ -189,6 +194,7 @@ proc: BEGIN DROP TEMPORARY TABLE tmp.itemTravel, tmp.itemCalc, + tItemInventoryCalc, tmp.itemAtp; -END$$ -DELIMITER ; +END$$ +DELIMITER ; From 9164901eac6a512d59310dc4d356d8915d70b027 Mon Sep 17 00:00:00 2001 From: guillermo Date: Thu, 27 Jun 2024 13:26:59 +0200 Subject: [PATCH 2/3] refs #7640 Requested changes --- db/routines/vn/procedures/multipleInventory.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/routines/vn/procedures/multipleInventory.sql b/db/routines/vn/procedures/multipleInventory.sql index 1bbf4c6c7..ece57727d 100644 --- a/db/routines/vn/procedures/multipleInventory.sql +++ b/db/routines/vn/procedures/multipleInventory.sql @@ -119,11 +119,11 @@ proc: BEGIN SET iic.visible = iic.visible + sub.visible; UPDATE tmp.itemInventory ai - JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id - SET ai.inventory = iic.quantity, - ai.visible = iic.visible, - ai.avalaible = iic.quantity, - ai.sd = iic.quantity; + JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id + SET ai.inventory = iic.quantity, + ai.visible = iic.visible, + ai.avalaible = iic.quantity, + ai.sd = iic.quantity; -- Calculo del disponible CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc From 355e426ccf8213b4795e93ed7971d77dc7158c67 Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 1 Jul 2024 07:19:00 +0200 Subject: [PATCH 3/3] mail-alias-account con mixin --- modules/account/back/models/mail-alias-account.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/account/back/models/mail-alias-account.json b/modules/account/back/models/mail-alias-account.json index 54e986ef7..46d4793e6 100644 --- a/modules/account/back/models/mail-alias-account.json +++ b/modules/account/back/models/mail-alias-account.json @@ -6,6 +6,9 @@ "table": "account.mailAliasAccount" } }, + "mixins": { + "Loggable": true + }, "properties": { "id": { "type": "number",