23 lines
449 B
SQL
23 lines
449 B
SQL
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;
|
|
|
|
IF vIsBooked AND NOT @isModeInventory THEN
|
|
CALL util.throw('Entry is already booked');
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|