Merge pull request '5540-validarSupplierIsVies' (!1438) from 5540-validarSupplierIsVies into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1438 Reviewed-by: Alex Moreno <alexm@verdnatura.es> Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
754c5488bf
|
@ -0,0 +1,5 @@
|
|||
UPDATE vn.supplier s
|
||||
JOIN vn.country c ON c.id = s.countryFk
|
||||
SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1)
|
||||
WHERE s.isVies = TRUE
|
||||
AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2);
|
|
@ -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);
|
|
@ -279,15 +279,16 @@
|
|||
"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",
|
||||
"company": "Compañía",
|
||||
"country": "País",
|
||||
"clientId": "Id cliente",
|
||||
"clientSocialName": "Cliente",
|
||||
"amount": "Importe",
|
||||
"taxableBase": "Base",
|
||||
"ticketFk": "Id ticket",
|
||||
"isActive": "Activo",
|
||||
"hasToInvoice": "Facturar",
|
||||
"isTaxDataChecked": "Datos comprobados",
|
||||
"comercialId": "Id comercial",
|
||||
"comercialName": "Comercial"
|
||||
}
|
||||
"country": "País",
|
||||
"clientId": "Id cliente",
|
||||
"clientSocialName": "Cliente",
|
||||
"amount": "Importe",
|
||||
"taxableBase": "Base",
|
||||
"ticketFk": "Id ticket",
|
||||
"isActive": "Activo",
|
||||
"hasToInvoice": "Facturar",
|
||||
"isTaxDataChecked": "Datos comprobados",
|
||||
"comercialId": "Id comercial",
|
||||
"comercialName": "Comercial",
|
||||
"Invalid NIF for VIES": "Invalid NIF for VIES"
|
||||
}
|
|
@ -14,7 +14,7 @@ module.exports = Self => {
|
|||
Self.validatesPresenceOf('street', {
|
||||
message: 'Street cannot be empty'
|
||||
});
|
||||
|
||||
|
||||
Self.validatesPresenceOf('city', {
|
||||
message: 'City cannot be empty'
|
||||
});
|
||||
|
@ -89,8 +89,9 @@ module.exports = Self => {
|
|||
};
|
||||
const country = await Self.app.models.Country.findOne(filter);
|
||||
const code = country ? country.code.toLowerCase() : null;
|
||||
const countryCode = this.fi.toLowerCase().substring(0, 2);
|
||||
|
||||
if (!this.fi || !validateTin(this.fi, code))
|
||||
if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code))
|
||||
err();
|
||||
done();
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
|
@ -19,13 +19,14 @@ describe('Supplier newSupplier()', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should create a new supplier containing only the name', async() => {
|
||||
it('should create a new supplier containing only the name and the nif', async() => {
|
||||
const tx = await models.Supplier.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
ctx.args = {
|
||||
name: 'newSupplier'
|
||||
name: 'newSupplier',
|
||||
nif: '12345678Z'
|
||||
};
|
||||
|
||||
const result = await models.Supplier.newSupplier(ctx, options);
|
||||
|
|
|
@ -67,8 +67,9 @@ module.exports = Self => {
|
|||
};
|
||||
const country = await Self.app.models.Country.findOne(filter);
|
||||
const code = country ? country.code.toLowerCase() : null;
|
||||
const countryCode = this.nif.toLowerCase().substring(0, 2);
|
||||
|
||||
if (!this.nif || !validateTin(this.nif, code))
|
||||
if (!this.nif || !validateTin(this.nif, code) || (this.isVies && countryCode == code))
|
||||
err();
|
||||
done();
|
||||
}
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
name="taxNumber"
|
||||
ng-model="$ctrl.supplier.nif"
|
||||
required="true"
|
||||
rule>
|
||||
rule
|
||||
>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
|
@ -210,7 +211,9 @@
|
|||
<vn-check
|
||||
class="vn-ml-lg"
|
||||
label="Vies"
|
||||
ng-model="$ctrl.supplier.isVies">
|
||||
info="When activating it, do not enter the country code in the ID field."
|
||||
ng-model="$ctrl.supplier.isVies"
|
||||
>
|
||||
</vn-check>
|
||||
</vn-two>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -3,4 +3,6 @@ Sage transaction type: Tipo de transacción Sage
|
|||
Sage withholding: Retención Sage
|
||||
Supplier activity: Actividad proveedor
|
||||
Healt register: Pasaporte sanitario
|
||||
Trucker: Transportista
|
||||
Trucker: Transportista
|
||||
When activating it, do not enter the country code in the ID field.: Al activarlo, no informar el código del país en el campo nif
|
||||
The first two values are letters.: Los dos primeros valores son letras
|
|
@ -1 +1,2 @@
|
|||
Accounts: Cuentas
|
||||
Accounts: Cuentas
|
||||
Invalid NIF for VIES: NIF no valido por VIES
|
|
@ -196,7 +196,7 @@ module.exports = Self => {
|
|||
|
||||
client = await models.Client.findById(
|
||||
user.id,
|
||||
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']},
|
||||
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'fi']},
|
||||
myOptions
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue