8093-devToTest_2442_3 #3100
|
@ -11,14 +11,18 @@ BEGIN
|
|||
*/
|
||||
DECLARE vNewQueue 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
|
||||
INTO vNewQueue, vExtension, vPrevQueue
|
||||
START TRANSACTION;
|
||||
|
||||
SELECT d.pbxQueue, s.extension
|
||||
INTO vNewQueue, vExtension
|
||||
FROM business b
|
||||
JOIN department d ON d.id = b.departmentFk
|
||||
JOIN pbx.sip s ON s.user_id = b.workerFk
|
||||
LEFT JOIN pbx.queueMember qm ON qm.extension = s.extension
|
||||
WHERE b.id = vBusinessFk;
|
||||
|
||||
DELETE FROM pbx.queueMember
|
||||
|
@ -26,5 +30,7 @@ BEGIN
|
|||
|
||||
INSERT IGNORE INTO pbx.queueMember (queue, extension)
|
||||
VALUES (vNewQueue, vExtension);
|
||||
|
||||
COMMIT;
|
||||
END$$
|
||||
DELIMITER ;
|
Loading…
Reference in New Issue