From bbb781576504030d59eda286b055df5cdd173dff Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 20 Nov 2024 13:52:24 +0100 Subject: [PATCH 1/2] fix: refs #7229 set right urls --- .../worker/back/methods/worker-dms/filter.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 597084e60..2836b0cc7 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -86,30 +86,30 @@ module.exports = Self => { 'Tipo Documento': 'description', 'Stored on': 'created', 'Document ID': 'id', - 'URL': 'download', + 'URL': 'url', 'Stored by': 'name', 'Estado': 'state' }; workerDocuware = - await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? []; - const url = (await Self.app.models.Url.getUrl('docuware')) + 'WebClient'; + await models.Docuware.getById('hr', worker?.lastName + ' ' + worker?.firstName, docuwareParse) ?? []; + for (document of workerDocuware) { - const docuwareId = document.id; + const documentId = document.id; const defaultData = { - id: docuwareId, + id: documentId, workerFk: id, - dmsFk: docuwareId, + dmsFk: document.dmsFk, dms: { - id: docuwareId, - file: docuwareId + '.pdf', + id: documentId, + file: document.dmsFk + '.pdf', isDocuware: true, hasFile: false, - reference: worker.fi, - dmsFk: docuwareId, - url, + reference: worker?.fi, + dmsFk: document.dmsFk, + url: document.url, + download: `WorkerDms/${document.dmsFk}/docuwareDownload`, description: document.description + ' - ' + document.state, - download: document.download, created: document.created, dmsType: {name: 'Docuware'}, worker: {id: null, user: {name: document.name}}, -- 2.40.1 From e125dee691393cdf3004819f919d084d3b35a34a Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 20 Nov 2024 16:51:14 +0100 Subject: [PATCH 2/2] refactor: refs #7229 desestructure --- modules/worker/back/methods/worker-dms/filter.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 2836b0cc7..240a905d2 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -95,18 +95,18 @@ module.exports = Self => { await models.Docuware.getById('hr', worker?.lastName + ' ' + worker?.firstName, docuwareParse) ?? []; for (document of workerDocuware) { - const documentId = document.id; + const {id: documentId, dmsFk} = document; const defaultData = { id: documentId, workerFk: id, - dmsFk: document.dmsFk, + dmsFk: dmsFk, dms: { id: documentId, - file: document.dmsFk + '.pdf', + file: dmsFk + '.pdf', isDocuware: true, hasFile: false, reference: worker?.fi, - dmsFk: document.dmsFk, + dmsFk: dmsFk, url: document.url, download: `WorkerDms/${document.dmsFk}/docuwareDownload`, description: document.description + ' - ' + document.state, -- 2.40.1