Nouveau fichier

This commit is contained in:
Rodolphe Quiedeville 2007-07-05 07:15:49 +00:00
parent 1b03b952a1
commit cb58bdc4e7

View File

@ -0,0 +1,77 @@
<?PHP
/* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
* Format de CDR Fructidor
*
* 0297500000;05/09/2006;12:50:34;33617000000;France-Mobile-SFR;5;0.0116
* 0297500001;05/09/2006;12:58:45;33240000000;France national ;124;0.0256
* 0297500000;27/09/2006;16:18:18;33625000000;France-Mobile-SFR;4;0.0093
* 0297500000;27/09/2006;16:22:32;33240000000;France national ;14;0.0029
*
*/
class CdrFormatFructidor
{
function CdrFormatFructidor()
{
$this->nom = "Fructidor";
$this->datas = array();
}
function ReadFile($file)
{
dolibarr_syslog("CdrFormatFructidor::ReadFile($file)", LOG_DEBUG);
$error = 0;
$i = 0;
$line = 1;
$hf = fopen ($file, "r");
while (!feof($hf))
{
$cont = fgets($hf, 1024);
if (strlen(trim($cont)) > 0)
{
$tabline = explode(";", $cont);
if (sizeof($tabline) == 7)
{
$this->datas[$i]['index'] = $line;
$this->datas[$i]['ligne'] = ereg_replace('"','',$tabline[1]);
$this->datas[$i]['date'] = $tabline[1];
$this->datas[$i]['heure'] = $tabline[2];
$this->datas[$i]['numero'] = ereg_replace('"','',$tabline[3]);
$this->datas[$i]['montant'] = trim($tabline[6]);
$this->datas[$i]['duree'] = trim($tabline[5]);
$i++;
}
else
{
dolibarr_syslog("CdrFormatFructidor::ReadFile Mauvais format de fichier ligne $line");
}
}
$line++;
}
fclose($hf);
dolibarr_syslog("CdrFormatFructidor::ReadFile read $i lines", LOG_DEBUG);
}
}