DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingLog_get`(
	vShelvingCode VARCHAR(10)
)
BEGIN
/**
 * Devuelve el log de los item en cada carro
 *
 * @param vShelvingCode Matrícula del carro 
 * 
 */
	SELECT isl.itemShelvingFk, 
			isl.created, 
			isl.accion, 
			isl.itemFk, 
			isl.shelvingFk, 
			isl.quantity, 
			isl.visible,
			isl.available, 
			isl.grouping, 
			isl.packing, 
			isl.stars, 
			item.longName, 
			item.size, 
			item.subName, 
			worker.code, 
			isl.accion
	FROM item 
		JOIN itemShelvingLog isl ON item.id = isl.itemFk 
		JOIN worker ON isl.workerFk = worker.id
		JOIN shelving sh ON sh.id = isl.shelvingFk
	WHERE sh.code = vShelvingCode COLLATE utf8mb3_unicode_ci
		OR isl.itemFk = vShelvingCode -- ?? Respeto porque ya estaba
	ORDER BY isl.created DESC;
END$$
DELIMITER ;
