26 lines
529 B
SQL
26 lines
529 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketRefund_upsert`(
|
|
vRefundTicketFk INT,
|
|
vOriginalTicketFk INT
|
|
)
|
|
READS SQL DATA
|
|
BEGIN
|
|
/**
|
|
* Common code for ticketRefund triggers
|
|
*
|
|
* @param vRefundTicketFk
|
|
* @param vOriginalTicketFk
|
|
*/
|
|
DECLARE vIsDeleted BOOL;
|
|
|
|
SELECT COUNT(*) INTO vIsDeleted
|
|
FROM ticket
|
|
WHERE id IN (vRefundTicketFk, vOriginalTicketFk)
|
|
AND isDeleted;
|
|
|
|
IF vIsDeleted THEN
|
|
CALL util.throw('The refund ticket cannot be deleted tickets');
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|