feat: ref#7902 Triggers vn.ticketRefund to control deleted tickets
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
6f022bc232
commit
0ca1db7633
|
@ -0,0 +1,26 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
SELECT SUM(ABS(isDeleted)) INTO vIsDeleted
|
||||||
|
FROM ticket
|
||||||
|
WHERE id IN (vRefundTicketFk, vOriginalTicketFk);
|
||||||
|
|
||||||
|
IF vIsDeleted THEN
|
||||||
|
CALL util.throw('The refund ticket can not be deleted tickets');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeIn
|
||||||
BEFORE INSERT ON `ticketRefund`
|
BEFORE INSERT ON `ticketRefund`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUp
|
||||||
BEFORE UPDATE ON `ticketRefund`
|
BEFORE UPDATE ON `ticketRefund`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Loading…
Reference in New Issue