![]() |
Documentación GVHIDRA 3.1.5
|
Métodos públicos | |
__construct ($required=false, $maxLength=null) | |
setNIF ($value) | |
setCIF ($value) | |
setNIE ($value) | |
validate ($value) | |
__construct ($required=false, $maxLength=null) | |
setNIF ($value) | |
setCIF ($value) | |
setNIE ($value) | |
validate ($value) | |
Métodos privados | |
valida_nif_cif_nie ($cif) | |
valida_nif_cif_nie ($cif) | |
Atributos privados | |
$validateNIF = TRUE | |
$validateCIF = FALSE | |
$validateNIE = FALSE |
typeNIF contiene informacin relativa a los campos de tipo fecha
Definición en la línea 44 del archivo typeNIF.php.
__construct | ( | $ | required = false , |
$ | maxLength = null |
||
) |
constructor
Reimplementado de gvHidraTypeBase.
Definición en la línea 53 del archivo typeNIF.php.
{ parent::__construct($required,$maxLength); }//Fin de constructor
__construct | ( | $ | required = false , |
$ | maxLength = null |
||
) |
constructor
Reimplementado de gvHidraTypeBase.
Definición en la línea 52 del archivo typeNIF.php.
{ parent::__construct($required,$maxLength); }//Fin de constructor
setCIF | ( | $ | value | ) |
Definición en la línea 60 del archivo typeNIF.php.
{ $this->validateCIF = $value; }
setCIF | ( | $ | value | ) |
Definición en la línea 61 del archivo typeNIF.php.
{ $this->validateCIF = $value; }
setNIE | ( | $ | value | ) |
Definición en la línea 64 del archivo typeNIF.php.
{ $this->validateNIE = $value; }
setNIE | ( | $ | value | ) |
Definición en la línea 65 del archivo typeNIF.php.
{ $this->validateNIE = $value; }
setNIF | ( | $ | value | ) |
Definición en la línea 56 del archivo typeNIF.php.
{ $this->validateNIF = $value; }
setNIF | ( | $ | value | ) |
Definición en la línea 57 del archivo typeNIF.php.
{ $this->validateNIF = $value; }
valida_nif_cif_nie | ( | $ | cif | ) | [private] |
Definición en la línea 74 del archivo typeNIF.php.
{ //funcin creada por David Vidal Serra, Copyleft 2005 $cif=strtoupper($cif); if(empty($cif)) return 0; //Comprobamos si es incorrecto if (!preg_match('/((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)/',$cif)) {throw new Exception('No tiene el formato adecuado.');} for ($i=0;$i<9;$i++) {$num[$i]=substr($cif,$i,1);} $suma=$num[2]+$num[4]+$num[6]; for ($i=1;$i<8;$i+=2) {$suma+=substr((2*$num[$i]),0,1)+substr((2*$num[$i]),1,1);} $n=10-substr($suma,strlen($suma)-1,1); //Si es un CIF if($this->validateCIF){ if (preg_match('/^[ABCDEFGHNPQS]{1}/',$cif)) { if ($num[8]==chr(64+$n) || $num[8]==substr($n,strlen($n)-1,1)){return 0;} else {throw new Exception('No es un CIF vlido.');}} if (preg_match('/^[KLM]{1}/',$cif)) { if ($num[8]==chr(64+$n)) {return 0;} else {throw new Exception('No es un CIF vlido.');}} } //Si es un NIE if($this->validateNIE){ if (preg_match('/^[TX]{1}/',$cif)) { if ($num[8]==substr('TRWAGMYFPDXBNJZSQVHLCKE',substr(preg_replace('/X/','0',$cif),0,8)%23,1) || preg_match('/^[T]{1}[A-Z0-9]{8}$/',$cif)) {return 0;} else {throw new Exception('No es un NIE vlido.');}} } //Si es un NIF if($this->validateNIF){ if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/',$cif)) { if ($num[8]==substr('TRWAGMYFPDXBNJZSQVHLCKE',substr($cif,0,8)%23,1)) {return 0;} else {throw new Exception('No es un NIF vlido.');}} } throw new Exception('No tiene el formato adecuado.'); }
valida_nif_cif_nie | ( | $ | cif | ) | [private] |
Definición en la línea 75 del archivo typeNIF.php.
{ //funcin creada por David Vidal Serra, Copyleft 2005 $cif=strtoupper($cif); if(empty($cif)) return 0; //Comprobamos si es incorrecto if (!preg_match('/((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)/',$cif)) {throw new Exception('No tiene el formato adecuado.');} for ($i=0;$i<9;$i++) {$num[$i]=substr($cif,$i,1);} $suma=$num[2]+$num[4]+$num[6]; for ($i=1;$i<8;$i+=2) {$suma+=substr((2*$num[$i]),0,1)+substr((2*$num[$i]),1,1);} $n=10-substr($suma,strlen($suma)-1,1); //Si es un CIF if($this->validateCIF){ if (preg_match('/^[ABCDEFGHNPQS]{1}/',$cif)) { if ($num[8]==chr(64+$n) || $num[8]==substr($n,strlen($n)-1,1)){return 0;} else {throw new Exception('No es un CIF vlido.');}} if (preg_match('/^[KLM]{1}/',$cif)) { if ($num[8]==chr(64+$n)) {return 0;} else {throw new Exception('No es un CIF vlido.');}} } //Si es un NIE if($this->validateNIE){ if (preg_match('/^[TX]{1}/',$cif)) { if ($num[8]==substr('TRWAGMYFPDXBNJZSQVHLCKE',substr(preg_replace('/X/','0',$cif),0,8)%23,1) || preg_match('/^[T]{1}[A-Z0-9]{8}$/',$cif)) {return 0;} else {throw new Exception('No es un NIE vlido.');}} } //Si es un NIF if($this->validateNIF){ if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/',$cif)) { if ($num[8]==substr('TRWAGMYFPDXBNJZSQVHLCKE',substr($cif,0,8)%23,1)) {return 0;} else {throw new Exception('No es un NIF vlido.');}} } throw new Exception('No tiene el formato adecuado.'); }
validate | ( | $ | value | ) |
Implementa gvHidraType.
Definición en la línea 69 del archivo typeNIF.php.
{ if(parent::validate($value)==0) $this->valida_nif_cif_nie($value); }
validate | ( | $ | value | ) |
Implementa gvHidraType.
Definición en la línea 70 del archivo typeNIF.php.
{ if(parent::validate($value)==0) $this->valida_nif_cif_nie($value); }
$validateCIF = FALSE [private] |
Definición en la línea 47 del archivo typeNIF.php.
$validateNIE = FALSE [private] |
Definición en la línea 48 del archivo typeNIF.php.
$validateNIF = TRUE [private] |
Definición en la línea 46 del archivo typeNIF.php.