From ff264ab93049945273336a83871ec601c7497c71 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 27 May 2022 09:45:08 +0200 Subject: [PATCH 1/5] hotFix(client): fiscal-data edit by salesAssistant --- e2e/paths/02-client/12_lock_of_verified_data.spec.js | 6 +++--- modules/client/back/methods/client/updateFiscalData.js | 4 ++-- modules/client/back/models/client.js | 3 +-- modules/client/front/fiscal-data/index.html | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index af42e2a4b..37e95d798 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -126,16 +126,16 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is disabled for salesAssistant', async() => { const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); - expect(isDisabled).toBeTrue(); + expect(isDisabled).toBeFalsy(); }); - it('should return error when edit the social name', async() => { + it('should now edit the social name', async() => { await page.clearInput(selectors.clientFiscalData.socialName); await page.write(selectors.clientFiscalData.socialName, 'new social name edition'); await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.text).toContain(`Not enough privileges to edit a client with verified data`); + expect(message.text).toContain(`Data saved!`); }); it('should now confirm the social name have been edited once and for all', async() => { diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index c2de8f927..7ae842c6e 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -125,10 +125,10 @@ module.exports = Self => { } try { - const isAdministrative = await models.Account.hasRole(userId, 'administrative', myOptions); + const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', myOptions); const client = await models.Client.findById(clientId, null, myOptions); - if (!isAdministrative && client.isTaxDataChecked) + if (!isSalesAssistant && client.isTaxDataChecked) throw new UserError(`Not enough privileges to edit a client with verified data`); // Sage data validation diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 5ed777ab5..fb41fb973 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -232,7 +232,6 @@ module.exports = Self => { const loopBackContext = LoopBackContext.getCurrentContext(); const userId = loopBackContext.active.accessToken.userId; - const isAdministrative = await models.Account.hasRole(userId, 'administrative', ctx.options); const isSalesAssistant = await models.Account.hasRole(userId, 'salesAssistant', ctx.options); const hasChanges = orgData && changes; @@ -245,7 +244,7 @@ module.exports = Self => { const sageTransactionType = hasChanges && (changes.sageTransactionTypeFk || orgData.sageTransactionTypeFk); const sageTransactionTypeChanged = hasChanges && orgData.sageTransactionTypeFk != sageTransactionType; - const cantEditVerifiedData = isTaxDataCheckedChanged && !isAdministrative; + const cantEditVerifiedData = isTaxDataCheckedChanged && !isSalesAssistant; const cantChangeSageData = (sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant; if (cantEditVerifiedData || cantChangeSageData) diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index 2249127c5..1f3533327 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -182,7 +182,7 @@ vn-one label="Verified data" ng-model="$ctrl.client.isTaxDataChecked" - vn-acl="administrative"> + vn-acl="salesAssistant"> From 2b10abbe24f7298f9ed2229ef7691967e5c014b5 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 27 May 2022 10:08:40 +0200 Subject: [PATCH 2/5] typo --- e2e/paths/02-client/12_lock_of_verified_data.spec.js | 2 +- modules/zone/front/basic-data/index.html | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index 37e95d798..139af0cea 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -123,7 +123,7 @@ describe('Client lock verified data path', () => { await page.accessToSection('client.card.fiscalData'); }, 20000); - it('should confirm verified data button is disabled for salesAssistant', async() => { + it('should confirm verified data button is enabled for salesAssistant', async() => { const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(isDisabled).toBeFalsy(); diff --git a/modules/zone/front/basic-data/index.html b/modules/zone/front/basic-data/index.html index eb701a803..1836216a2 100644 --- a/modules/zone/front/basic-data/index.html +++ b/modules/zone/front/basic-data/index.html @@ -67,7 +67,6 @@ From 7c7c64415db99e81d62be0f9db384d50a7a7b6ad Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 31 May 2022 12:00:15 +0200 Subject: [PATCH 3/5] fix(monitor_ticket): add isTooLittle problem --- modules/monitor/back/methods/sales-monitor/salesFilter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index 4521b2351..9b6030e9f 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -304,7 +304,8 @@ module.exports = Self => { {'tp.hasTicketRequest': true}, {'tp.hasComponentLack': true}, {'tp.isTaxDataChecked': false}, - {'tp.itemShortage': {neq: null}} + {'tp.itemShortage': {neq: null}}, + {'tp.isTooLittle': true} ]}; } else if (hasProblems === false) { whereProblems = {and: [ @@ -313,7 +314,8 @@ module.exports = Self => { {'tp.hasTicketRequest': false}, {'tp.hasComponentLack': false}, {'tp.isTaxDataChecked': true}, - {'tp.itemShortage': null} + {'tp.itemShortage': null}, + {'tp.isTooLittle': false} ]}; } From 4ac26895ba16d13b32c28077353a605b9ca9db69 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 1 Jun 2022 09:36:47 +0200 Subject: [PATCH 4/5] fix(regularizeClaim): refound with negative quantity Refs: #4148 --- modules/claim/back/methods/claim/regularizeClaim.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 29c7320f5..01edc17d9 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -86,12 +86,11 @@ module.exports = Self => { }; ticketFk = await createTicket(ctx, myOptions); } - await models.Sale.create({ ticketFk: ticketFk, itemFk: sale.itemFk, concept: sale.concept, - quantity: -sale.quantity, + quantity: sale.quantity, price: sale.price, discount: 100 }, myOptions); From fab470561856e6b347f244f605c1044ba431730a Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 1 Jun 2022 14:01:19 +0200 Subject: [PATCH 5/5] Rollback --- modules/claim/back/methods/claim/regularizeClaim.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/claim/back/methods/claim/regularizeClaim.js b/modules/claim/back/methods/claim/regularizeClaim.js index 01edc17d9..ab8ea58a4 100644 --- a/modules/claim/back/methods/claim/regularizeClaim.js +++ b/modules/claim/back/methods/claim/regularizeClaim.js @@ -90,7 +90,7 @@ module.exports = Self => { ticketFk: ticketFk, itemFk: sale.itemFk, concept: sale.concept, - quantity: sale.quantity, + quantity: -sale.quantity, price: sale.price, discount: 100 }, myOptions);