8093-devToTest_2442_3 #3100

Merged
alexm merged 284 commits from 8093-devToTest_2442_3 into test 2024-10-15 06:51:43 +00:00
1 changed files with 10 additions and 4 deletions
Showing only changes of commit e0d0b66963 - Show all commits

View File

@ -11,14 +11,18 @@ BEGIN
*/ */
DECLARE vNewQueue VARCHAR(10); DECLARE vNewQueue VARCHAR(10);
DECLARE vExtension VARCHAR(10); DECLARE vExtension VARCHAR(10);
DECLARE vPrevQueue VARCHAR(10); DECLARE exit handler FOR SQLEXCEPTION
BEGIN
ROLLBACK;
END;
SELECT d.pbxQueue, s.extension, qm.queue START TRANSACTION;
INTO vNewQueue, vExtension, vPrevQueue
SELECT d.pbxQueue, s.extension
INTO vNewQueue, vExtension
FROM business b FROM business b
JOIN department d ON d.id = b.departmentFk JOIN department d ON d.id = b.departmentFk
JOIN pbx.sip s ON s.user_id = b.workerFk JOIN pbx.sip s ON s.user_id = b.workerFk
LEFT JOIN pbx.queueMember qm ON qm.extension = s.extension
WHERE b.id = vBusinessFk; WHERE b.id = vBusinessFk;
DELETE FROM pbx.queueMember DELETE FROM pbx.queueMember
@ -26,5 +30,7 @@ BEGIN
INSERT IGNORE INTO pbx.queueMember (queue, extension) INSERT IGNORE INTO pbx.queueMember (queue, extension)
VALUES (vNewQueue, vExtension); VALUES (vNewQueue, vExtension);
COMMIT;
END$$ END$$
DELIMITER ; DELIMITER ;