DEP: #7004 - HOTFIX Create new Supplier #2148
|
@ -32,6 +32,7 @@ describe('Supplier fiscal data path', () => {
|
|||
};
|
||||
|
||||
const errorMessage = await page.sendForm(form, {
|
||||
city: 'Valencia',
|
||||
taxNumber: 'Wrong tax number'
|
||||
});
|
||||
const message = await page.sendForm(form, values);
|
||||
|
|
|
@ -209,5 +209,6 @@
|
|||
"You cannot update these fields": "You cannot update these fields",
|
||||
"CountryFK cannot be empty": "Country cannot be empty",
|
||||
"You are not allowed to modify the alias": "You are not allowed to modify the alias",
|
||||
"You already have the mailAlias": "You already have the mailAlias"
|
||||
"You already have the mailAlias": "You already have the mailAlias",
|
||||
"The city cannot be empty": "The city cannot be empty"
|
||||
}
|
|
@ -170,6 +170,7 @@
|
|||
"companyFk": "Empresa",
|
||||
"The social name cannot be empty": "La razón social no puede quedar en blanco",
|
||||
"The nif cannot be empty": "El NIF no puede quedar en blanco",
|
||||
"The city cannot be empty": "La ciudad no puede estar vacía",
|
||||
"You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
|
||||
"ASSIGN_ZONE_FIRST": "Asigna una zona primero",
|
||||
"Amount cannot be zero": "El importe no puede ser cero",
|
||||
|
|
|
@ -25,9 +25,7 @@ describe('Supplier newSupplier()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
ctx.args = {
|
||||
name: 'NEWSUPPLIER',
|
||||
nif: '12345678Z',
|
||||
city: 'Gotham'
|
||||
name: 'NEWSUPPLIER'
|
||||
};
|
||||
|
||||
const result = await models.Supplier.newSupplier(ctx, options);
|
||||
|
|
|
@ -61,7 +61,7 @@ describe('Supplier updateFiscalData()', () => {
|
|||
sageTransactionTypeFk,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
city,
|
||||
provinceFk,
|
||||
countryFk,
|
||||
supplierActivityFk,
|
||||
|
@ -78,7 +78,7 @@ describe('Supplier updateFiscalData()', () => {
|
|||
const supplier = await models.Supplier.updateFiscalData(ctx,
|
||||
supplierId,
|
||||
undefined,
|
||||
undefined,
|
||||
nif,
|
||||
account,
|
||||
phone,
|
||||
undefined,
|
||||
|
@ -96,9 +96,9 @@ describe('Supplier updateFiscalData()', () => {
|
|||
options);
|
||||
|
||||
expect(supplier.account).toEqual(account);
|
||||
expect(supplier.nif).toEqual(nif);
|
||||
expect(supplier.phone).toEqual(phone);
|
||||
expect(supplier.postCode).toEqual(postCode);
|
||||
expect(supplier.account).toEqual(account);
|
||||
expect(supplier.city).toEqual(city);
|
||||
expect(supplier.provinceFk).toEqual(provinceFk);
|
||||
});
|
||||
|
|
|
@ -13,7 +13,7 @@ module.exports = Self => {
|
|||
type: 'string'
|
||||
}, {
|
||||
arg: 'nif',
|
||||
type: 'string'
|
||||
type: 'any'
|
||||
}, {
|
||||
arg: 'account',
|
||||
type: 'any'
|
||||
|
@ -37,7 +37,7 @@ module.exports = Self => {
|
|||
type: 'any'
|
||||
}, {
|
||||
arg: 'city',
|
||||
type: 'string'
|
||||
type: 'any'
|
||||
}, {
|
||||
arg: 'provinceFk',
|
||||
type: 'any'
|
||||
|
@ -87,6 +87,14 @@ module.exports = Self => {
|
|||
}
|
||||
}
|
||||
|
||||
if (city === null || (city === undefined && !supplier.city)) {
|
||||
throw new UserError('The city cannot be empty'
|
||||
);
|
||||
}
|
||||
if (nif === null || (nif === undefined && !supplier.nif)) {
|
||||
throw new UserError('The nif cannot be empty'
|
||||
);
|
||||
}
|
||||
return supplier.updateAttributes({
|
||||
name,
|
||||
nif,
|
||||
|
|
|
@ -16,15 +16,6 @@ module.exports = Self => {
|
|||
Self.validatesPresenceOf('name', {
|
||||
message: 'The social name cannot be empty'
|
||||
});
|
||||
|
||||
Self.validatesPresenceOf('city', {
|
||||
message: 'City cannot be empty'
|
||||
});
|
||||
|
||||
Self.validatesPresenceOf('nif', {
|
||||
message: 'The nif cannot be empty'
|
||||
});
|
||||
|
||||
Self.validatesUniquenessOf('nif', {
|
||||
message: 'TIN must be unique'
|
||||
});
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
label="Tax number"
|
||||
vn-name="taxNumber"
|
||||
ng-model="$ctrl.supplier.nif"
|
||||
required="true"
|
||||
rule>
|
||||
|
||||
>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -168,8 +168,7 @@
|
|||
fields="['id', 'name', 'provinceFk']"
|
||||
show-field="name"
|
||||
value-field="name"
|
||||
required="true"
|
||||
rule>
|
||||
>
|
||||
<tpl-item>
|
||||
{{name}}, {{province.name}}
|
||||
({{province.country.country}})
|
||||
|
|
Loading…
Reference in New Issue