Merge pull request 'feat: ref#7902 Triggers vn.ticketRefund to control deleted tickets' (!2908) from 7902-Trigger-ticketRefund-para-no-añadir-ticket-eliminado into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2908 Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
This commit is contained in:
commit
c15b4f1bdf
|
@ -0,0 +1,25 @@
|
|||
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 ;
|
|
@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_beforeInse
|
|||
BEFORE INSERT ON `ticketRefund`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`ticketRefund_beforeUpda
|
|||
BEFORE UPDATE ON `ticketRefund`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL ticketRefund_upsert(NEW.refundTicketFk, NEW.originalTicketFk);
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
Loading…
Reference in New Issue