From cb58bdc4e76daedeea39e6e828f2d48e01cc8c0f Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 5 Jul 2007 07:15:49 +0000 Subject: [PATCH] Nouveau fichier --- .../cdrformat/cdrformat.fructidor.class.php | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php diff --git a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php new file mode 100644 index 00000000000..c0bf3c420d6 --- /dev/null +++ b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php @@ -0,0 +1,77 @@ + + * + * 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); + } +}