+ ng-if="$ctrl.supplier.isReal == false">
diff --git a/modules/supplier/front/descriptor/index.js b/modules/supplier/front/descriptor/index.js
index 9f23ce68c..f84b4ef92 100644
--- a/modules/supplier/front/descriptor/index.js
+++ b/modules/supplier/front/descriptor/index.js
@@ -40,7 +40,7 @@ class Controller extends Descriptor {
'payDemFk',
'payDay',
'isActive',
- 'isSerious',
+ 'isReal',
'isTrucker',
'account'
],
diff --git a/modules/supplier/front/descriptor/index.spec.js b/modules/supplier/front/descriptor/index.spec.js
index 4d16c5183..12c3e43bc 100644
--- a/modules/supplier/front/descriptor/index.spec.js
+++ b/modules/supplier/front/descriptor/index.spec.js
@@ -26,7 +26,7 @@ describe('Supplier Component vnSupplierDescriptor', () => {
'payDemFk',
'payDay',
'isActive',
- 'isSerious',
+ 'isReal',
'isTrucker',
'account'
],
diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html
index 3dda39212..d1b3ee20a 100644
--- a/modules/supplier/front/summary/index.html
+++ b/modules/supplier/front/summary/index.html
@@ -44,12 +44,12 @@
@@ -141,7 +141,7 @@
value="{{::$ctrl.summary.name}}">
{
Self.remoteMethodCtx('filter', {
@@ -33,28 +34,31 @@ module.exports = Self => {
const userId = ctx.req.accessToken.userId;
const models = Self.app.models;
+ // Get ids alloweds
const account = await models.VnUser.findById(userId);
const stmt = new ParameterizedSQL(
- `SELECT d.id dmsFk, d.reference, d.description, d.file, d.created, d.hardCopyNumber, d.hasFile
+ `SELECT d.id, d.id dmsFk
FROM workerDocument wd
JOIN dms d ON d.id = wd.document
JOIN dmsType dt ON dt.id = d.dmsTypeFk
LEFT JOIN account.roleRole rr ON rr.inheritsFrom = dt.readRoleFk AND rr.role = ?
`, [account.roleFk]
);
- const oldWhere = filter.where;
const yourOwnDms = {and: [{isReadableByWorker: true}, {worker: userId}]};
+ const where = {
+ or: [yourOwnDms, {
+ role: {
+ neq: null
+ }
+ }]
+ };
+ stmt.merge(conn.makeSuffix(mergeWhere(filter.where, where)));
- filter.where = {
- and: [{
- or: [yourOwnDms, {
- role: {
- neq: null
- }
- }]
- }, oldWhere]};
- stmt.merge(conn.makeSuffix(filter));
- const workerDms = await conn.executeStmt(stmt);
+ // Get workerDms alloweds
+ const dmsIds = await conn.executeStmt(stmt);
+ const allowedIds = dmsIds.map(dms => dms.id);
+ const allowedFilter = mergeFilters(filter, {where: {dmsFk: {inq: allowedIds}, workerFk: id}});
+ let workerDms = await models.WorkerDms.find(allowedFilter);
// Get docuware info
const docuware = await models.Docuware.findOne({
@@ -63,28 +67,43 @@ module.exports = Self => {
});
const docuwareDmsType = docuware.dmsTypeFk;
let workerDocuware = [];
- if (!docuwareDmsType || (docuwareDmsType && await models.DmsType.hasReadRole(ctx, docuwareDmsType))) {
+ if (!filter.skip && (!docuwareDmsType || (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'
+ 'Document ID': 'id',
+ 'URL': 'download',
+ 'Stored by': 'name',
+ 'Estado': 'state'
};
workerDocuware =
- await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? [];
+ await models.Docuware.getById('hr', worker.lastName + ' ' + worker.firstName, docuwareParse) ?? [];
+ const url = (await Self.app.models.Url.getUrl('docuware')) + 'WebClient';
for (document of workerDocuware) {
+ const docuwareId = document.id;
const defaultData = {
- file: 'dw' + document.id + '.png',
- isDocuware: true,
- hardCopyNumber: null,
- hasFile: false,
- reference: worker.fi,
- dmsFk: 'DW' + document.id
+ id: docuwareId,
+ workerFk: id,
+ dmsFk: docuwareId,
+ dms: {
+ id: docuwareId,
+ file: docuwareId + '.pdf',
+ isDocuware: true,
+ hasFile: false,
+ reference: worker.fi,
+ dmsFk: docuwareId,
+ url,
+ description: document.description + ' - ' + document.state,
+ download: document.download,
+ created: document.created,
+ dmsType: {name: 'Docuware'},
+ worker: {id: null, user: {name: document.name}},
+ }
};
-
- document = Object.assign(document, defaultData);
+ Object.assign(document, defaultData);
}
}
return workerDms.concat(workerDocuware);
diff --git a/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js b/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js
index 580e07351..cf1eafa23 100644
--- a/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js
+++ b/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js
@@ -6,7 +6,7 @@ describe('Worker activeWithInheritedRole', () => {
allRolesCount = await app.models.VnRole.count();
});
- it('should return the workers with an inherited role of salesPerson', async() => {
+ it('should return the workers with an inherited role of salesperson', async() => {
const filter = {where: {role: 'salesPerson'}};
const result = await app.models.Worker.activeWithInheritedRole(filter);
diff --git a/modules/worker/back/methods/worker/specs/new.spec.js b/modules/worker/back/methods/worker/specs/new.spec.js
index d3e9cb9d0..66959e0a7 100644
--- a/modules/worker/back/methods/worker/specs/new.spec.js
+++ b/modules/worker/back/methods/worker/specs/new.spec.js
@@ -20,7 +20,7 @@ describe('Worker new', () => {
const employeeId = 1;
const defaultWorker = {
fi: '78457139E',
- name: 'DEFAULTERWORKER',
+ name: 'defaulterworker',
firstName: 'DEFAULT',
lastNames: 'WORKER',
email: 'defaultWorker@mydomain.com',
diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html
index aefbbcf34..e4cec8002 100644
--- a/modules/worker/front/dms/index/index.html
+++ b/modules/worker/front/dms/index/index.html
@@ -2,6 +2,7 @@
vn-id="model"
url="WorkerDms/{{$ctrl.$params.id}}/filter"
link="{worker: $ctrl.$params.id}"
+ filter="$ctrl.filter"
limit="20"
data="$ctrl.workerDms"
order="dmsFk DESC"
@@ -28,37 +29,37 @@
- {{::document.dmsFk}}
+ {{::document.id}}
-
- {{::document.hardCopyNumber}}
+ {{::document.dms.hardCopyNumber}}
-
- {{::document.reference}}
+
+ {{::document.dms.reference}}
-
- {{::document.description}}
+
+ {{::document.dms.description}}
- {{::document.file}}
+ ng-click="$ctrl.downloadFile(document.dmsFk, document.dms.isDocuware)">
+ {{::document.dms.file}}
- {{::document.created | date:'dd/MM/yyyy HH:mm'}}
+ {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}
-
+
@@ -78,7 +79,7 @@
tabindex="-1">
-
+