2024-09-02 15:57:39 +00:00
|
|
|
DELIMITER $$
|
2024-10-02 07:06:21 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticketRefund_upsert`(
|
2024-09-02 15:57:39 +00:00
|
|
|
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
|
2024-10-02 07:09:04 +00:00
|
|
|
CALL util.throw('The refund ticket cannot be deleted tickets');
|
2024-09-02 15:57:39 +00:00
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|