2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_afterUpdate`
|
|
|
|
AFTER UPDATE ON `travel`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
2024-03-01 13:26:36 +00:00
|
|
|
IF NOT(NEW.shipped <=> OLD.shipped) THEN
|
2024-04-08 07:11:40 +00:00
|
|
|
UPDATE entry
|
2024-01-15 11:31:03 +00:00
|
|
|
SET commission = entry_getCommission(travelFk, currencyFk,supplierFk)
|
|
|
|
WHERE travelFk = NEW.id;
|
|
|
|
END IF;
|
2024-01-30 14:07:13 +00:00
|
|
|
|
|
|
|
IF NOT (NEW.agencyModeFk <=> OLD.agencyModeFk) THEN
|
|
|
|
IF (SELECT hasWeightVolumetric FROM agencyMode WHERE id = NEW.agencyModeFk) THEN
|
|
|
|
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
|
|
|
SELECT b.id
|
2024-04-08 07:11:40 +00:00
|
|
|
FROM entry e
|
2024-01-30 14:07:13 +00:00
|
|
|
JOIN buy b ON b.entryFk = e.id
|
|
|
|
JOIN item i ON i.id = b.itemFk
|
|
|
|
WHERE e.travelFk = NEW.id;
|
2024-04-08 07:11:40 +00:00
|
|
|
|
2024-01-30 14:07:13 +00:00
|
|
|
CALL buy_checkItem();
|
|
|
|
END IF;
|
|
|
|
END IF;
|
2024-01-15 11:31:03 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|