Merge pull request 'feat: refs #6395 Added buyerFk in buy' (!2020) from 6395-buyBuyerFk into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2020 Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
a76b7c8535
|
@ -9,6 +9,7 @@ trig: BEGIN
|
||||||
DECLARE vGroupingMode TINYINT;
|
DECLARE vGroupingMode TINYINT;
|
||||||
DECLARE vGenericFk INT;
|
DECLARE vGenericFk INT;
|
||||||
DECLARE vGenericInDate BOOL;
|
DECLARE vGenericInDate BOOL;
|
||||||
|
DECLARE vBuyerFk INT;
|
||||||
|
|
||||||
IF @isModeInventory THEN
|
IF @isModeInventory THEN
|
||||||
LEAVE trig;
|
LEAVE trig;
|
||||||
|
@ -20,6 +21,13 @@ trig: BEGIN
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
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`);
|
CALL buy_checkGrouping(NEW.`grouping`);
|
||||||
|
|
||||||
SELECT t.warehouseInFk, t.landed
|
SELECT t.warehouseInFk, t.landed
|
||||||
|
|
|
@ -7,6 +7,7 @@ trig:BEGIN
|
||||||
DECLARE vGenericInDate BOOL;
|
DECLARE vGenericInDate BOOL;
|
||||||
DECLARE vIsInventory BOOL;
|
DECLARE vIsInventory BOOL;
|
||||||
DECLARE vDefaultEntry INT;
|
DECLARE vDefaultEntry INT;
|
||||||
|
DECLARE vBuyerFk INT;
|
||||||
|
|
||||||
IF @isTriggerDisabled THEN
|
IF @isTriggerDisabled THEN
|
||||||
LEAVE trig;
|
LEAVE trig;
|
||||||
|
@ -65,6 +66,15 @@ trig:BEGIN
|
||||||
SET NEW.isIgnored = TRUE;
|
SET NEW.isIgnored = TRUE;
|
||||||
END IF;
|
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
|
IF NOT (NEW.itemFk <=> OLD.itemFk) OR
|
||||||
NOT (OLD.entryFk <=> NEW.entryFk) THEN
|
NOT (OLD.entryFk <=> NEW.entryFk) THEN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.buy ADD buyerFk int(10) unsigned DEFAULT NULL NULL;
|
Loading…
Reference in New Issue