2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterInsert`
|
2024-01-15 11:31:03 +00:00
|
|
|
AFTER INSERT ON `collectionVolumetry`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
DECLARE vJSON JSON DEFAULT JSON_OBJECT();
|
|
|
|
DECLARE vUserFk INT DEFAULT account.myUser_getId();
|
|
|
|
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('id', NEW.id), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('level', NEW.level), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('lines', NEW.lines), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('liters', NEW.liters), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('height', NEW.height), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('itemPackingTypeFk', NEW.itemPackingTypeFk), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('trainFk', NEW.trainFk), vJSON);
|
|
|
|
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('userFk', vUserFk), vJSON);
|
|
|
|
SET vJSON = JSON_MERGE(JSON_OBJECT('action', 'insert'), vJSON);
|
|
|
|
|
|
|
|
SET vJSON = util.notification_send(
|
|
|
|
'modified-collection-volumetry',
|
|
|
|
JSON_OBJECT('data', JSON_EXTRACT(vJSON, '$')),
|
|
|
|
vUserFk
|
|
|
|
);
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|