4108-mdb_backend #987

Merged
juan merged 9 commits from 4108-mdb_backend into dev 2022-06-02 07:33:24 +00:00
6 changed files with 12 additions and 12 deletions
Showing only changes of commit ea0a43d0fb - Show all commits

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

@ -86,7 +86,6 @@ module.exports = Self => {
};
ticketFk = await createTicket(ctx, myOptions);
}
await models.Sale.create({
ticketFk: ticketFk,
itemFk: sale.itemFk,

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

@ -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}
]};
}