DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_getInfo`(vItemFk VARCHAR(22))
BEGIN
/**
 * Muestra información realtiva a la ubicación de un item
 *
 * @param vItemFk Id del item
 */
	SELECT vn.barcodeToItem(vItemFk)
		INTO vItemFk;

	SELECT 	pk.code Parking,
			sh.code Matricula,
			ish.visible visible,
			ish.created created,
			ish.itemFk itemFk,
			sh.priority
		FROM vn.itemShelving ish
			JOIN vn.shelving sh ON sh.`code` = ish.shelvingFk
			JOIN vn.parking pk ON pk.id = sh.parkingFk
		WHERE ish.itemFk = vItemFk
		ORDER BY sh.priority DESC, created ASC;
END$$
DELIMITER ;
