From 0e1ae9b46b622e911ea1590ec568f0788b6dea38 Mon Sep 17 00:00:00 2001 From: Joan Date: Wed, 7 Nov 2018 13:32:09 +0100 Subject: [PATCH] fixed tags sourceTable selection #764, ticket packaging fix --- .../core/src/components/autocomplete/autocomplete.js | 10 ++++++---- client/item/src/tags/index.html | 2 +- client/item/src/tags/index.js | 6 ++---- e2e/paths/client-module/04_edit_pay_method.spec.js | 6 +++--- .../ticket-module/04_create_ticket_packages.spec.js | 3 +-- .../ticket/common/methods/packaging/listPackaging.js | 5 +++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/client/core/src/components/autocomplete/autocomplete.js b/client/core/src/components/autocomplete/autocomplete.js index 3bf021139..c31b4881e 100755 --- a/client/core/src/components/autocomplete/autocomplete.js +++ b/client/core/src/components/autocomplete/autocomplete.js @@ -168,12 +168,12 @@ export default class Autocomplete extends Input { } onSelectionRequest(data) { - if (data && data.length > 0) + if (data && data.length > 0) { if (this.multiple) this.selection = data; else this.selection = data[0]; - else + } else this.selection = null; } @@ -181,7 +181,7 @@ export default class Autocomplete extends Input { let display = ''; let hasTemplate = this.$transclude && this.$transclude.isSlotFilled('tplItem'); - if (this._selection && this.showField) + if (this._selection && this.showField) { if (this.multiple && Array.isArray(this._selection)) { for (let item of this._selection) { if (display.length > 0) display += ', '; @@ -194,12 +194,14 @@ export default class Autocomplete extends Input { display = this.$interpolate(template)(this._selection); } } + } this.input.value = display; - if (this.translateFields) + if (this.translateFields) { if (this.translateFields.indexOf(this.showField) > -1) this.input.value = this.$translate.instant(display); + } this.mdlUpdate(); } diff --git a/client/item/src/tags/index.html b/client/item/src/tags/index.html index 3e27bbb65..bc0b0d72f 100644 --- a/client/item/src/tags/index.html +++ b/client/item/src/tags/index.html @@ -45,7 +45,7 @@ ng-show="tag.selection.isFree === false" vn-three url="{{$ctrl.getSourceTable(tag.selection)}}" - where="{name: {like: 'search%'}}" + search-function="{name: {regexp: $search}}" label="Value" field="itemTag.value" show-field="name" diff --git a/client/item/src/tags/index.js b/client/item/src/tags/index.js index dd3141ee4..3fa90bed5 100644 --- a/client/item/src/tags/index.js +++ b/client/item/src/tags/index.js @@ -7,7 +7,7 @@ class Controller { this.include = { relation: 'tag', scope: { - fields: ['id', 'name', 'isFree'] + fields: ['id', 'name', 'isFree', 'sourceTable'] } }; } @@ -31,13 +31,11 @@ class Controller { getSourceTable(selection) { if (!selection || selection.isFree === true) return null; - if (selection.sourceTable) { return '/api/' + selection.sourceTable.charAt(0).toUpperCase() + selection.sourceTable.substring(1) + 's'; - } else if (selection.sourceTable == null) { + } else if (selection.sourceTable == null) return `/api/ItemTags/filterItemTags/${selection.id}`; - } } onSubmit() { diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js index 8f0523f3c..f276f70bd 100644 --- a/e2e/paths/client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -113,7 +113,7 @@ describe('Client Edit pay method path', () => { it('should confirm Received LCR checkbox is checked', async () => { const checkedBox = await nightmare - .evaluate((selector) => { + .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientPayMethod.receivedCoreLCRCheckbox); @@ -122,7 +122,7 @@ describe('Client Edit pay method path', () => { it('should confirm Received core VNL checkbox is unchecked', async () => { const checkedBox = await nightmare - .evaluate((selector) => { + .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientPayMethod.receivedCoreVNLCheckbox); @@ -131,7 +131,7 @@ describe('Client Edit pay method path', () => { it('should confirm Received B2B VNL checkbox is unchecked', async () => { const checkedBox = await nightmare - .evaluate((selector) => { + .evaluate(selector => { return document.querySelector(selector).checked; }, selectors.clientPayMethod.receivedB2BVNLCheckbox); diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js index b2c6b22d7..18ada323d 100644 --- a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -// e2e path excluded ultil #764 is completed -xdescribe('Ticket Create packages path', () => { +describe('Ticket Create packages path', () => { const nightmare = createNightmare(); beforeAll(() => { diff --git a/services/ticket/common/methods/packaging/listPackaging.js b/services/ticket/common/methods/packaging/listPackaging.js index 117b51000..9a830a2ad 100644 --- a/services/ticket/common/methods/packaging/listPackaging.js +++ b/services/ticket/common/methods/packaging/listPackaging.js @@ -23,6 +23,7 @@ module.exports = Self => { }); Self.listPackaging = async filter => { + let conn = Self.dataSource.connector; let stmt = new ParameterizedSQL( `SELECT name, itemFk, packagingFk FROM (SELECT i.name, i.id itemFk, p.id packagingFk @@ -30,7 +31,7 @@ module.exports = Self => { JOIN packaging p ON i.id = p.itemFk) p` ); - stmt.merge(Self.buildSuffix(filter)); - return Self.rawStmt(stmt); + stmt.merge(conn.makeSuffix(filter)); + return conn.executeStmt(stmt); }; };