8093-devToTest_2442_3 #3100
|
@ -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 ;
|
Loading…
Reference in New Issue