DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`visible_log`(
	vIsPicked BOOL,
	vWarehouseFk INT,
	vItemFk INT,
	vQuantity INT
)
proc: BEGIN
	IF !vIsPicked THEN
		LEAVE proc;
	END IF;

	INSERT INTO visible
		SET itemFk = vItemFk,
			warehouseFk = vWarehouseFk,
			quantity = vQuantity
		ON DUPLICATE KEY UPDATE
			quantity = quantity + VALUES(quantity);
END$$
DELIMITER ;
