diff --git a/db/routines/vn/procedures/buy_chekItem.sql b/db/routines/vn/procedures/buy_checkItem.sql similarity index 63% rename from db/routines/vn/procedures/buy_chekItem.sql rename to db/routines/vn/procedures/buy_checkItem.sql index e9e9336b7..1144db889 100644 --- a/db/routines/vn/procedures/buy_chekItem.sql +++ b/db/routines/vn/procedures/buy_checkItem.sql @@ -6,9 +6,10 @@ BEGIN * * @param tmp.buysToCheck(id as INT). */ - DECLARE hasVolumetricAgency INT; + DECLARE vHasVolumetricAgency INT; + DECLARE vItemFk INT; - SELECT a.hasWeightVolumetric INTO hasVolumetricAgency + SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk FROM entry e JOIN travel t ON t.id = e.travelFk JOIN agencyMode a ON a.id = t.agencyModeFk @@ -19,10 +20,10 @@ BEGIN AND a.hasWeightVolumetric LIMIT 1; - DROP TEMPORARY TABLE tmp.buysToCheck; + DROP TEMPORARY TABLE tmp.buysToCheck; - IF hasVolumetricAgency THEN - CALL util.throw('Item lacks size/weight in purchase line at agency'); - END IF; + IF vHasVolumetricAgency THEN + CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk)); + END IF; END$$ -DELIMITER ; \ No newline at end of file +DELIMITER ; diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 89343b193..4622ba271 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -171,16 +171,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) { {userId}, ); - const oldInstance = `{"email": "${ticket.recipient}"}`; - const newInstance = `{"email": ""}`; - await Self.rawSql( - ` - INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance) - VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`, - [ticket.clientFk, oldInstance, newInstance], - {userId}, - ); - const body = `No se ha podido enviar el albarán ${ticket.id} al cliente ${ticket.clientFk} - ${ticket.clientName} porque la dirección de email "${ticket.recipient}" no es correcta diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index b809768a4..82cd1cc2d 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -143,6 +143,10 @@ ], "scopes": { "descriptor": { + "fields": [ + "id", + "phone" + ], "include": [ { "relation": "user", @@ -164,15 +168,29 @@ { "relation": "department", "scope": { + "fields": [ + "departmentFk" + ], "include": [ { - "relation": "department" + "relation": "department", + "scope": { + "fields": [ + "id", + "name" + ] + } } ] } }, { - "relation": "sip" + "relation": "sip", + "scope": { + "fields": [ + "extension" + ] + } } ] } diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index 75265acb4..4860163c1 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -36,42 +36,8 @@ class Controller extends Descriptor { } loadData() { - const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'emailVerified'], - include: { - relation: 'emailUser', - scope: { - fields: ['email'] - } - } - } - }, { - relation: 'client', - scope: { - fields: ['fi'] - } - }, { - relation: 'sip', - scope: { - fields: ['extension'] - } - }, { - relation: 'department', - scope: { - include: { - relation: 'department' - } - } - } - ] - }; - - return this.getData(`Workers/${this.id}`, {filter}) - .then(res => this.entity = res.data); + return this.getData('Workers/descriptor', {filter: {where: {id: this.id}}}) + .then(res => this.entity = res.data[0]); } getPassRequirements() { diff --git a/modules/worker/front/descriptor/index.spec.js b/modules/worker/front/descriptor/index.spec.js index 4f7fa6a05..8797c8b4a 100644 --- a/modules/worker/front/descriptor/index.spec.js +++ b/modules/worker/front/descriptor/index.spec.js @@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { const id = 1; - const response = 'foo'; + const response = ['foo']; $httpBackend.whenGET('UserConfigs/getUserConfig').respond({}); - $httpBackend.expectRoute('GET', `Workers/${id}`).respond(response); + $httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response); controller.id = id; $httpBackend.flush(); - expect(controller.worker).toEqual(response); + expect(controller.worker).toEqual(response[0]); }); });