From 3f291da02ce8a52654f2707b9f5a08db29265148 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 17 Apr 2024 13:57:56 +0200 Subject: [PATCH] refs #6921 feat: addFromDelivery --- .../vn/procedures/addNoteFromDelivery.sql | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/db/routines/vn/procedures/addNoteFromDelivery.sql b/db/routines/vn/procedures/addNoteFromDelivery.sql index 7431d4f49..61295b7db 100644 --- a/db/routines/vn/procedures/addNoteFromDelivery.sql +++ b/db/routines/vn/procedures/addNoteFromDelivery.sql @@ -1,20 +1,13 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(vTicketFk INT, vDescription TEXT, vCode VARCHAR(45)) +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`addNoteFromDelivery`(idTicket INT,nota TEXT) 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) + ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vTicketFk, id, vDescription - FROM vn.observationType - WHERE code = vCode - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description, VALUES(description),' '); END$$ DELIMITER ;