salix/db/routines/vn/triggers/itemShelvingSale_afterInser...

12 lines
342 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelvingSale_afterInsert`
AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW
BEGIN
UPDATE sale s
JOIN operator o ON o.workerFk = account.myUser_getId()
SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
WHERE id = NEW.saleFk;
END$$
DELIMITER ;