refs #5509 feat(EntryDms): add fixtures

This commit is contained in:
Alex Moreno 2024-02-12 15:04:49 +01:00
parent b54827a2ad
commit 5f60f2a00e
3 changed files with 8 additions and 70 deletions

View File

@ -2408,7 +2408,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
(17, 'cmr', NULL, NULL, 'cmr'),
(18, 'dua', NULL, NULL, 'dua'),
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
(20, 'Reclamación', 1, 1, 'claim');
(20, 'Reclamación', 1, 1, 'claim'),
(21, 'Entrada', 1, 1, 'entry');
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES

View File

@ -10,78 +10,13 @@ CREATE OR REPLACE TABLE `vn`.`entryDms` (
CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
-- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeInsert`;
-- USE `vn`;
-- DELIMITER $$
-- $$
-- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert`
-- BEFORE INSERT ON `entryDms`
-- FOR EACH ROW
-- BEGIN
-- SET NEW.editorFk = account.myUser_getId();
-- END $$
-- DELIMITER ;
-- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeUpdate`;
-- USE `vn`;
-- DELIMITER $$
-- $$
-- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate`
-- BEFORE UPDATE ON `entryDms`
-- FOR EACH ROW
-- BEGIN
-- SET NEW.editorFk = account.myUser_getId();
-- END $$
-- DELIMITER ;
-- DROP TRIGGER IF EXISTS `vn`.`entryDms_beforeDelete`;
-- USE `vn`;
-- DELIMITER $$
-- $$
-- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeDelete`
-- BEFORE DELETE ON `entryDms`
-- FOR EACH ROW
-- BEGIN
-- UPDATE dms
-- SET dmsTypeFk = (SELECT id
-- FROM dmsType
-- WHERE `code` = 'trash'
-- )
-- WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE)
-- FROM entryDms
-- WHERE dmsFk = OLD.dmsFk
-- ) ;
-- END $$
-- DELIMITER ;
-- DROP TRIGGER IF EXISTS `vn`.`entryDms_afterDelete`;
-- USE `vn`;
-- DELIMITER $$
-- $$
-- CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete`
-- AFTER DELETE ON `entryDms`
-- FOR EACH ROW
-- BEGIN
-- INSERT INTO entryLog
-- SET `action` = 'delete',
-- `changedModel` = 'entryDms',
-- `changedModelId` = OLD.entryFk,
-- `userFk` = account.myUser_getId();
-- END $$
-- DELIMITER ;
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('WorkerDms', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee'),
('Entry', 'uploadFile', 'WRITE', 'ALLOW', 'ROLE', 'employee');
-- UPDATE `salix`.`ACL`
-- SET accessType = '*'
-- WHERE model = 'ClientDms'
-- AND property = '*';
UPDATE `salix`.`ACL`
SET accessType = '*'
WHERE model = 'ClientDms'
AND property = '*';

View File

@ -0,0 +1,2 @@
INSERT INTO `vn`.`dmsType` (code, name, path__, writeRoleFk, readRoleFk, monthToDelete)
VALUES('entry', 'Entrada', '', 1, 1, NULL);