From 42b8f08a4d8350bda5f3063376012306d879bb2b Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 22 Feb 2023 12:14:17 +0100 Subject: [PATCH 1/2] refs #5168 checked sales with logs --- modules/ticket/back/methods/ticket/getSales.js | 10 ++++++++++ modules/ticket/front/sale/index.html | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index 3e45b3fb5..321e8e24e 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -87,6 +87,14 @@ module.exports = Self => { for (let problem of problems) saleProblems.set(problem.saleFk, problem); + const ticketLog = await Self.rawSql(`SELECT DISTINCT changedModelId + FROM ticketLog tl + WHERE changedModel = 'Sale' + AND originFk = ?`, [id], myOptions); + const salesWithLogs = ticketLog.map(sale => { + return sale.changedModelId; + }); + for (let sale of sales) { const problems = saleProblems.get(sale.id); const itemStock = itemAvailable.get(sale.itemFk); @@ -98,6 +106,8 @@ module.exports = Self => { sale.hasTicketRequest = problems.hasTicketRequest; sale.hasComponentLack = problems.hasComponentLack; } + if (salesWithLogs.includes(sale.id)) + sale.$hasLogs = true; } return sales; diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index fd259e120..8764417a8 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -211,7 +211,8 @@ vn-none vn-tooltip="History" icon="history" - ng-click="log.open()"> + ng-click="log.open()" + ng-show="sale.$hasLogs"> Date: Wed, 22 Feb 2023 12:52:54 +0100 Subject: [PATCH 2/2] refs #5168 fixed e2e --- e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index 9d6fddbe6..9e4898be9 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -197,6 +197,7 @@ describe('Ticket Edit sale path', () => { }); it('should check in the history that logs has been added', async() => { + await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']}); await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton); await page.waitForSelector(selectors.ticketSales.firstSaleHistory); const result = await page.countElement(selectors.ticketSales.firstSaleHistory);