From 9cc714e045157ae335abf26f2ad168c57d8b97f6 Mon Sep 17 00:00:00 2001 From: Jbreso Date: Thu, 16 May 2024 14:56:14 +0200 Subject: [PATCH] feat refs#6941 hasfile to hasPhysically --- db/routines/vn/triggers/dms_beforeInsert.sql | 2 +- db/routines/vn/triggers/dms_beforeUpdate.sql | 16 ++++++++-------- .../11041-limeRoebelini/00-firstScript.sql | 2 ++ 3 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 db/versions/11041-limeRoebelini/00-firstScript.sql diff --git a/db/routines/vn/triggers/dms_beforeInsert.sql b/db/routines/vn/triggers/dms_beforeInsert.sql index f7877ecb8..e14a9ca0e 100644 --- a/db/routines/vn/triggers/dms_beforeInsert.sql +++ b/db/routines/vn/triggers/dms_beforeInsert.sql @@ -10,7 +10,7 @@ BEGIN CALL util.throw('this warehouse has not dms'); END IF; - IF NEW.hasFile THEN + IF NEW.hasPhysically THEN SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber FROM dms WHERE warehouseFk = NEW.warehouseFk; diff --git a/db/routines/vn/triggers/dms_beforeUpdate.sql b/db/routines/vn/triggers/dms_beforeUpdate.sql index c93659d45..f3952853f 100644 --- a/db/routines/vn/triggers/dms_beforeUpdate.sql +++ b/db/routines/vn/triggers/dms_beforeUpdate.sql @@ -1,11 +1,11 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeUpdate` - BEFORE UPDATE ON `dms` - FOR EACH ROW +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeUpdate` + BEFORE UPDATE ON `dms` + FOR EACH ROW BEGIN DECLARE vHardCopyNumber INT; - IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL) + IF (NEW.hasPhysically <> 0) AND (OLD.hasPhysically = 0) AND (NEW.hardCopyNumber IS NULL) OR (NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN @@ -22,7 +22,7 @@ BEGIN IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN - SET NEW.hasFile = 0; + SET NEW.hasPhysically = 0; END IF; -END$$ -DELIMITER ; +END$$ +DELIMITER ; diff --git a/db/versions/11041-limeRoebelini/00-firstScript.sql b/db/versions/11041-limeRoebelini/00-firstScript.sql new file mode 100644 index 000000000..cc58e4cea --- /dev/null +++ b/db/versions/11041-limeRoebelini/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.dms CHANGE hasFile hasPhysically tinyint(4) DEFAULT 0 NOT NULL; + -- 2.40.1