refs #5712 fix(workerDms): filter
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Alex Moreno 2023-07-04 15:18:57 +02:00
parent 4f616397a2
commit 1a18ba66a9
2 changed files with 13 additions and 3 deletions

View File

@ -28,5 +28,12 @@
"findById": {
"type": "string"
}
},
"relations": {
"dmsType": {
"type": "belongsTo",
"model": "DmsType",
"foreignKey": "dmsTypeFk"
}
}
}

View File

@ -62,22 +62,25 @@ module.exports = Self => {
where: {code: 'hr', action: 'find'}
});
const docuwareDmsType = docuware.dmsTypeFk;
let workerDocuware;
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',
'Document ID': 'id'
};
const workerDocuware =
workerDocuware =
await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse);
for (document of workerDocuware) {
const defaultData = {
file: document.dmsFk + '.png',
file: 'dw' + document.id + '.png',
isDocuware: true,
hardCopyNumber: null,
hasFile: false,
reference: worker.fi
reference: worker.fi,
dmsFk: 'DW' + document.id
};
document = Object.assign(document, defaultData);