refs #5540 client vies

This commit is contained in:
Carlos Satorres 2023-04-21 09:14:30 +02:00
parent d6e6dab03b
commit d8b5659a5d
6 changed files with 31 additions and 5 deletions

View File

@ -0,0 +1,5 @@
UPDATE IGNORE vn.client c
JOIN vn.country co ON co.id = c.countryFk
SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1)
WHERE c.isVies = TRUE
AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2);

View File

@ -273,7 +273,8 @@
"Not exist this branch": "La rama no existe",
"This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
"Insert a date range": "Inserte un rango de fechas",
"Added observation": "{{user}} añadió esta observacion: {{text}}",
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen"
}
"Added observation": "{{user}} añadió esta observacion: {{text}}",
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
"The first two values are letters": "The first two values are letters"
}

View File

@ -23,6 +23,22 @@ module.exports = Self => {
message: 'TIN must be unique'
});
Self.validateAsync('fi', fiInvalid, {
message: 'The first two values are letters'});
async function fiInvalid(err, done) {
const filter = {
fields: ['code'],
where: {id: this.countryFk}
};
const countryCode = this.fi.toUpperCase().substring(0, 2);
const country = await Self.app.models.Country.findOne(filter);
const code = country ? country.code : null;
if (this.isVies && countryCode == code)
err();
done();
}
Self.validatesFormatOf('email', {
message: 'Invalid email',
allowNull: true,

View File

@ -72,7 +72,9 @@
<vn-horizontal>
<vn-check vn-one label="Has to invoice" ng-model="$ctrl.client.hasToInvoice">
</vn-check>
<vn-check vn-one label="Vies" ng-model="$ctrl.client.isVies">
<vn-check vn-one label="Vies"
info="When activating it, do not enter the country code in the ID field."
ng-model="$ctrl.client.isVies">
</vn-check>
</vn-horizontal>
<vn-horizontal>

View File

@ -12,3 +12,5 @@ Previous client: Cliente anterior
In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente
Incoterms authorization: Autorización incoterms
Electronic invoice: Factura electrónica
When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF
The first two values are letters: Los dos primeros valores son letras