5712-workerDms_integrateDocuware #1577

Merged
alexm merged 14 commits from 5712-workerDms_integrateDocuware into dev 2023-07-25 05:18:06 +00:00
5 changed files with 34 additions and 23 deletions
Showing only changes of commit 4f616397a2 - Show all commits

View File

@ -1,7 +0,0 @@
INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById)
VALUES
('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO');
INSERT INTO `salix`.`url` (appName, environment, url)
VALUES
('docuware', 'production', 'https://verdnatura.docuware.cloud/DocuWare/Platform/');

View File

@ -0,0 +1,10 @@
ALTER TABLE `vn`.`docuware` ADD dmsTypeFk INT(11) DEFAULT NULL NULL;
ALTER TABLE `vn`.`docuware` ADD CONSTRAINT docuware_FK FOREIGN KEY (dmsTypeFk) REFERENCES `vn`.`dmsType`(id) ON DELETE RESTRICT ON UPDATE CASCADE;
INSERT INTO `vn`.`docuware` (code, fileCabinetName, `action`, dialogName, findById, dmsTypeFk)
VALUES
('hr', 'RRHH', 'find', 'Búsqueda', 'N__DOCUMENTO', NULL);
INSERT INTO `salix`.`url` (appName, environment, url)
VALUES
('docuware', 'production', 'https://verdnatura.docuware.cloud/DocuWare/Platform/');

View File

@ -57,13 +57,20 @@ module.exports = Self => {
const workerDms = await conn.executeStmt(stmt);
// Get docuware info
const docuware = await models.Docuware.findOne({
fields: ['dmsTypeFk'],
where: {code: 'hr', action: 'find'}
});
const docuwareDmsType = docuware.dmsTypeFk;
if (!(docuwareDmsType && !await models.DmsType.hasReadRole(ctx, docuwareDmsType))) {
const worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']});
const docuwareParse = {
'Filename': 'dmsFk',
'Tipo Documento': 'description',
'Stored on': 'created',
};
const workerDocuware = await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse);
const workerDocuware =
await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse);
for (document of workerDocuware) {
const defaultData = {
file: document.dmsFk + '.png',
@ -75,6 +82,7 @@ module.exports = Self => {
document = Object.assign(document, defaultData);
}
}
return workerDms.concat(workerDocuware);
};

View File

@ -2,7 +2,7 @@ module.exports = Self => {
require('../methods/worker-dms/downloadFile')(Self);
require('../methods/worker-dms/removeFile')(Self);
require('../methods/worker-dms/filter')(Self);
require('../methods/worker-dms/docuware')(Self);
require('../methods/worker-dms/docuwareDownload')(Self);
Self.isMine = async function(ctx, dmsId) {
const myUserId = ctx.req.accessToken.userId;