From 1c6e881273bb3997c572ea1f8f92fe88d033334e Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 6 Jun 2024 11:45:09 +0200 Subject: [PATCH 1/3] feat: refs #7544 crear evento claim_changeState --- db/routines/vn/events/claim_changeState.sql | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 db/routines/vn/events/claim_changeState.sql diff --git a/db/routines/vn/events/claim_changeState.sql b/db/routines/vn/events/claim_changeState.sql new file mode 100644 index 000000000..c9e4c3cc5 --- /dev/null +++ b/db/routines/vn/events/claim_changeState.sql @@ -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 vClaimStete INT; + + SELECT id INTO vClaimStete + FROM claimState cs + WHERE cs.code = 'canceled' + + UPDATE claim c + JOIN claimState cs ON cs.id = c.claimStateFk + SET c.claimStateFk = vClaimStete + WHERE c.created < util.VN_CURDATE() - INTERVAL 2 MONTH + AND cs.code IN('incomplete','coming','waiting','out') + +END$$ +DELIMITER ; -- 2.40.1 From ef50d493f18602f9c37fddf05ee2e357404f8182 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 6 Jun 2024 11:54:39 +0200 Subject: [PATCH 2/3] feat: refs #7544 --- db/routines/vn/events/claim_changeState.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/events/claim_changeState.sql b/db/routines/vn/events/claim_changeState.sql index c9e4c3cc5..790ef0c34 100644 --- a/db/routines/vn/events/claim_changeState.sql +++ b/db/routines/vn/events/claim_changeState.sql @@ -10,13 +10,13 @@ DO BEGIN SELECT id INTO vClaimStete FROM claimState cs - WHERE cs.code = 'canceled' + WHERE cs.code = 'canceled'; UPDATE claim c JOIN claimState cs ON cs.id = c.claimStateFk SET c.claimStateFk = vClaimStete WHERE c.created < util.VN_CURDATE() - INTERVAL 2 MONTH - AND cs.code IN('incomplete','coming','waiting','out') + AND cs.code IN('incomplete','coming','waiting','out'); END$$ DELIMITER ; -- 2.40.1 From f8169b3034e24ebc217c9bce76f9ce54975afbab Mon Sep 17 00:00:00 2001 From: robert Date: Tue, 9 Jul 2024 12:46:50 +0200 Subject: [PATCH 3/3] feat: refs #7544 chages required --- db/routines/vn/events/claim_changeState.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/routines/vn/events/claim_changeState.sql b/db/routines/vn/events/claim_changeState.sql index 790ef0c34..5d94170a0 100644 --- a/db/routines/vn/events/claim_changeState.sql +++ b/db/routines/vn/events/claim_changeState.sql @@ -6,15 +6,15 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`claim_changeState` ENABLE DO BEGIN - DECLARE vClaimStete INT; + DECLARE vClaimState INT; - SELECT id INTO vClaimStete + 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 = vClaimStete + SET c.claimStateFk = vClaimState WHERE c.created < util.VN_CURDATE() - INTERVAL 2 MONTH AND cs.code IN('incomplete','coming','waiting','out'); -- 2.40.1