3795-client_administraive #938
|
@ -111,7 +111,7 @@ describe('Client lock verified data path', () => {
|
|||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
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() => {
|
||||
const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox);
|
||||
|
||||
expect(isDisabled).toBeTruthy();
|
||||
expect(isDisabled).toBeTrue();
|
||||
});
|
||||
|
||||
it('should return error when edit the social name', async() => {
|
||||
|
@ -135,7 +135,7 @@ describe('Client lock verified data path', () => {
|
|||
await page.waitToClick(selectors.clientFiscalData.saveButton);
|
||||
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() => {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
"That payment method requires an IBAN": "That payment method requires an IBAN",
|
||||
"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",
|
||||
"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",
|
||||
"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",
|
||||
|
@ -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 worker has hours recorded that day": "The worker has hours recorded that day",
|
||||
"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"
|
||||
}
|
|
@ -50,7 +50,7 @@
|
|||
"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",
|
||||
"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",
|
||||
"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",
|
||||
|
|
|
@ -39,7 +39,7 @@ describe('Client updateFiscalData', () => {
|
|||
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() => {
|
||||
|
|
|
@ -129,7 +129,7 @@ module.exports = Self => {
|
|||
const client = await models.Client.findById(clientId, null, myOptions);
|
||||
|
||||
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`);
|
||||
|
||||
// Sage data validation
|
||||
const taxDataChecked = args.isTaxDataChecked;
|
||||
|
|
|
@ -245,10 +245,10 @@ module.exports = Self => {
|
|||
const sageTransactionType = hasChanges && (changes.sageTransactionTypeFk || orgData.sageTransactionTypeFk);
|
||||
const sageTransactionTypeChanged = hasChanges && orgData.sageTransactionTypeFk != sageTransactionType;
|
||||
|
||||
if (isTaxDataCheckedChanged && !isAdministrative)
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
const cantEditVerifiedData = isTaxDataCheckedChanged && !isAdministrative;
|
||||
const cantChangeSageData = (sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant;
|
||||
|
||||
if ((sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant)
|
||||
if (cantEditVerifiedData || cantChangeSageData)
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue