Verification du format des numeros de telephones

This commit is contained in:
Rodolphe Quiedeville 2007-07-11 18:12:55 +00:00
parent c4d35b8a1c
commit bdc24d8cef

View File

@ -66,7 +66,7 @@ class CdrFormatFructidor
$tabline = explode(";", $cont); $tabline = explode(";", $cont);
if (sizeof($tabline) == 7) if (sizeof($tabline) == 7)
{ {
$this->datas[$i]['index'] = $i; $this->datas[$i]['index'] = $i;
$this->datas[$i]['ligne'] = ereg_replace('"','',$tabline[0]); $this->datas[$i]['ligne'] = ereg_replace('"','',$tabline[0]);
$this->datas[$i]['date'] = $tabline[1]; $this->datas[$i]['date'] = $tabline[1];
$this->datas[$i]['heure'] = $tabline[2]; $this->datas[$i]['heure'] = $tabline[2];
@ -74,6 +74,13 @@ class CdrFormatFructidor
$this->datas[$i]['tarif'] = trim($tabline[4]); $this->datas[$i]['tarif'] = trim($tabline[4]);
$this->datas[$i]['duree'] = trim($tabline[5]); $this->datas[$i]['duree'] = trim($tabline[5]);
$this->datas[$i]['montant'] = trim($tabline[6]); $this->datas[$i]['montant'] = trim($tabline[6]);
if (preg_match("/\D/",$this->datas[$i]['numero']))
{
array_push($this->messages,array('error',"Une ligne du fichier contient un numero invalide : ".$this->datas[$i]['numero']));
$error++;
}
$i++; $i++;
} }
else else
@ -86,10 +93,14 @@ class CdrFormatFructidor
} }
fclose($hf); fclose($hf);
array_push($this->messages,array('info',"$line lignes lues dans le fichier")); array_push($this->messages,array('info',"$line lignes lues dans le fichier"));
if ($badformat > 0) if ($badformat > 0)
{ {
array_push($this->messages,array('error',"$badformat lignes ont un mauvais format dans le fichier")); array_push($this->messages,array('error',"$badformat lignes ont un mauvais format dans le fichier"));
} }
dolibarr_syslog("CdrFormatFructidor::ReadFile read $i lines", LOG_DEBUG); dolibarr_syslog("CdrFormatFructidor::ReadFile read $i lines", LOG_DEBUG);
return $error;
} }
} }