This commit is contained in:
Robert Ferrús 2024-02-01 07:08:25 +01:00
parent 57c5c510ff
commit 2db7b608ad
1 changed files with 3 additions and 3 deletions

View File

@ -3,11 +3,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awbInvoiceIn_afterDel
AFTER DELETE ON `awbInvoiceIn`
FOR EACH ROW
BEGIN
IF (SELECT COUNT(*) FROM invoiceInTax where invoiceInFk = OLD.invoiceInFk) = 0
IF (NOT(SELECT COUNT(*) FROM invoiceInTax where invoiceInFk = OLD.invoiceInFk))
AND
(SELECT COUNT(*) FROM invoiceInDueDay where invoiceInFk = OLD.invoiceInFk) = 0
(NOT(SELECT COUNT(*) FROM invoiceInDueDay where invoiceInFk = OLD.invoiceInFk))
AND
(SELECT isBooked FROM invoiceIn WHERE id = OLD.invoiceInFk) = 0
(NOT(SELECT isBooked FROM invoiceIn WHERE id = OLD.invoiceInFk) )
THEN
DELETE FROM invoiceIn WHERE id = OLD.invoiceInFk;
END IF;