From 2c9fd45958a59b158c506ef760ba79e73430b97e Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 5 Feb 2021 12:09:48 +0100 Subject: [PATCH] 2778 - Allow edit order number --- back/methods/dms/updateFile.js | 27 ++++++++++---- back/models/dms.json | 2 +- .../worker/back/methods/worker-dms/filter.js | 2 +- modules/worker/front/dms/edit/index.html | 2 +- modules/worker/front/dms/index/index.html | 9 ++++- modules/worker/front/dms/index/index.js | 36 ------------------- 6 files changed, 31 insertions(+), 47 deletions(-) diff --git a/back/methods/dms/updateFile.js b/back/methods/dms/updateFile.js index a420f2ea1..4182148f7 100644 --- a/back/methods/dms/updateFile.js +++ b/back/methods/dms/updateFile.js @@ -11,25 +11,37 @@ module.exports = Self => { type: 'Number', description: 'The document id', http: {source: 'path'} - }, { + }, + { arg: 'warehouseId', type: 'Number', description: 'The warehouse id' - }, { + }, + { arg: 'companyId', type: 'Number', description: 'The company id' - }, { + }, + { arg: 'dmsTypeId', type: 'Number', description: 'The dms type id' - }, { + }, + { arg: 'reference', type: 'String' - }, { + }, + { arg: 'description', type: 'String' - }, { + }, + { + arg: 'hasFile', + type: 'Boolean', + description: 'True if has an attached file', + required: true + }, + { arg: 'hasFileAttached', type: 'Boolean', description: 'True if has an attached file' @@ -70,7 +82,8 @@ module.exports = Self => { companyFk: args.companyId, warehouseFk: args.warehouseId, reference: args.reference, - description: args.description + description: args.description, + hasFile: args.hasFile }, myOptions); if (args.hasFileAttached) diff --git a/back/models/dms.json b/back/models/dms.json index 1d9e3ec21..f517a23ff 100644 --- a/back/models/dms.json +++ b/back/models/dms.json @@ -30,7 +30,7 @@ "type": "string" }, "hardCopyNumber": { - "type": "Number" + "type": "number" }, "hasFile": { "type": "boolean" diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index 553cf2a25..82216f956 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -28,7 +28,7 @@ module.exports = Self => { const account = await Self.app.models.Account.findById(userId); const stmt = new ParameterizedSQL( - `SELECT d.id dmsFk, d.reference, d.description, d.file, d.created + `SELECT d.id dmsFk, d.reference, d.description, d.file, d.created, d.hardCopyNumber, d.hasFile FROM workerDocument wd JOIN dms d ON d.id = wd.document JOIN dmsType dt ON dt.id = d.dmsTypeFk diff --git a/modules/worker/front/dms/edit/index.html b/modules/worker/front/dms/edit/index.html index 13bf6f953..2ac96851c 100644 --- a/modules/worker/front/dms/edit/index.html +++ b/modules/worker/front/dms/edit/index.html @@ -68,7 +68,7 @@ - diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index d6e1bc25c..6ad1cffd8 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -15,6 +15,7 @@ Id + Order Reference Description Original @@ -28,6 +29,12 @@ {{::document.dmsFk}} + + + {{::document.hardCopyNumber}} + + {{::document.reference}} @@ -40,7 +47,7 @@ diff --git a/modules/worker/front/dms/index/index.js b/modules/worker/front/dms/index/index.js index e67240a73..9bb3c896a 100644 --- a/modules/worker/front/dms/index/index.js +++ b/modules/worker/front/dms/index/index.js @@ -6,42 +6,6 @@ class Controller extends Component { constructor($element, $, vnFile) { super($element, $); this.vnFile = vnFile; - this.filter = { - include: { - relation: 'dms', - scope: { - fields: [ - 'dmsTypeFk', - 'reference', - 'hardCopyNumber', - 'workerFk', - 'description', - 'hasFile', - 'file', - 'created', - ], - include: [ - { - relation: 'dmsType', - scope: { - fields: ['name'] - } - }, { - relation: 'worker', - scope: { - fields: ['userFk'], - include: { - relation: 'user', - scope: { - fields: ['nickname'] - } - }, - } - } - ] - }, - } - }; } deleteDms(index) {