From 5a946af1ff9bf6e6800ffc7b12d8e5e19b6cf41f Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 15 Apr 2019 08:46:20 +0200 Subject: [PATCH 1/5] error when sending to a salesPerson pay-method changes #1338 --- modules/client/back/models/client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index dd0d61d9c..66c875aa5 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -197,10 +197,11 @@ module.exports = Self => { if (payMethodChanged || ibanChanged || dueDayChanged) { const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`; const salesPersonFk = instance.salesPersonFk; + const salesPerson = await Self.app.models.Worker.findById(salesPersonFk); - if (salesPersonFk) { + if (salesPerson) { await Self.app.models.Message.send(ctx, { - recipientFk: salesPersonFk, + recipientFk: salesPerson.userFk, message: message }); } From fb517cb923079fbf676777d5545984613787eba1 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 16 Apr 2019 12:11:06 +0200 Subject: [PATCH 2/5] fixed catalog price popover --- modules/order/front/prices-popover/index.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/order/front/prices-popover/index.html b/modules/order/front/prices-popover/index.html index 82df68707..def04cb16 100644 --- a/modules/order/front/prices-popover/index.html +++ b/modules/order/front/prices-popover/index.html @@ -48,11 +48,10 @@ x {{::price.price | currency: 'EUR': 2}} - From 2ebc5de4414f849ae8b9bca3016f6b46d6236ec6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 25 Apr 2019 13:22:49 +0200 Subject: [PATCH 3/5] Nginx now logs original proxy src/dst hosts --- front/nginx.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/front/nginx.conf b/front/nginx.conf index d6205af1e..84daf2ef2 100644 --- a/front/nginx.conf +++ b/front/nginx.conf @@ -1,4 +1,12 @@ +set_real_ip_from 0.0.0.0/0; +real_ip_header X-Forwarded-For; +log_format upstreamlog + '[$time_local] $remote_addr -> $proxy_host:$upstream_addr ' + '"$request" $status $body_bytes_sent ' + '"$http_referer" "$http_user_agent"'; +access_log /var/log/nginx/access.log upstreamlog; + upstream back { server back_1:3000; server back_2:3000; From aec46bb8559742ffda56babd2aab418782362956 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 25 Apr 2019 13:32:14 +0200 Subject: [PATCH 4/5] fix send notification to salesPerson #1382 --- .../back/methods/claim/regularizeClaim.js | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 8a897ba5c..8ae47a3fa 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -70,14 +70,16 @@ module.exports = Self => { discount: 100 }, {transaction: transaction}); - await sendMessage(ctx, { - itemFk: sale.itemFk, - ticketFk: sale.ticketFk, - recipientFk: sale.item().itemType().worker().userFk, - quantity: sale.quantity, - concept: sale.concept, - nickname: address.nickname - }, transaction); + if (sale.ticket().client().salesPerson()) { + await sendMessage(ctx, { + itemFk: sale.itemFk, + ticketFk: sale.ticketFk, + recipientFk: sale.ticket().client().salesPerson().userFk, + quantity: sale.quantity, + concept: sale.concept, + nickname: address.nickname + }, transaction); + } } let claim = await Self.findById(params.claimFk); @@ -99,23 +101,14 @@ module.exports = Self => { include: [ { relation: 'ticket', - scope: {fields: ['warehouseFk', 'companyFk']} - }, - { - relation: 'item', scope: { - fields: ['typeFk'], + fields: ['clientFk', 'warehouseFk', 'companyFk'], include: { - relation: 'itemType', + relation: 'client', scope: { - fields: ['workerFk'], include: { - relation: 'worker', - scope: { - fields: ['id', 'userFk'], - } + relation: 'salesPerson' } - } } } From 4465f48afe4ae22fb033906272f874ee345bfc8a Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 25 Apr 2019 13:51:34 +0200 Subject: [PATCH 5/5] fix search by string barcode #1381 --- modules/item/back/methods/item/filter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 0da463ad4..dc4c838c4 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -73,7 +73,7 @@ module.exports = Self => { case 'search': return /^\d+$/.test(value) ? {or: [{'i.id': value}, {'ib.code': value}]} - : {'i.name': {like: `%${value}%`}}; + : {or: [{'i.name': {like: `%${value}%`}}, {'ib.code': value}]}; case 'id': return {'i.id': value}; case 'description':