From 5b4a3cd3709f8ee9920f926b347e973d95139b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Thu, 3 Sep 2020 16:52:35 +0200 Subject: [PATCH] Travel autocomplete fix --- modules/entry/front/create/index.html | 4 ++-- modules/entry/front/create/index.js | 10 +++++----- modules/travel/back/methods/travel/filter.js | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/entry/front/create/index.html b/modules/entry/front/create/index.html index 262e904d7..77fd92d55 100644 --- a/modules/entry/front/create/index.html +++ b/modules/entry/front/create/index.html @@ -33,8 +33,8 @@ ng-model="$ctrl.entry.travelFk" url="Travels/filter" search-function="$ctrl.searchFunction($search)" - value-field="t.id" - order="t.id" + value-field="id" + order="id" label="Travel" required="true"> diff --git a/modules/entry/front/create/index.js b/modules/entry/front/create/index.js index ec022afed..5c61730f9 100644 --- a/modules/entry/front/create/index.js +++ b/modules/entry/front/create/index.js @@ -26,11 +26,11 @@ export default class Controller extends Section { searchFunction($search) { return {or: [ - {'am.name': {like: `%${$search}%`}}, - {'win.name': {like: `%${$search}%`}}, - {'wout.name': {like: `%${$search}%`}}, - {'t.shipped': new Date($search)}, - {'t.landed': new Date($search)} + {'agencyModeName': {like: `%${$search}%`}}, + {'warehouseInName': {like: `%${$search}%`}}, + {'warehouseOutName': {like: `%${$search}%`}}, + {'shipped': new Date($search)}, + {'landed': new Date($search)} ]}; } } diff --git a/modules/travel/back/methods/travel/filter.js b/modules/travel/back/methods/travel/filter.js index 0cfafd7ba..024448bfe 100644 --- a/modules/travel/back/methods/travel/filter.js +++ b/modules/travel/back/methods/travel/filter.js @@ -112,7 +112,8 @@ module.exports = Self => { let stmts = []; let stmt; stmt = new ParameterizedSQL( - `SELECT + `SELECT * FROM + (SELECT t.id, t.shipped, t.landed, @@ -132,7 +133,7 @@ module.exports = Self => { FROM vn.travel t JOIN vn.agencyMode am ON am.id = t.agencyFk JOIN vn.warehouse win ON win.id = t.warehouseInFk - JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk` + JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk) AS t` ); stmt.merge(conn.makeSuffix(filter));