2024-03-25 07:47:06 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_checkBooked`(
|
|
|
|
vSelf INT
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Comprueba si una entrada está contabilizada,
|
|
|
|
* y si lo está retorna un throw.
|
|
|
|
*
|
|
|
|
* @param vSelf Id de entrada
|
|
|
|
*/
|
|
|
|
DECLARE vIsBooked BOOL;
|
|
|
|
|
|
|
|
SELECT isBooked INTO vIsBooked
|
|
|
|
FROM `entry`
|
|
|
|
WHERE id = vSelf;
|
|
|
|
|
2024-04-23 12:41:43 +00:00
|
|
|
IF vIsBooked AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
2024-03-25 07:47:06 +00:00
|
|
|
CALL util.throw('Entry is already booked');
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|