From d18721f50d23534c366b8b79aee8f5d1e441ca66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 4 Apr 2024 18:05:45 +0200 Subject: [PATCH] feat: bloquear facturas recibidas contabilizadas refs #7173 --- ...{invoiceIn_checkBooked.sql => invoiceIn_checkIsBooked.sql} | 2 +- db/routines/vn/triggers/invoiceInCorrection_beforeDelete.sql | 2 +- db/routines/vn/triggers/invoiceInDueDay_beforeDelete.sql | 4 ++-- db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql | 1 - db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql | 1 + db/routines/vn/triggers/invoiceInIntrastat_beforeDelete.sql | 2 +- db/routines/vn/triggers/invoiceInTax_beforeDelete.sql | 2 +- db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql | 2 +- db/routines/vn/triggers/invoiceIn_afterDelete.sql | 2 +- db/routines/vn/triggers/invoiceIn_afterUpdate.sql | 1 + 10 files changed, 10 insertions(+), 9 deletions(-) rename db/routines/vn/procedures/{invoiceIn_checkBooked.sql => invoiceIn_checkIsBooked.sql} (94%) diff --git a/db/routines/vn/procedures/invoiceIn_checkBooked.sql b/db/routines/vn/procedures/invoiceIn_checkIsBooked.sql similarity index 94% rename from db/routines/vn/procedures/invoiceIn_checkBooked.sql rename to db/routines/vn/procedures/invoiceIn_checkIsBooked.sql index 862870eb4..35008fcd5 100644 --- a/db/routines/vn/procedures/invoiceIn_checkBooked.sql +++ b/db/routines/vn/procedures/invoiceIn_checkIsBooked.sql @@ -1,5 +1,5 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_checkBooked`( +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceIn_checkIsBooked`( vSelf INT ) BEGIN diff --git a/db/routines/vn/triggers/invoiceInCorrection_beforeDelete.sql b/db/routines/vn/triggers/invoiceInCorrection_beforeDelete.sql index f4df48dcd..309d53af2 100644 --- a/db/routines/vn/triggers/invoiceInCorrection_beforeDelete.sql +++ b/db/routines/vn/triggers/invoiceInCorrection_beforeDelete.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInCorrection_b BEFORE DELETE ON `invoiceInCorrection` FOR EACH ROW BEGIN - CALL invoiceIn_checkBooked(OLD.correctingFk); + CALL invoiceIn_checkIsBooked(OLD.correctingFk); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/invoiceInDueDay_beforeDelete.sql b/db/routines/vn/triggers/invoiceInDueDay_beforeDelete.sql index 3b0f90d0d..eed070950 100644 --- a/db/routines/vn/triggers/invoiceInDueDay_beforeDelete.sql +++ b/db/routines/vn/triggers/invoiceInDueDay_beforeDelete.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_befor BEFORE DELETE ON `invoiceInDueDay` FOR EACH ROW BEGIN - CALL invoiceIn_checkBooked(OLD.id); + CALL invoiceIn_checkIsBooked(OLD.id); END$$ -DELIMITER ; +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql b/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql index c23ead0e4..f7e4265a7 100644 --- a/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql +++ b/db/routines/vn/triggers/invoiceInDueDay_beforeInsert.sql @@ -5,7 +5,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_befor BEGIN DECLARE vIsNotified BOOLEAN; - CALL invoiceIn_checkBooked(OLD.invoiceInFk); SET NEW.editorFk = account.myUser_getId(); SELECT isNotified INTO vIsNotified diff --git a/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql b/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql index 2452ff0d1..5d58ef28b 100644 --- a/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql +++ b/db/routines/vn/triggers/invoiceInDueDay_beforeUpdate.sql @@ -5,6 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInDueDay_befor BEGIN DECLARE vIsNotified BOOLEAN; + CALL invoiceIn_checkBooked(OLD.invoiceInFk); SET NEW.editorFk = account.myUser_getId(); SELECT isNotified INTO vIsNotified diff --git a/db/routines/vn/triggers/invoiceInIntrastat_beforeDelete.sql b/db/routines/vn/triggers/invoiceInIntrastat_beforeDelete.sql index 412b091f4..e3dfc769c 100644 --- a/db/routines/vn/triggers/invoiceInIntrastat_beforeDelete.sql +++ b/db/routines/vn/triggers/invoiceInIntrastat_beforeDelete.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInIntrastat_be BEFORE DELETE ON `invoiceInIntrastat` FOR EACH ROW BEGIN - CALL invoiceIn_checkBooked(OLD.invoiceInFk); + CALL invoiceIn_checkIsBooked(OLD.invoiceInFk); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/invoiceInTax_beforeDelete.sql b/db/routines/vn/triggers/invoiceInTax_beforeDelete.sql index a43f602b4..c48e7a227 100644 --- a/db/routines/vn/triggers/invoiceInTax_beforeDelete.sql +++ b/db/routines/vn/triggers/invoiceInTax_beforeDelete.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeDe BEFORE DELETE ON `invoiceInTax` FOR EACH ROW BEGIN - CALL invoiceIn_checkBooked(OLD.invoiceInFk); + CALL invoiceIn_checkIsBooked(OLD.invoiceInFk); END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql b/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql index 3e5ecf030..99ccd2c1d 100644 --- a/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql +++ b/db/routines/vn/triggers/invoiceInTax_beforeUpdate.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceInTax_beforeUp BEFORE UPDATE ON `invoiceInTax` FOR EACH ROW BEGIN - CALL invoiceIn_checkBooked(OLD.invoiceInFk); + CALL invoiceIn_checkIsBooked(OLD.invoiceInFk); IF NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) THEN CALL invoiceInTax_afterUpsert(NEW.invoiceInFk); diff --git a/db/routines/vn/triggers/invoiceIn_afterDelete.sql b/db/routines/vn/triggers/invoiceIn_afterDelete.sql index 90fac193d..62a01ebc2 100644 --- a/db/routines/vn/triggers/invoiceIn_afterDelete.sql +++ b/db/routines/vn/triggers/invoiceIn_afterDelete.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_afterDelete AFTER DELETE ON `invoiceIn` FOR EACH ROW BEGIN - CALL invoiceIn_checkBooked(OLD.id); + CALL invoiceIn_checkIsBooked(OLD.id); INSERT INTO invoiceInLog SET `action` = 'delete', diff --git a/db/routines/vn/triggers/invoiceIn_afterUpdate.sql b/db/routines/vn/triggers/invoiceIn_afterUpdate.sql index b1308393c..8d3df4ed5 100644 --- a/db/routines/vn/triggers/invoiceIn_afterUpdate.sql +++ b/db/routines/vn/triggers/invoiceIn_afterUpdate.sql @@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_afterUpdate AFTER UPDATE ON `invoiceIn` FOR EACH ROW BEGIN + CALL invoiceIn_checkIsBooked(OLD.id); IF NEW.issued != OLD.issued OR NEW.currencyFk != OLD.currencyFk THEN