refs ~6921 feat:addNoteFromDelivery

This commit is contained in:
Sergio De la torre 2024-04-10 11:23:33 +02:00
parent acd422d48f
commit 6717267613
1 changed files with 13 additions and 6 deletions

View File

@ -1,13 +1,20 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(idTicket INT,nota TEXT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(vTicketFk INT, vDescription TEXT, vCode VARCHAR(45))
BEGIN
DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/
/**
* Inserta observaciones para los tickets
*
* @param vTicketFk Identificador del ticket
* @param vDescription Texto de la nota a insertar
* param vCode Identificador del tipo de nota
*/
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
VALUES (idTicket,observationTypeFk,nota)
SELECT vTicketFk, id, vDescription
FROM vn.observationType
WHERE code = vCode
ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description, VALUES(description),' ');
END$$
DELIMITER ;