5712-workerDms_integrateDocuware #1577
|
@ -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/');
|
|
|
@ -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/');
|
||||||
|
|
|
@ -57,13 +57,20 @@ module.exports = Self => {
|
||||||
const workerDms = await conn.executeStmt(stmt);
|
const workerDms = await conn.executeStmt(stmt);
|
||||||
|
|
||||||
// Get docuware info
|
// 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 worker = await models.Worker.findById(id, {fields: ['fi', 'firstName', 'lastName']});
|
||||||
const docuwareParse = {
|
const docuwareParse = {
|
||||||
'Filename': 'dmsFk',
|
'Filename': 'dmsFk',
|
||||||
'Tipo Documento': 'description',
|
'Tipo Documento': 'description',
|
||||||
'Stored on': 'created',
|
'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) {
|
for (document of workerDocuware) {
|
||||||
const defaultData = {
|
const defaultData = {
|
||||||
file: document.dmsFk + '.png',
|
file: document.dmsFk + '.png',
|
||||||
|
@ -75,6 +82,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
document = Object.assign(document, defaultData);
|
document = Object.assign(document, defaultData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return workerDms.concat(workerDocuware);
|
return workerDms.concat(workerDocuware);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@ module.exports = Self => {
|
||||||
require('../methods/worker-dms/downloadFile')(Self);
|
require('../methods/worker-dms/downloadFile')(Self);
|
||||||
require('../methods/worker-dms/removeFile')(Self);
|
require('../methods/worker-dms/removeFile')(Self);
|
||||||
require('../methods/worker-dms/filter')(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) {
|
Self.isMine = async function(ctx, dmsId) {
|
||||||
const myUserId = ctx.req.accessToken.userId;
|
const myUserId = ctx.req.accessToken.userId;
|
||||||
|
|
Loading…
Reference in New Issue