initial commit
This commit is contained in:
22
public/bower_components/jquery-validation/src/additional/nipPL.js
vendored
Normal file
22
public/bower_components/jquery-validation/src/additional/nipPL.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies
|
||||
*/
|
||||
$.validator.addMethod( "nipPL", function( value ) {
|
||||
"use strict";
|
||||
|
||||
value = value.replace( /[^0-9]/g, "" );
|
||||
|
||||
if ( value.length !== 10 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var arrSteps = [ 6, 5, 7, 2, 3, 4, 5, 6, 7 ];
|
||||
var intSum = 0;
|
||||
for ( var i = 0; i < 9; i++ ) {
|
||||
intSum += arrSteps[ i ] * value[ i ];
|
||||
}
|
||||
var int2 = intSum % 11;
|
||||
var intControlNr = ( int2 === 10 ) ? 0 : int2;
|
||||
|
||||
return ( intControlNr === parseInt( value[ 9 ], 10 ) );
|
||||
}, "Please specify a valid NIP number." );
|
||||
Reference in New Issue
Block a user