salix/db/routines/vn/procedures/travel_checkWarehouseIsFeed...

18 lines
467 B
MySQL
Raw Normal View History

DELIMITER $$
2024-08-20 08:06:10 +00:00
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 ;