salix/db/routines/vn/procedures/entry_checkBooked.sql

23 lines
449 B
MySQL
Raw Normal View History

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-10 12:17:08 +00:00
IF vIsBooked AND NOT @isModeInventory THEN
CALL util.throw('Entry is already booked');
END IF;
END$$
DELIMITER ;