2024-06-05 13:44:11 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_isEditable`(
|
2024-06-05 13:44:11 +00:00
|
|
|
vSelf INT
|
|
|
|
)
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Comprueba si una entrada se puede actualizar
|
|
|
|
* si no se puede retorna un throw.
|
|
|
|
*
|
|
|
|
* @param vSelf Id de entrada
|
|
|
|
*/
|
|
|
|
DECLARE vIsEditable BOOL;
|
|
|
|
|
|
|
|
SELECT e.isBooked INTO vIsEditable
|
|
|
|
FROM `entry` e
|
|
|
|
JOIN entryType et ON et.code = e.typeFk
|
|
|
|
WHERE NOT et.isInformal
|
2024-06-05 13:50:16 +00:00
|
|
|
AND e.id = vSelf;
|
2024-06-05 13:44:11 +00:00
|
|
|
|
|
|
|
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
2024-07-05 07:59:15 +00:00
|
|
|
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
|
2024-06-05 13:44:11 +00:00
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|