Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev There was a failure building this commit
Details
gitea/salix/dev There was a failure building this commit
Details
This commit is contained in:
commit
a48b3b31b7
|
@ -75,7 +75,6 @@ describe('Order edit basic data path', () => {
|
|||
|
||||
it('should navigate to the basic data section of the new order', async() => {
|
||||
const url = await nightmare
|
||||
.wait(1999)
|
||||
.accessToSection('order.card.basicData')
|
||||
.wait(selectors.orderBasicData.observationInput)
|
||||
.parsedUrl();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('Client Create', () => {
|
||||
fdescribe('Client Create', () => {
|
||||
const clientName = 'Wade';
|
||||
const AccountName = 'Deadpool';
|
||||
|
||||
|
@ -39,8 +39,6 @@ describe('Client Create', () => {
|
|||
|
||||
expect(account.name).toEqual(newAccount.userName);
|
||||
|
||||
client = await app.models.Client.findOne({where: {name: newAccount.name}});
|
||||
|
||||
expect(client.id).toEqual(account.id);
|
||||
expect(client.name).toEqual(newAccount.name);
|
||||
expect(client.email).toEqual(newAccount.email);
|
||||
|
|
|
@ -152,16 +152,6 @@ module.exports = Self => {
|
|||
done();
|
||||
}
|
||||
|
||||
Self.validateBinded('socialName', isAlpha, {
|
||||
message: 'The socialName has an invalid format'
|
||||
});
|
||||
|
||||
function isAlpha(value) {
|
||||
const regexp = new RegExp(/^[a-zA-Z\s]*$/);
|
||||
|
||||
return regexp.test(value);
|
||||
}
|
||||
|
||||
Self.validateAsync('postCode', hasValidPostcode, {
|
||||
message: `The postcode doesn't exists. Ensure you put the correct format`
|
||||
});
|
||||
|
@ -177,12 +167,26 @@ module.exports = Self => {
|
|||
done();
|
||||
}
|
||||
|
||||
function isAlpha(value) {
|
||||
const regexp = new RegExp(/^[ñça-zA-Z\s]*$/);
|
||||
|
||||
return regexp.test(value);
|
||||
}
|
||||
|
||||
Self.observe('before save', async function(ctx) {
|
||||
let changes = ctx.data || ctx.instance;
|
||||
let orgData = ctx.currentInstance;
|
||||
let finalState = getFinalState(ctx);
|
||||
let payMethodWithIban = 4;
|
||||
|
||||
// Validate socialName format
|
||||
const socialNameChanged = orgData && changes
|
||||
&& orgData.socialName != changes.socialName;
|
||||
|
||||
if (socialNameChanged && !isAlpha(changes.socialName))
|
||||
throw new UserError('The socialName has an invalid format');
|
||||
|
||||
|
||||
if (changes.salesPerson === null) {
|
||||
changes.credit = 0;
|
||||
changes.discount = 0;
|
||||
|
|
Loading…
Reference in New Issue