2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`ticketObservation_addNewBorn`(vTicketFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Inserta observaciones para los tickets con clientes nuevos o recuperados
|
|
|
|
*
|
|
|
|
* @param vTicketFk Identificador de vn.ticket
|
|
|
|
*/
|
|
|
|
|
|
|
|
DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! ';
|
|
|
|
|
|
|
|
INSERT INTO vn.ticketObservation(ticketFk, observationTypeFk, description)
|
|
|
|
SELECT vTicketFk, ot.id, vDescription
|
|
|
|
FROM vn.observationType ot
|
|
|
|
WHERE ot.hasNewBornMessage
|
|
|
|
ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description);
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|