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`.`observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT)
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Guarda las observaciones realizadas por el usuario
|
|
|
|
*
|
|
|
|
* @param vOriginFk Id del registro de origen
|
|
|
|
* @param vTypeCode Código que referencia a la tabla.
|
|
|
|
* @param descripcion Texto de la observacion
|
|
|
|
*/
|
|
|
|
DECLARE vTableName VARCHAR(45);
|
|
|
|
|
|
|
|
SET vTableName = CONCAT(vTableCode,'Observation');
|
|
|
|
|
|
|
|
IF ISNULL(vTableName) THEN
|
|
|
|
CALL util.throw('CODE_NOT_FOUND');
|
|
|
|
END IF;
|
|
|
|
|
|
|
|
SET @qryLog := CONCAT(
|
|
|
|
'INSERT INTO ', vTableName, ' (originFk, userFk, description)',
|
|
|
|
' VALUES (', vOriginFk, ', ', account.myUser_getId(), ', "', vDescription, '")'
|
|
|
|
);
|
|
|
|
|
|
|
|
PREPARE stmt FROM @qryLog;
|
|
|
|
EXECUTE stmt;
|
|
|
|
DEALLOCATE PREPARE stmt;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|