diff --git a/db/routines/vn/triggers/invoiceIn_afterUpdate.sql b/db/routines/vn/triggers/invoiceIn_afterUpdate.sql index 8f0a63465..8c2785e38 100644 --- a/db/routines/vn/triggers/invoiceIn_afterUpdate.sql +++ b/db/routines/vn/triggers/invoiceIn_afterUpdate.sql @@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`invoiceIn_afterUpdate` BEGIN DECLARE vIsEuro BOOL; - SELECT if(`code` = 'EUR', TRUE, FALSE) INTO vIsEuro + SELECT `code` = 'EUR' INTO vIsEuro FROM currency WHERE id = NEW.currencyFk; diff --git a/db/versions/11368-whiteAspidistra/00-firstScript.sql b/db/versions/11368-whiteAspidistra/00-firstScript.sql index 333fa1315..f36832805 100644 --- a/db/versions/11368-whiteAspidistra/00-firstScript.sql +++ b/db/versions/11368-whiteAspidistra/00-firstScript.sql @@ -2,13 +2,13 @@ DROP TRIGGER IF EXISTS invoiceIn_beforeUpdate; - UPDATE vn.invoiceIn + UPDATE invoiceIn SET cplusRectificationTypeFk = NULL WHERE cplusRectificationTypeFk = 1; - DELETE IGNORE FROM vn.cplusRectificationType WHERE id = 1; + DELETE IGNORE FROM cplusRectificationType WHERE id = 1; - UPDATE vn.cplusRectificationType + UPDATE cplusRectificationType SET id = 1 WHERE id = 3; @@ -25,7 +25,7 @@ BEGIN SET NEW.editorFk = account.myUser_getId(); - IF (SELECT COUNT(*) FROM vn.invoiceIn + IF (SELECT COUNT(*) FROM invoiceIn WHERE supplierRef = NEW.supplierRef AND supplierFk = NEW.supplierFk AND YEAR(issued) = YEAR(NEW.issued) @@ -37,7 +37,7 @@ BEGIN IF NEW.supplierFk != OLD.supplierFk THEN CALL supplier_checkIsActive(NEW.supplierFk); SELECT withholdingSageFk INTO vWithholdingSageFk - FROM vn.supplier + FROM supplier WHERE id = NEW.supplierFk; SET NEW.withholdingSageFk = vWithholdingSageFk; END IF;