refs #5712 use dmsType readRole
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
c7b9d0827e
commit
4f616397a2
|
@ -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,23 +57,31 @@ module.exports = Self => {
|
|||
const workerDms = await conn.executeStmt(stmt);
|
||||
|
||||
// Get docuware info
|
||||
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);
|
||||
for (document of workerDocuware) {
|
||||
const defaultData = {
|
||||
file: document.dmsFk + '.png',
|
||||
isDocuware: true,
|
||||
hardCopyNumber: null,
|
||||
hasFile: false,
|
||||
reference: worker.fi
|
||||
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);
|
||||
for (document of workerDocuware) {
|
||||
const defaultData = {
|
||||
file: document.dmsFk + '.png',
|
||||
isDocuware: true,
|
||||
hardCopyNumber: null,
|
||||
hasFile: false,
|
||||
reference: worker.fi
|
||||
};
|
||||
|
||||
document = Object.assign(document, defaultData);
|
||||
document = Object.assign(document, defaultData);
|
||||
}
|
||||
}
|
||||
|
||||
return workerDms.concat(workerDocuware);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue