DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_checkWarehouseIsFeedStock`(vWarehouseFk INT)
proc: BEGIN
/*
 * Check that the warehouse is not Feed Stock
 * 
 * @vWarehouseFk param warehouse id
 */
	IF vWarehouseFk IS NULL THEN
		LEAVE proc;
	END IF;

	IF (SELECT isFeedStock FROM warehouse WHERE id = vWarehouseFk) THEN
		CALL util.throw('Cannot create a travel with a source warehouse marked isFeedStock');
	END IF;
END$$
DELIMITER ;
