From e85d6bec8cd6c8f379d235aa2f28be3d85a1fed2 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 10 Oct 2022 14:03:29 +0200 Subject: [PATCH 1/6] fix e2e --- e2e/helpers/selectors.js | 4 ++-- e2e/paths/10-travel/04_extra_community.spec.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index fedcaf5f9..cd6d39795 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -1022,8 +1022,8 @@ export default { }, travelExtraCommunity: { anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]', - firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-textfield[ng-model="travel.ref"]', - firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-input-number[ng-model="travel.kg"]', + firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="reference"]', + firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="lockedKg"]', removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i' }, travelBasicData: { diff --git a/e2e/paths/10-travel/04_extra_community.spec.js b/e2e/paths/10-travel/04_extra_community.spec.js index a1cad6a7d..c5975c958 100644 --- a/e2e/paths/10-travel/04_extra_community.spec.js +++ b/e2e/paths/10-travel/04_extra_community.spec.js @@ -19,10 +19,10 @@ describe('Travel extra community path', () => { it('should edit the travel reference and the locked kilograms', async() => { await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter); await page.waitForSpinnerLoad(); - await page.clearInput(selectors.travelExtraCommunity.firstTravelReference); - await page.write(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); - await page.clearInput(selectors.travelExtraCommunity.firstTravelLockedKg); - await page.write(selectors.travelExtraCommunity.firstTravelLockedKg, '1500'); + await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); + await page.waitForSpinnerLoad(); + await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500'); + const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); @@ -32,9 +32,9 @@ describe('Travel extra community path', () => { await page.accessToSection('travel.index'); await page.accessToSection('travel.extraCommunity'); await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter); - - const reference = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelReference, 'value'); - const lockedKg = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'value'); + await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); + const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText'); + const lockedKg = await page.getProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'innerText'); expect(reference).toContain('edited reference'); expect(lockedKg).toContain(1500); From d06492d367a0b4b6e586585e96ead1e714cd7f4d Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 11 Oct 2022 14:28:14 +0200 Subject: [PATCH 2/6] Transaction error --- back/methods/dms/deleteTrashFiles.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js index e8b342ccc..5e3114333 100644 --- a/back/methods/dms/deleteTrashFiles.js +++ b/back/methods/dms/deleteTrashFiles.js @@ -17,7 +17,6 @@ module.exports = Self => { }); Self.deleteTrashFiles = async options => { - const tx = await Self.beginTransaction({}); const myOptions = {}; if (typeof options == 'object') @@ -27,6 +26,7 @@ module.exports = Self => { myOptions.transaction = tx; try { + const tx = await Self.beginTransaction({}); if (process.env.NODE_ENV == 'test') throw new UserError(`Action not allowed on the test environment`); @@ -61,10 +61,9 @@ module.exports = Self => { const dstFolder = path.join(dmsContainer.client.root, pathHash); try { await fs.rmdir(dstFolder); - await dms.destroy(myOptions); - } catch (err) { - await dms.destroy(myOptions); - } + } catch (err) {} + + await dms.destroy(myOptions); } if (tx) await tx.commit(); } catch (e) { From b2e98c9d73067a9be99d35c550f5c54a03030a7e Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 11 Oct 2022 14:39:57 +0200 Subject: [PATCH 3/6] Transaction --- back/methods/dms/deleteTrashFiles.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js index 5e3114333..6f9a2a211 100644 --- a/back/methods/dms/deleteTrashFiles.js +++ b/back/methods/dms/deleteTrashFiles.js @@ -17,16 +17,18 @@ module.exports = Self => { }); Self.deleteTrashFiles = async options => { + let tx; const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); myOptions.transaction = tx; + } try { - const tx = await Self.beginTransaction({}); if (process.env.NODE_ENV == 'test') throw new UserError(`Action not allowed on the test environment`); From 74383b61e738405ada1fd7f6348f9d230ab213fb Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 13 Oct 2022 09:22:53 +0200 Subject: [PATCH 4/6] hotFix(monitor): use left join in ticketState --- modules/item/front/diary/index.spec.js | 3 ++- modules/monitor/back/methods/sales-monitor/salesFilter.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 78dae0883..a80fbfc69 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -19,7 +19,8 @@ describe('Item', () => { describe('set item()', () => { it('should set warehouseFk property based on itemType warehouseFk', () => { jest.spyOn(controller.$, '$applyAsync'); - controller.item = {id: 1, itemType: {warehouseFk: 1}}; + controller.vnConfig = {warehouseFk: 1}; + controller.item = {id: 1}; expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); $scope.$apply(); diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index ff642b088..7be130dda 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -211,7 +211,7 @@ module.exports = Self => { LEFT JOIN province p ON p.id = a.provinceFk LEFT JOIN warehouse w ON w.id = t.warehouseFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk - STRAIGHT_JOIN ticketState ts ON ts.ticketFk = t.id + LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk From 67097970edc46fc592194a74d39c5d566535ed3a Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 13 Oct 2022 10:44:20 +0200 Subject: [PATCH 5/6] Incoterms required param --- modules/ticket/back/methods/ticket/closure.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 3cbc85f96..23d7130ee 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -101,6 +101,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) { if (firstOrder == 1) { const args = { id: ticket.clientFk, + companyId: ticket.companyFk, recipientId: ticket.clientFk, recipient: ticket.recipient, replyTo: ticket.salesPersonEmail From 390ee60e59c308adda030523df42b2ff2a1b57b8 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 14 Oct 2022 07:26:34 +0200 Subject: [PATCH 6/6] Get first element in array --- modules/ticket/back/methods/ticket/closure.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js index 23d7130ee..d5fa58e7b 100644 --- a/modules/ticket/back/methods/ticket/closure.js +++ b/modules/ticket/back/methods/ticket/closure.js @@ -110,7 +110,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) { const email = new Email('incoterms-authorization', args); await email.send(); - const sample = await Self.rawSql( + const [sample] = await Self.rawSql( `SELECT id FROM sample WHERE code = 'incoterms-authorization'