From fe3ed511ea6756504a63967ceb7f99f9578a0897 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 11 Jul 2007 11:37:40 +0000 Subject: [PATCH] Ajout infos de debug --- .../facturation/FacturationImportCdr.class.php | 13 +++++++++---- .../cdrformat/cdrformat.fructidor.class.php | 11 +++++++++-- .../cdrformat/cdrformat.messidor.class.php | 3 ++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/htdocs/telephonie/facturation/FacturationImportCdr.class.php b/htdocs/telephonie/facturation/FacturationImportCdr.class.php index 69862fa376c..7778266c5c7 100644 --- a/htdocs/telephonie/facturation/FacturationImportCdr.class.php +++ b/htdocs/telephonie/facturation/FacturationImportCdr.class.php @@ -167,9 +167,11 @@ class FacturationImportCdr { if ( $this->_verif($this->db, $xfile, $fichiers) == 0) { dolibarr_syslog("FacturationImportCdr::Import Lecture du fichier $xfile", LOG_DEBUG); - + array_push($this->messages,array('info',"Fichier ".basename($xfile)." : utilisation format ".$cdrformat->nom)); $cdrformat->ReadFile($xfile); + $this->messages=array_merge($this->messages, $cdrformat->messages); + $error = 0; $line = 0; $line_inserted = 0; @@ -239,21 +241,24 @@ class FacturationImportCdr { } dolibarr_syslog("FacturationImportCdr::Import $line lignes traitées dans le fichier", LOG_INFO); + $level = ($line > 0) ? 'info':'warning'; + array_push($this->messages,array($level,"Fichier ".basename($xfile)." : $line lignes traitées dans le fichier")); dolibarr_syslog("FacturationImportCdr::Import $line_inserted insert effectués", LOG_INFO); - array_push($this->messages,"$line_inserted ajout dans la table des CDR a traiter"); + $level = ($line_inserted > 0) ? 'info':'warning'; + array_push($this->messages,array($level,"Fichier ".basename($xfile)." : $line_inserted ajout dans la table des CDR a traiter")); if (sizeof($this->message_bad_file_format)) { foreach ($this->message_bad_file_format as $key => $value) { - array_push($this->messages,"$value ligne(s) au mauvais format dans $key"); + array_push($this->messages,array('warning',"$value ligne(s) au mauvais format dans $key")); } } if ($error == 0) { $this->db->query("COMMIT"); - array_push($this->messages, array('info',"Fichier ".basename($xfile)." importation reussie")); + array_push($this->messages, array('info',"Fichier ".basename($xfile)." : importation reussie")); } else { diff --git a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php index 19bd9584458..a66ffdd72bf 100644 --- a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php +++ b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.fructidor.class.php @@ -33,6 +33,7 @@ class CdrFormatFructidor { $this->nom = "Fructidor"; $this->datas = array(); + $this->messages = array(); } function showSample() @@ -48,8 +49,9 @@ class CdrFormatFructidor function ReadFile($file) { + $this->messages = array(); dolibarr_syslog("CdrFormatFructidor::ReadFile($file)", LOG_DEBUG); - + $badformat = 0; $error = 0; $i = 0; $line = 1; @@ -77,12 +79,17 @@ class CdrFormatFructidor else { dolibarr_syslog("CdrFormatFructidor::ReadFile Mauvais format de fichier ligne $line", LOG_ERR); + $badformat++; } } $line++; } fclose($hf); - + array_push($this->messages,array('info',"Fichier ".basename($file)." : $line lignes lues dans le fichier")); + if ($badformat > 0) + { + array_push($this->messages,array('error',"Fichier ".basename($file)." : $badformat lignes ont un mauvais format dans le fichier")); + } dolibarr_syslog("CdrFormatFructidor::ReadFile read $i lines", LOG_DEBUG); } } diff --git a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php index 5fea37b358c..bdb17181eac 100644 --- a/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php +++ b/htdocs/telephonie/fournisseur/cdrformat/cdrformat.messidor.class.php @@ -33,6 +33,7 @@ class CdrFormatMessidor { $this->nom = "Messidor"; $this->datas = array(); + $this->messages = array(); } function ShowSample() @@ -82,7 +83,7 @@ class CdrFormatMessidor $line++; } fclose($hf); - + array_push($this->messages,array('info',"Fichier ".basename($file)." : $line lignes lues dans le fichier")); dolibarr_syslog("CdrFormatMessidor::ReadFile read $i lines", LOG_DEBUG); } }