Merge branch 'dev' into 7819-Delete_obsolete_objects
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
690898630c
|
@ -5,28 +5,26 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_transf
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Transfiere producto de una ubicación a otra, fusionando si coincide el
|
* Transfiere producto de una ubicación a otra
|
||||||
* packing y la fecha.
|
* fusionando si coincide el packing y la fecha.
|
||||||
*
|
*
|
||||||
* @param vItemShelvingFk Identificador de itemShelving
|
* @param vItemShelvingFk Identificador de itemShelving
|
||||||
* @param vShelvingFk Identificador de shelving
|
* @param vShelvingFk Identificador de shelving
|
||||||
*/
|
*/
|
||||||
DECLARE vNewItemShelvingFk INT DEFAULT 0;
|
DECLARE vNewItemShelvingFk INT;
|
||||||
|
|
||||||
SELECT MAX(ish.id)
|
SELECT MAX(ish.id) INTO vNewItemShelvingFk
|
||||||
INTO vNewItemShelvingFk
|
|
||||||
FROM itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT
|
SELECT itemFk,
|
||||||
itemFk,
|
packing,
|
||||||
packing,
|
created,
|
||||||
created,
|
buyFk
|
||||||
buyFk
|
|
||||||
FROM itemShelving
|
FROM itemShelving
|
||||||
WHERE id = vItemShelvingFk
|
WHERE id = vItemShelvingFk
|
||||||
) ish2 ON ish2.itemFk = ish.itemFk
|
) ish2 ON ish2.itemFk = ish.itemFk
|
||||||
AND ish2.packing = ish.packing
|
AND ish2.packing = ish.packing
|
||||||
AND date(ish2.created) = date(ish.created)
|
AND DATE(ish2.created) = DATE(ish.created)
|
||||||
AND ish2.buyFk = ish.buyFk
|
AND ish2.buyFk = ish.buyFk
|
||||||
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
|
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
|
||||||
|
|
||||||
|
@ -39,10 +37,16 @@ BEGIN
|
||||||
DELETE FROM itemShelving
|
DELETE FROM itemShelving
|
||||||
WHERE id = vItemShelvingFk;
|
WHERE id = vItemShelvingFk;
|
||||||
ELSE
|
ELSE
|
||||||
UPDATE itemShelving
|
IF (SELECT EXISTS(SELECT id FROM shelving
|
||||||
SET shelvingFk = vShelvingFk
|
WHERE code = vShelvingFk COLLATE utf8_unicode_ci)) THEN
|
||||||
WHERE id = vItemShelvingFk;
|
|
||||||
|
UPDATE itemShelving
|
||||||
|
SET shelvingFk = vShelvingFk
|
||||||
|
WHERE id = vItemShelvingFk;
|
||||||
|
ELSE
|
||||||
|
CALL util.throw('The shelving not exists');
|
||||||
|
END IF;
|
||||||
END IF;
|
END IF;
|
||||||
SELECT true;
|
SELECT TRUE;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterDel
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT INTO shelvingLog
|
INSERT INTO shelvingLog
|
||||||
SET `action` = 'delete',
|
SET `action` = 'delete',
|
||||||
`changedModel` = 'itemShelving',
|
`changedModel` = 'ItemShelving',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
`userFk` = account.myUser_getId();
|
`userFk` = account.myUser_getId();
|
||||||
END$$
|
END$$
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
|
||||||
|
BEFORE INSERT ON `saleGroupDetail`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,12 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
|
||||||
|
AFTER DELETE ON `saleGroupDetail`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO saleGroupLog
|
||||||
|
SET `action` = 'delete',
|
||||||
|
`changedModel` = 'SaleGroupDetail',
|
||||||
|
`changedModelId` = OLD.id,
|
||||||
|
`userFk` = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
|
||||||
|
BEFORE UPDATE ON `saleGroupDetail`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroup_afterDelete
|
||||||
AFTER DELETE ON `saleGroup`
|
AFTER DELETE ON `saleGroup`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT INTO ticketLog
|
INSERT INTO saleGroupLog
|
||||||
SET `action` = 'delete',
|
SET `action` = 'delete',
|
||||||
`changedModel` = 'SaleGroup',
|
`changedModel` = 'SaleGroup',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
CREATE OR REPLACE TABLE `vn`.`saleGroupLog` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`originFk` int(11) DEFAULT NULL,
|
||||||
|
`userFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
`action` set('insert','update','delete','select') NOT NULL,
|
||||||
|
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||||
|
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||||
|
`changedModel` enum('SaleGroup', 'SaleGroupDetail') NOT NULL DEFAULT 'SaleGroup',
|
||||||
|
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
|
||||||
|
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
|
||||||
|
`changedModelId` int(11) NOT NULL,
|
||||||
|
`changedModelValue` varchar(45) DEFAULT NULL,
|
||||||
|
`summaryId` varchar(30) DEFAULT NULL,
|
||||||
|
`reason` varchar(255) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `saleGroupUserFk` (`userFk`),
|
||||||
|
KEY `saleGroupLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
|
||||||
|
KEY `saleGroupLog_originFk` (`originFk`,`creationDate`),
|
||||||
|
CONSTRAINT `saleGroupLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
ALTER TABLE vn.parkingLog
|
||||||
|
MODIFY COLUMN changedModel enum('Parking') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Parking' NOT NULL;
|
Loading…
Reference in New Issue