2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`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 ;
|