refs #5712 fix(workerDms): filter
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
4f616397a2
commit
1a18ba66a9
|
@ -28,5 +28,12 @@
|
||||||
"findById": {
|
"findById": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"dmsType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "DmsType",
|
||||||
|
"foreignKey": "dmsTypeFk"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,22 +62,25 @@ module.exports = Self => {
|
||||||
where: {code: 'hr', action: 'find'}
|
where: {code: 'hr', action: 'find'}
|
||||||
});
|
});
|
||||||
const docuwareDmsType = docuware.dmsTypeFk;
|
const docuwareDmsType = docuware.dmsTypeFk;
|
||||||
|
let workerDocuware;
|
||||||
if (!(docuwareDmsType && !await models.DmsType.hasReadRole(ctx, docuwareDmsType))) {
|
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',
|
||||||
|
'Document ID': 'id'
|
||||||
};
|
};
|
||||||
const workerDocuware =
|
workerDocuware =
|
||||||
await models.Docuware.getById('hr', worker.lastName + worker.firstName, docuwareParse);
|
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: 'dw' + document.id + '.png',
|
||||||
isDocuware: true,
|
isDocuware: true,
|
||||||
hardCopyNumber: null,
|
hardCopyNumber: null,
|
||||||
hasFile: false,
|
hasFile: false,
|
||||||
reference: worker.fi
|
reference: worker.fi,
|
||||||
|
dmsFk: 'DW' + document.id
|
||||||
};
|
};
|
||||||
|
|
||||||
document = Object.assign(document, defaultData);
|
document = Object.assign(document, defaultData);
|
||||||
|
|
Loading…
Reference in New Issue