4128-hotFix(client): fiscal-data edit by salesAssistant #986

Merged
joan merged 2 commits from 4128-client_fiscalData into master 2022-05-27 08:14:01 +00:00
5 changed files with 8 additions and 10 deletions

View File

@ -123,19 +123,19 @@ 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).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() => {

View File

@ -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

View File

@ -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)

View File

@ -182,7 +182,7 @@
vn-one
label="Verified data"
ng-model="$ctrl.client.isTaxDataChecked"
vn-acl="administrative">
vn-acl="salesAssistant">
</vn-check>
</vn-horizontal>
</vn-card>

View File

@ -67,7 +67,6 @@
<vn-input-number
label="Bonus"
ng-model="$ctrl.zone.bonus"
min="0"
step="0.01"
vn-acl="deliveryBoss"
rule>