Merge pull request 'feat: refs #7544 crear evento claim_changeState' (!2552) from 7544-claimChangeState into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2552 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
57500f100e
|
@ -0,0 +1,22 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`claim_changeState`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2024-06-06 07:52:46.000'
|
||||
ON COMPLETION PRESERVE
|
||||
ENABLE
|
||||
DO BEGIN
|
||||
|
||||
DECLARE vClaimState INT;
|
||||
|
||||
SELECT id INTO vClaimState
|
||||
FROM claimState cs
|
||||
WHERE cs.code = 'canceled';
|
||||
|
||||
UPDATE claim c
|
||||
JOIN claimState cs ON cs.id = c.claimStateFk
|
||||
SET c.claimStateFk = vClaimState
|
||||
WHERE c.created < util.VN_CURDATE() - INTERVAL 2 MONTH
|
||||
AND cs.code IN('incomplete','coming','waiting','out');
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue