From 70beaf9b6c12165c9995cde71155b131d3c7c272 Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 16 Mar 2023 09:03:16 +0100 Subject: [PATCH 01/12] =?UTF-8?q?refs=20#5423=20a=C3=B1adido=203r=20decima?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/item/front/last-entries/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index f6cdf8343..8c883d46c 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -86,10 +86,10 @@ class="expendable"> + {{::$ctrl.$t('Cost')}}: {{::entry.buyingValue | currency: 'EUR':3 | dashIfEmpty}}
+ {{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':3 | dashIfEmpty}}
+ {{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':3 | dashIfEmpty}}
+ {{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':3 | dashIfEmpty}}"> {{::entry.cost | currency: 'EUR':2 | dashIfEmpty}}
From f5109724bf491d3b691295304054cb8e84d4b4c7 Mon Sep 17 00:00:00 2001 From: carlossa Date: Fri, 17 Mar 2023 11:39:16 +0100 Subject: [PATCH 02/12] =?UTF-8?q?refs=20#5073=20adaptacion=20para=20solo?= =?UTF-8?q?=20el=20a=C3=B1o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- front/core/components/calendar/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/front/core/components/calendar/index.js b/front/core/components/calendar/index.js index 0e39267a7..f30dac14f 100644 --- a/front/core/components/calendar/index.js +++ b/front/core/components/calendar/index.js @@ -114,12 +114,14 @@ export default class Calendar extends FormInput { let day = date.getDate(); let wday = date.getDay(); let month = date.getMonth(); + let year = date.getFullYear(); const currentDay = Date.vnNew().getDate(); const currentMonth = Date.vnNew().getMonth(); + const currentYear = Date.vnNew().getFullYear(); let classes = { - today: day === currentDay && month === currentMonth, + today: day === currentDay && month === currentMonth && year === currentYear, weekend: wday === 6 || wday === 0, previous: month < this.month, current: month == this.month, From 78d8bbd82ababbb46c38d252ac27b6a45f84cddc Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 20 Mar 2023 10:44:44 +0100 Subject: [PATCH 03/12] refs #5423 tercer decimal en entrada --- modules/item/front/last-entries/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 8c883d46c..609cdb7fa 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -90,7 +90,7 @@ {{::$ctrl.$t('Package')}}: {{::entry.packageValue | currency: 'EUR':3 | dashIfEmpty}}
{{::$ctrl.$t('Freight')}}: {{::entry.freightValue | currency: 'EUR':3 | dashIfEmpty}}
{{::$ctrl.$t('Comission')}}: {{::entry.comissionValue | currency: 'EUR':3 | dashIfEmpty}}"> - {{::entry.cost | currency: 'EUR':2 | dashIfEmpty}} + {{::entry.cost | currency: 'EUR':3 | dashIfEmpty}} {{::entry.weight | dashIfEmpty}} From 634db7c7fcfbdf0567f022db5383215c1b579e90 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 20 Mar 2023 23:09:17 +0100 Subject: [PATCH 04/12] refactor(getTransactions): lilium customer transactions --- .vscode/settings.json | 7 ++- .../back/methods/client/getTransactions.js | 55 +++++++++++++++---- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 82815d588..05d23f3bb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,10 @@ "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, - "search.useIgnoreFiles": false + "search.useIgnoreFiles": false, + "editor.defaultFormatter": "dbaeumer.vscode-eslint", + "eslint.format.enable": true, + "[javascript]": { + "editor.defaultFormatter": "dbaeumer.vscode-eslint" + } } diff --git a/modules/client/back/methods/client/getTransactions.js b/modules/client/back/methods/client/getTransactions.js index 45183bbdc..4116f3ee1 100644 --- a/modules/client/back/methods/client/getTransactions.js +++ b/modules/client/back/methods/client/getTransactions.js @@ -1,43 +1,78 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; +const buildFilter = require('vn-loopback/util/filter').buildFilter; +const mergeFilters = require('vn-loopback/util/filter').mergeFilters; module.exports = Self => { - Self.remoteMethod('getTransactions', { - description: 'Returns last entries', + Self.remoteMethodCtx('transactions', { + description: 'Returns customer transactions', accessType: 'READ', - accepts: [{ - arg: 'filter', - type: 'object', - description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', - http: {source: 'query'} - }], + accepts: [ + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + }, + { + arg: 'orderFk', + type: 'number', + http: {source: 'query'} + }, + { + arg: 'clientFk', + type: 'number', + http: {source: 'query'} + }, + { + arg: 'amount', + type: 'number', + http: {source: 'query'} + } + ], returns: { type: ['object'], root: true }, http: { - path: `/getTransactions`, + path: `/transactions`, verb: 'GET' } }); - Self.getTransactions = async(filter, options) => { + Self.transactions = async(ctx, filter, options) => { + const args = ctx.args; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); + const where = buildFilter(args, (param, value) => { + switch (param) { + case 'orderFk': + return {'t.id': value}; + case 'clientFk': + return {'t.clientFk': value}; + case 'amount': + return {'t.amount': (value * 100)}; + } + }); + + filter = mergeFilters(args.filter, {where}); + const conn = Self.dataSource.connector; const stmt = new ParameterizedSQL(` SELECT t.id, t.clientFk, + c.name AS customerName, t.created, t.amount / 100 amount, t.receiptFk IS NOT NULL AS isConfirmed, tt.message responseMessage, te.message errorMessage FROM hedera.tpvTransaction t + JOIN client c ON c.id = t.clientFk JOIN hedera.tpvMerchant m ON m.id = t.merchantFk LEFT JOIN hedera.tpvResponse tt ON tt.id = t.response LEFT JOIN hedera.tpvError te ON te.code = errorCode`); From 46a6a5fc631d6c83cf0a2b3124a9a1c3e05df0a3 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 21 Mar 2023 08:51:30 +0100 Subject: [PATCH 05/12] refs #5203 refactor: se le pasan los argumentos directamente y se corrige la transaccion --- db/dump/fixtures.sql | 3 +- .../back/methods/supplier/newSupplier.js | 34 +++++---------- .../supplier/specs/newSupplier.spec.js | 42 +++++++++++-------- modules/supplier/front/create/index.html | 7 ++-- 4 files changed, 42 insertions(+), 44 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c4df3e84f..2145f8429 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -299,7 +299,8 @@ INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt INSERT INTO `vn`.`payDem`(`id`, `payDem`) VALUES (1, 10), - (2, 20); + (2, 20), + (7, 0); INSERT INTO `vn`.`autonomy`(`id`, `name`, `countryFk`) VALUES diff --git a/modules/supplier/back/methods/supplier/newSupplier.js b/modules/supplier/back/methods/supplier/newSupplier.js index ae71380f3..c40e7214f 100644 --- a/modules/supplier/back/methods/supplier/newSupplier.js +++ b/modules/supplier/back/methods/supplier/newSupplier.js @@ -1,11 +1,10 @@ module.exports = Self => { - Self.remoteMethod('newSupplier', { + Self.remoteMethodCtx('newSupplier', { description: 'Creates a new supplier and returns it', accessType: 'WRITE', accepts: [{ - arg: 'params', - type: 'object', - http: {source: 'body'} + arg: 'name', + type: 'string' }], returns: { type: 'string', @@ -17,29 +16,18 @@ module.exports = Self => { } }); - Self.newSupplier = async params => { + Self.newSupplier = async(ctx, options) => { const models = Self.app.models; + const args = ctx.args; const myOptions = {}; - if (typeof(params) == 'string') - params = JSON.parse(params); + if (typeof options == 'object') + Object.assign(myOptions, options); - params.nickname = params.name; + delete args.ctx; + const data = {...args, ...{nickname: args.name}}; + const supplier = await models.Supplier.create(data, myOptions); - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); - myOptions.transaction = tx; - } - - try { - const supplier = await models.Supplier.create(params, myOptions); - - if (tx) await tx.commit(); - - return supplier; - } catch (e) { - if (tx) await tx.rollback(); - throw e; - } + return supplier; }; }; diff --git a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js index 44252e71b..d4479d00b 100644 --- a/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js +++ b/modules/supplier/back/methods/supplier/specs/newSupplier.spec.js @@ -1,31 +1,39 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); describe('Supplier newSupplier()', () => { - const newSupp = { - name: 'TestSupplier-1' - }; const administrativeId = 5; + const activeCtx = { + accessToken: {userId: administrativeId}, + http: { + req: { + headers: {origin: 'http://localhost'} + } + } + }; + const ctx = {req: activeCtx}; - it('should create a new supplier containing only the name', async() => { - pending('https://redmine.verdnatura.es/issues/5203'); - const activeCtx = { - accessToken: {userId: administrativeId}, - }; + beforeEach(() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); + }); - let result = await app.models.Supplier.newSupplier(JSON.stringify(newSupp)); + it('should create a new supplier containing only the name', async() => { + const tx = await models.Supplier.beginTransaction({}); - expect(result.name).toEqual('TestSupplier-1'); - expect(result.id).toEqual(443); + try { + const options = {transaction: tx}; + ctx.args = { + name: 'newSupplier' + }; - const createdSupplier = await app.models.Supplier.findById(result.id); + const result = await models.Supplier.newSupplier(ctx, options); - expect(createdSupplier.id).toEqual(result.id); - expect(createdSupplier.name).toEqual(result.name); - expect(createdSupplier.payDemFk).toEqual(7); - expect(createdSupplier.nickname).toEqual(result.name); + expect(result.name).toEqual('newSupplier'); + } catch (e) { + await tx.rollback(); + throw e; + } }); }); diff --git a/modules/supplier/front/create/index.html b/modules/supplier/front/create/index.html index 446a16cb6..c3efcf6ae 100644 --- a/modules/supplier/front/create/index.html +++ b/modules/supplier/front/create/index.html @@ -1,7 +1,8 @@ @@ -9,8 +10,8 @@ From 3881e435f4f9c50b8fd832193b3e9ad332fe22ab Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 21 Mar 2023 09:55:45 +0100 Subject: [PATCH 06/12] Renamed method --- .../{getTransactions.js => transactions.js} | 0 modules/client/back/models/client-methods.js | 2 +- modules/client/front/web-payment/index.html | 86 ++++++++----------- 3 files changed, 36 insertions(+), 52 deletions(-) rename modules/client/back/methods/client/{getTransactions.js => transactions.js} (100%) diff --git a/modules/client/back/methods/client/getTransactions.js b/modules/client/back/methods/client/transactions.js similarity index 100% rename from modules/client/back/methods/client/getTransactions.js rename to modules/client/back/methods/client/transactions.js diff --git a/modules/client/back/models/client-methods.js b/modules/client/back/models/client-methods.js index 9241d80cf..fc77fc090 100644 --- a/modules/client/back/models/client-methods.js +++ b/modules/client/back/models/client-methods.js @@ -13,7 +13,7 @@ module.exports = Self => { require('../methods/client/getCard')(Self); require('../methods/client/getDebt')(Self); require('../methods/client/getMana')(Self); - require('../methods/client/getTransactions')(Self); + require('../methods/client/transactions')(Self); require('../methods/client/hasCustomerRole')(Self); require('../methods/client/isValidClient')(Self); require('../methods/client/lastActiveTickets')(Self); diff --git a/modules/client/front/web-payment/index.html b/modules/client/front/web-payment/index.html index 203d4bb60..2ecfc950b 100644 --- a/modules/client/front/web-payment/index.html +++ b/modules/client/front/web-payment/index.html @@ -1,55 +1,39 @@ - + - + - - - - State - Id - Date - Amount - - - - - - - - - - - - {{::transaction.id}} - {{::transaction.created | date:'dd/MM/yyyy HH:mm'}} - {{::transaction.amount | currency: 'EUR':2}} - - - - - - - + + + + State + Id + Date + Amount + + + + + + + + + + + + {{::transaction.id}} + {{::transaction.created | date:'dd/MM/yyyy HH:mm'}} + {{::transaction.amount | currency: 'EUR':2}} + + + + + + + \ No newline at end of file From 12a9ff599bc191bd38d6423b451ddb64ed529941 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 21 Mar 2023 10:05:27 +0100 Subject: [PATCH 07/12] Updated unit test --- .../client/specs/getTransactions.spec.js | 21 ------ .../methods/client/specs/transactions.spec.js | 66 +++++++++++++++++++ .../back/methods/client/transactions.js | 2 +- 3 files changed, 67 insertions(+), 22 deletions(-) delete mode 100644 modules/client/back/methods/client/specs/getTransactions.spec.js create mode 100644 modules/client/back/methods/client/specs/transactions.spec.js diff --git a/modules/client/back/methods/client/specs/getTransactions.spec.js b/modules/client/back/methods/client/specs/getTransactions.spec.js deleted file mode 100644 index 0387eb59a..000000000 --- a/modules/client/back/methods/client/specs/getTransactions.spec.js +++ /dev/null @@ -1,21 +0,0 @@ -const models = require('vn-loopback/server/server').models; - -describe('Client getTransations', () => { - it('should call getTransations() method to receive a list of Web Payments from Bruce Wayne', async() => { - const tx = await models.Client.beginTransaction({}); - - try { - const options = {transaction: tx}; - - const filter = {where: {clientFk: 1101}}; - const result = await models.Client.getTransactions(filter, options); - - expect(result[1].id).toBeTruthy(); - - await tx.rollback(); - } catch (e) { - await tx.rollback(); - throw e; - } - }); -}); diff --git a/modules/client/back/methods/client/specs/transactions.spec.js b/modules/client/back/methods/client/specs/transactions.spec.js new file mode 100644 index 000000000..b4af40195 --- /dev/null +++ b/modules/client/back/methods/client/specs/transactions.spec.js @@ -0,0 +1,66 @@ +const models = require('vn-loopback/server/server').models; + +describe('Client transactions', () => { + it('should call transactions() method to receive a list of Web Payments from Bruce Wayne', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {}; + const filter = {where: {clientFk: 1101}}; + const result = await models.Client.transactions(ctx, filter, options); + + expect(result[1].id).toBeTruthy(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should call transactions() method filtering by orderFk', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {args: {orderFk: 6}}; + const filter = {}; + const result = await models.Client.transactions(ctx, filter, options); + + const firstRow = result[0]; + + expect(result.length).toEqual(1); + expect(firstRow.id).toEqual(6); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should call transactions() method filtering by amount', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const ctx = {args: {amount: 40}}; + const filter = {}; + const result = await models.Client.transactions(ctx, filter, options); + + const randomIndex = Math.floor(Math.random() * result.length); + const transaction = result[randomIndex]; + + expect(transaction.amount).toEqual(40); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/client/back/methods/client/transactions.js b/modules/client/back/methods/client/transactions.js index 4116f3ee1..691910721 100644 --- a/modules/client/back/methods/client/transactions.js +++ b/modules/client/back/methods/client/transactions.js @@ -58,7 +58,7 @@ module.exports = Self => { } }); - filter = mergeFilters(args.filter, {where}); + filter = mergeFilters(filter, {where}); const conn = Self.dataSource.connector; const stmt = new ParameterizedSQL(` From 6d6c2cbfb3828575ff1d9349d99fc28fd8bd622c Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 21 Mar 2023 10:09:03 +0100 Subject: [PATCH 08/12] Default formatter --- .vscode/settings.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 05d23f3bb..159cecdc9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,9 +6,5 @@ "source.fixAll.eslint": true }, "search.useIgnoreFiles": false, - "editor.defaultFormatter": "dbaeumer.vscode-eslint", - "eslint.format.enable": true, - "[javascript]": { - "editor.defaultFormatter": "dbaeumer.vscode-eslint" - } + "editor.defaultFormatter": "dbaeumer.vscode-eslint" } From 5598bbaaa8a645a76475149e89dcb5b48b9751b3 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 22 Mar 2023 10:13:37 +0100 Subject: [PATCH 09/12] fix e2e --- e2e/helpers/selectors.js | 3 +-- e2e/paths/03-worker/04_time_control.spec.js | 6 +++--- e2e/paths/03-worker/06_create.spec.js | 1 - e2e/paths/05-ticket/21_future.spec.js | 6 +++--- e2e/paths/05-ticket/22_advance.spec.js | 8 ++++---- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index f20d75310..0762a79f0 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -524,7 +524,7 @@ export default { }, itemLog: { anyLineCreated: 'vn-item-log > vn-log vn-tbody > vn-tr', - fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) table tr:nth-child(4) td.after', + fifthLineCreatedProperty: 'vn-item-log > vn-log vn-tbody > vn-tr:nth-child(5) table tr:nth-child(5) td.after', }, ticketSummary: { header: 'vn-ticket-summary > vn-card > h5', @@ -1040,7 +1040,6 @@ export default { boss: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bossFk"]', role: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.roleFk"]', iban: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.iban"]', - switft: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bankEntityFk"]', createButton: 'vn-worker-create vn-submit[label="Create"]', }, workerPda: { diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index eb1417ba9..5f64aa6ce 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -27,7 +27,7 @@ describe('Worker time control path', () => { date.setMonth(date.getMonth() + 1); let month = date.toLocaleString('default', {month: 'long'}); - await page.click(selectors.workerTimeControl.nextMonthButton); + await page.waitToClick(selectors.workerTimeControl.nextMonthButton); let result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText'); expect(result).toContain(month); @@ -36,7 +36,7 @@ describe('Worker time control path', () => { date.setDate(1); month = date.toLocaleString('default', {month: 'long'}); - await page.click(selectors.workerTimeControl.previousMonthButton); + await page.waitToClick(selectors.workerTimeControl.previousMonthButton); result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText'); expect(result).toContain(month); @@ -49,7 +49,7 @@ describe('Worker time control path', () => { await page.loginAndModule('salesBoss', 'worker'); await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`); - await page.click(selectors.workerTimeControl.secondWeekDay); + await page.waitToClick(selectors.workerTimeControl.secondWeekDay); result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText'); diff --git a/e2e/paths/03-worker/06_create.spec.js b/e2e/paths/03-worker/06_create.spec.js index 5f6f5cf9f..98e67edbf 100644 --- a/e2e/paths/03-worker/06_create.spec.js +++ b/e2e/paths/03-worker/06_create.spec.js @@ -26,7 +26,6 @@ describe('Worker create path', () => { await page.write(selectors.workerCreate.street, 'S/ Doomstadt'); await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com'); await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332'); - await page.autocompleteSearch(selectors.workerCreate.switft, 'BBKKESMMMMM'); // should check for autocompleted worker code and worker user name const workerCode = await page diff --git a/e2e/paths/05-ticket/21_future.spec.js b/e2e/paths/05-ticket/21_future.spec.js index 2b8057247..626056958 100644 --- a/e2e/paths/05-ticket/21_future.spec.js +++ b/e2e/paths/05-ticket/21_future.spec.js @@ -54,7 +54,7 @@ describe('Ticket Future path', () => { it('should search with the origin IPT', async() => { await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketFuture.ipt, 'Horizontal'); + await page.autocompleteSearch(selectors.ticketFuture.ipt, 'H'); await page.waitToClick(selectors.ticketFuture.submit); expect(httpRequest).toContain('ipt=H'); @@ -65,7 +65,7 @@ describe('Ticket Future path', () => { await page.clearInput(selectors.ticketFuture.ipt); - await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'Horizontal'); + await page.autocompleteSearch(selectors.ticketFuture.futureIpt, 'H'); await page.waitToClick(selectors.ticketFuture.submit); expect(httpRequest).toContain('futureIpt=H'); @@ -108,7 +108,7 @@ describe('Ticket Future path', () => { it('should search in smart-table with an IPT Destination', async() => { await page.waitToClick(selectors.ticketFuture.tableButtonSearch); - await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'Horizontal'); + await page.autocompleteSearch(selectors.ticketFuture.tableFutureIpt, 'H'); expect(httpRequest).toContain('futureIpt'); await page.waitToClick(selectors.ticketFuture.tableButtonSearch); diff --git a/e2e/paths/05-ticket/22_advance.spec.js b/e2e/paths/05-ticket/22_advance.spec.js index f8442bf12..15f9dd5bb 100644 --- a/e2e/paths/05-ticket/22_advance.spec.js +++ b/e2e/paths/05-ticket/22_advance.spec.js @@ -54,7 +54,7 @@ describe('Ticket Advance path', () => { it('should search with the origin IPT', async() => { await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal'); + await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'H'); await page.waitToClick(selectors.ticketAdvance.submit); expect(httpRequest).toContain('futureIpt=H'); @@ -66,7 +66,7 @@ describe('Ticket Advance path', () => { it('should search with the destination IPT', async() => { await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton); - await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal'); + await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'H'); await page.waitToClick(selectors.ticketAdvance.submit); expect(httpRequest).toContain('ipt=H'); @@ -78,7 +78,7 @@ describe('Ticket Advance path', () => { it('should search in smart-table with an IPT Origin', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); - await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical'); + await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'V'); expect(httpRequest).toContain('futureIpt'); @@ -89,7 +89,7 @@ describe('Ticket Advance path', () => { it('should search in smart-table with an IPT Destination', async() => { await page.waitToClick(selectors.ticketAdvance.tableButtonSearch); - await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical'); + await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'V'); expect(httpRequest).toContain('ipt'); From 59c3ef23de9f1887a0428d9ee49bca6e4d7743aa Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 22 Mar 2023 11:03:13 +0100 Subject: [PATCH 10/12] grabUser added --- modules/entry/back/models/buy.json | 5 +++-- modules/entry/back/models/entry.json | 3 ++- modules/item/back/models/item.json | 5 +++-- modules/route/back/models/route.json | 3 ++- modules/ticket/back/models/sale.json | 3 ++- modules/ticket/back/models/ticket.json | 7 ++++--- modules/travel/back/models/travel.json | 3 ++- 7 files changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/entry/back/models/buy.json b/modules/entry/back/models/buy.json index 8e36d0eef..de2ddffd6 100644 --- a/modules/entry/back/models/buy.json +++ b/modules/entry/back/models/buy.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model": "EntryLog", - "relation": "entry" + "relation": "entry", + "grabUser": true }, "options": { "mysql": { @@ -70,4 +71,4 @@ "foreignKey": "packageFk" } } -} \ No newline at end of file +} diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index d9b7c52df..48b4d1be0 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -2,7 +2,8 @@ "name": "Entry", "base": "Loggable", "log": { - "model":"EntryLog" + "model":"EntryLog", + "grabUser": true }, "options": { "mysql": { diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 2f58c30a9..dc38a44e6 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model": "ItemLog", - "showField": "id" + "showField": "id", + "grabUser": true }, "options": { "mysql": { @@ -214,4 +215,4 @@ } } } -} \ No newline at end of file +} diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json index 12b9785db..3b12f4ee6 100644 --- a/modules/route/back/models/route.json +++ b/modules/route/back/models/route.json @@ -2,7 +2,8 @@ "name": "Route", "base": "Loggable", "log": { - "model":"RouteLog" + "model":"RouteLog", + "grabUser": true }, "options": { "mysql": { diff --git a/modules/ticket/back/models/sale.json b/modules/ticket/back/models/sale.json index b30954ad1..b1f70f5e2 100644 --- a/modules/ticket/back/models/sale.json +++ b/modules/ticket/back/models/sale.json @@ -4,7 +4,8 @@ "log": { "model": "TicketLog", "relation": "ticket", - "showField": "concept" + "showField": "concept", + "grabUser": true }, "options": { "mysql": { diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 09b01d213..89ebde85d 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model":"TicketLog", - "showField": "id" + "showField": "id", + "grabUser": true }, "options": { "mysql": { @@ -36,7 +37,7 @@ "type": "number" }, "updated": { - "type": "date", + "type": "date", "mysql": { "columnName": "created" } @@ -136,4 +137,4 @@ "foreignKey": "zoneFk" } } -} \ No newline at end of file +} diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json index c20b7b0bf..7dd9f5bba 100644 --- a/modules/travel/back/models/travel.json +++ b/modules/travel/back/models/travel.json @@ -3,7 +3,8 @@ "base": "Loggable", "log": { "model":"TravelLog", - "showField": "ref" + "showField": "ref", + "grabUser": true }, "options": { "mysql": { From 81472a5e50b63758cbecac683ef2470275ed8566 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 22 Mar 2023 11:36:28 +0100 Subject: [PATCH 11/12] removed duplicated log --- modules/ticket/back/methods/ticket/new.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index e6048421e..e7e4cd01b 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -126,19 +126,6 @@ module.exports = Self => { ], myOptions); const ticket = await models.Ticket.findById(result[1][0].newTicketId, null, myOptions); - const cleanInstance = JSON.parse(JSON.stringify(ticket)); - - const logRecord = { - originFk: cleanInstance.id, - userFk: myUserId, - action: 'insert', - changedModel: 'Ticket', - changedModelId: cleanInstance.id, - oldInstance: {}, - newInstance: cleanInstance - }; - - await models.TicketLog.create(logRecord, myOptions); if (tx) await tx.commit(); From fcd422eb497efd7634f065d07482990a7ac4ea7a Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 22 Mar 2023 14:55:54 +0100 Subject: [PATCH 12/12] added relation --- modules/claim/back/models/claim.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index cd5b767e4..4b26720e5 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -82,6 +82,11 @@ "type": "hasMany", "model": "ClaimDms", "foreignKey": "claimFk" + }, + "lines": { + "type": "hasMany", + "model": "ClaimBeginning", + "foreignKey": "claimFk" } } }