This commit is contained in:
parent
736d0375f6
commit
117849f093
|
@ -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);
|
|
@ -73,6 +73,18 @@ module.exports = Self => {
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Self.validateAsync('nif', areFirstTwoCharsLetters, nifInvalid, {
|
||||||
|
message: 'The first two values are letters.'});
|
||||||
|
|
||||||
|
function areFirstTwoCharsLetters(str) {
|
||||||
|
return /^[a-zA-Z]{2}/.test(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function nifInvalid(err, areFirstTwoCharsLetters) {
|
||||||
|
if (this.isVies == 1 && areFirstTwoCharsLetters(this.nif))
|
||||||
|
err();
|
||||||
|
}
|
||||||
|
|
||||||
function isAlpha(value) {
|
function isAlpha(value) {
|
||||||
const regexp = new RegExp(/^[ñça-zA-Z0-9\s]*$/i);
|
const regexp = new RegExp(/^[ñça-zA-Z0-9\s]*$/i);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@
|
||||||
label="Tax number"
|
label="Tax number"
|
||||||
ng-model="$ctrl.supplier.nif"
|
ng-model="$ctrl.supplier.nif"
|
||||||
required="true"
|
required="true"
|
||||||
rule>
|
rule
|
||||||
|
>
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
@ -188,7 +189,9 @@
|
||||||
<vn-check
|
<vn-check
|
||||||
class="vn-ml-lg"
|
class="vn-ml-lg"
|
||||||
label="Vies"
|
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-check>
|
||||||
</vn-two>
|
</vn-two>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -4,3 +4,5 @@ Sage withholding: Retención Sage
|
||||||
Supplier activity: Actividad proveedor
|
Supplier activity: Actividad proveedor
|
||||||
Healt register: Pasaporte sanitario
|
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
|
Loading…
Reference in New Issue