2024-09-02 15:57:39 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`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;
|
|
|
|
|
2024-09-30 12:33:58 +00:00
|
|
|
SELECT COUNT(*) INTO vIsDeleted
|
2024-09-02 15:57:39 +00:00
|
|
|
FROM ticket
|
2024-09-30 12:33:58 +00:00
|
|
|
WHERE id IN (vRefundTicketFk, vOriginalTicketFk)
|
|
|
|
AND isDeleted;
|
2024-09-02 15:57:39 +00:00
|
|
|
|
|
|
|
IF vIsDeleted THEN
|
|
|
|
CALL util.throw('The refund ticket can not be deleted tickets');
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|