refactor: refs #6824 Throw for no delete itemShelving with itemShelvingSale
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
c15b4f1bdf
commit
62bd2ae03b
|
@ -2,14 +2,26 @@ DELIMITER $$
|
|||
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelving_beforeDelete`
|
||||
BEFORE DELETE ON `itemShelving`
|
||||
FOR EACH ROW
|
||||
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
|
||||
workerFk,
|
||||
accion,
|
||||
shelvingFk,
|
||||
itemFk)
|
||||
VALUES( OLD.id,
|
||||
account.myUser_getId(),
|
||||
'ELIMINADO',
|
||||
OLD.shelvingFk,
|
||||
OLD.itemFk)$$
|
||||
BEGIN
|
||||
DECLARE vItemShelvingSaleExists BOOL;
|
||||
|
||||
SELECT COUNT(*) INTO vItemShelvingSaleExists
|
||||
FROM itemShelvingSale
|
||||
WHERE itemShelvingFk = OLD.id;
|
||||
|
||||
IF vItemShelvingSaleExists AND @canDeleteItemShelvingSale IS NULL THEN
|
||||
CALL util.throw('Cannot delete item shelving with item shelving sale');
|
||||
END IF;
|
||||
|
||||
INSERT INTO vn.itemShelvingLog(itemShelvingFk,
|
||||
workerFk,
|
||||
accion,
|
||||
shelvingFk,
|
||||
itemFk)
|
||||
VALUES( OLD.id,
|
||||
account.myUser_getId(),
|
||||
'ELIMINADO',
|
||||
OLD.shelvingFk,
|
||||
OLD.itemFk);
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue