3795-client_administraive #938

Merged
joan merged 9 commits from 3795-client_administraive into dev 2022-05-10 08:26:42 +00:00
6 changed files with 11 additions and 11 deletions
Showing only changes of commit 5bad0592a5 - Show all commits

View File

@ -111,7 +111,7 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain(`You can't make changes on a client with verified data`); expect(message.text).toContain(`Not enough privileges to edit a client with verified data`);
}); });
}); });
@ -126,7 +126,7 @@ describe('Client lock verified data path', () => {
it('should confirm verified data button is disabled for salesAssistant', async() => { it('should confirm verified data button is disabled for salesAssistant', async() => {
alexm marked this conversation as resolved Outdated

button doens't seem to be enabled.

button doens't seem to be enabled.
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
expect(isDisabled).toBeTruthy(); expect(isDisabled).toBeTrue();
alexm marked this conversation as resolved Outdated

when evaluating booleans use boolean matchers ie: toBeTrue or toEqual(true)

any defined variable would pass as truthy, therefore may be a false negative.

when evaluating booleans use boolean matchers ie: toBeTrue or toEqual(true) any defined variable would pass as truthy, therefore may be a false negative.
}); });
it('should return error when edit the social name', async() => { it('should return error when edit the social name', async() => {
alexm marked this conversation as resolved Outdated

doesn't seem to be changing data

doesn't seem to be changing data
@ -135,7 +135,7 @@ describe('Client lock verified data path', () => {
await page.waitToClick(selectors.clientFiscalData.saveButton); await page.waitToClick(selectors.clientFiscalData.saveButton);
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain(`You can't make changes on a client with verified data`); expect(message.text).toContain(`Not enough privileges to edit a client with verified data`);
}); });
it('should now confirm the social name have been edited once and for all', async() => { it('should now confirm the social name have been edited once and for all', async() => {

View File

@ -12,7 +12,6 @@
"That payment method requires an IBAN": "That payment method requires an IBAN", "That payment method requires an IBAN": "That payment method requires an IBAN",
"That payment method requires a BIC": "That payment method requires a BIC", "That payment method requires a BIC": "That payment method requires a BIC",
"The default consignee can not be unchecked": "The default consignee can not be unchecked", "The default consignee can not be unchecked": "The default consignee can not be unchecked",
"You can't make changes on a client with verified data": "You can't make changes on a client with verified data",
"Enter an integer different to zero": "Enter an integer different to zero", "Enter an integer different to zero": "Enter an integer different to zero",
"Package cannot be blank": "Package cannot be blank", "Package cannot be blank": "Package cannot be blank",
"The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one", "The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one",
@ -123,5 +122,6 @@
"The type of business must be filled in basic data": "The type of business must be filled in basic data", "The type of business must be filled in basic data": "The type of business must be filled in basic data",
"The worker has hours recorded that day": "The worker has hours recorded that day", "The worker has hours recorded that day": "The worker has hours recorded that day",
"isWithoutNegatives": "isWithoutNegatives", "isWithoutNegatives": "isWithoutNegatives",
"routeFk": "routeFk" "routeFk": "routeFk",
"Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data"
} }

View File

@ -50,7 +50,7 @@
"You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
"Warehouse cannot be blank": "El almacén no puede quedar en blanco", "Warehouse cannot be blank": "El almacén no puede quedar en blanco",
"Agency cannot be blank": "La agencia no puede quedar en blanco", "Agency cannot be blank": "La agencia no puede quedar en blanco",
"You can't make changes on a client with verified data": "No puedes hacer cambios en un cliente con datos comprobados", "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
"This address doesn't exist": "Este consignatario no existe", "This address doesn't exist": "Este consignatario no existe",
"You must delete the claim id %d first": "Antes debes borrar la reclamación %d", "You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
"You don't have enough privileges": "No tienes suficientes permisos", "You don't have enough privileges": "No tienes suficientes permisos",

View File

@ -39,7 +39,7 @@ describe('Client updateFiscalData', () => {
error = e; error = e;
} }
expect(error.message).toEqual(`You can't make changes on a client with verified data`); expect(error.message).toEqual(`Not enough privileges to edit a client with verified data`);
}); });
it('should return an error if the salesAssistant did not fill the sage data before checking verified data', async() => { it('should return an error if the salesAssistant did not fill the sage data before checking verified data', async() => {

View File

@ -129,7 +129,7 @@ module.exports = Self => {
const client = await models.Client.findById(clientId, null, myOptions); const client = await models.Client.findById(clientId, null, myOptions);
if (!isAdministrative && client.isTaxDataChecked) if (!isAdministrative && client.isTaxDataChecked)
throw new UserError(`You can't make changes on a client with verified data`); throw new UserError(`Not enough privileges to edit a client with verified data`);
alexm marked this conversation as resolved Outdated

the error shown here doesn't mention the lack of privileges, we believe the following error would be better:

throw new UserError(Not enough privileges to edit a client with verified data);

don't forget to add translation to it please.

the error shown here doesn't mention the lack of privileges, we believe the following error would be better: `throw new UserError(`Not enough privileges to edit a client with verified data`);` don't forget to add translation to it please.
// Sage data validation // Sage data validation
const taxDataChecked = args.isTaxDataChecked; const taxDataChecked = args.isTaxDataChecked;

View File

@ -245,10 +245,10 @@ module.exports = Self => {
const sageTransactionType = hasChanges && (changes.sageTransactionTypeFk || orgData.sageTransactionTypeFk); const sageTransactionType = hasChanges && (changes.sageTransactionTypeFk || orgData.sageTransactionTypeFk);
const sageTransactionTypeChanged = hasChanges && orgData.sageTransactionTypeFk != sageTransactionType; const sageTransactionTypeChanged = hasChanges && orgData.sageTransactionTypeFk != sageTransactionType;
if (isTaxDataCheckedChanged && !isAdministrative) const cantEditVerifiedData = isTaxDataCheckedChanged && !isAdministrative;
throw new UserError(`You don't have enough privileges`); const cantChangeSageData = (sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant;
if ((sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant) if (cantEditVerifiedData || cantChangeSageData)
throw new UserError(`You don't have enough privileges`); throw new UserError(`You don't have enough privileges`);
}); });