WIP: feat: refs #6452 add sip on create worker #3105
|
@ -2046,13 +2046,6 @@ INSERT INTO `pbx`.`prefix` (country, prefix)
|
|||
('fr', '0033'),
|
||||
('pt', '00351');
|
||||
|
||||
INSERT INTO `pbx`.`sip`(`user_id`, `extension`)
|
||||
VALUES
|
||||
(1, 1010),
|
||||
(3, 1101),
|
||||
(5, 1102),
|
||||
(9, 1201);
|
||||
|
||||
INSERT INTO `vn`.`professionalCategory` (`id`, `description`)
|
||||
VALUES
|
||||
(1, 'employee'),
|
||||
|
@ -4002,9 +3995,7 @@ INSERT INTO pbx.queue (description, name, config)
|
|||
|
||||
INSERT IGNORE INTO pbx.queueMember
|
||||
SET queue = '1000',
|
||||
extension = '1010';
|
||||
extension = '1111';
|
||||
|
||||
UPDATE vn.department SET pbxQueue = '1000' WHERE name = "CAMARA";
|
||||
UPDATE vn.department SET pbxQueue = '2000' WHERE name = "VENTAS";
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `pbx`.`sip_isValid`(vExtension VARCHAR(255))
|
||||
BEGIN
|
||||
/**
|
||||
* Check if an extension has the correct format and
|
||||
* throws an exception if it hasn't.
|
||||
*
|
||||
* @param vExtension The extension
|
||||
*/
|
||||
DECLARE vIsValid BOOL;
|
||||
|
||||
SET vIsValid = vExtension IS NULL
|
||||
OR (vExtension REGEXP '^[0-9]{4}$'
|
||||
AND MOD(vExtension, 100) != 0);
|
||||
|
||||
IF NOT vIsValid THEN
|
||||
SIGNAL SQLSTATE '45000'
|
||||
SET MESSAGE_TEXT = 'Extension format is invalid';
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `pbx`.`sip_beforeInsert`
|
||||
BEFORE INSERT ON `sip`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL sip_isValid(NEW.extension);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +0,0 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `pbx`.`sip_beforeUpdate`
|
||||
BEFORE UPDATE ON `sip`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL sip_isValid(NEW.extension);
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -23,7 +23,10 @@ BEGIN
|
|||
DELETE FROM pbx.queueMember
|
||||
WHERE extension = vExtension COLLATE utf8_general_ci;
|
||||
|
||||
IF vNewQueue IS NOT NULL THEN
|
||||
|
||||
INSERT IGNORE INTO pbx.queueMember (queue, extension)
|
||||
VALUES (vNewQueue, vExtension);
|
||||
END IF;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -4,5 +4,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`worker_beforeInsert`
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
INSERT INTO pbx.sip
|
||||
SET user_id = NEW.id,
|
||||
extension = NEW.id;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue
Estaba insertando un registro en blanco, he mirado en dev y no lo hace, parece que solo en test.