Subversion-Projekte lars-tiefland.zeldi.de_alt

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
/*
2
 * Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies
3
 */
4
$.validator.addMethod( "nipPL", function( value ) {
5
	"use strict";
6
 
7
	value = value.replace( /[^0-9]/g, "" );
8
 
9
	if ( value.length !== 10 ) {
10
		return false;
11
	}
12
 
13
	var arrSteps = [ 6, 5, 7, 2, 3, 4, 5, 6, 7 ];
14
	var intSum = 0;
15
	for ( var i = 0; i < 9; i++ ) {
16
		intSum += arrSteps[ i ] * value[ i ];
17
	}
18
	var int2 = intSum % 11;
19
	var intControlNr = ( int2 === 10 ) ? 0 : int2;
20
 
21
	return ( intControlNr === parseInt( value[ 9 ], 10 ) );
22
}, "Please specify a valid NIP number." );