[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id: retour-check.php,v 1.4 2005/10/17 18:18:55 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/retour-check.php,v $ 20 * 21 * Script d'import des retour 22 * 23 * Ce script permet de rechercher des lignes inconnues chez nous 24 * presentes dans les fichiers de retour 25 * 26 * 27 */ 28 $verbose = 1; 29 require ("../../master.inc.php"); 30 31 require_once (DOL_DOCUMENT_ROOT."/telephonie/lignetel.class.php"); 32 require_once (DOL_DOCUMENT_ROOT."/telephonie/facturetel.class.php"); 33 require_once (DOL_DOCUMENT_ROOT."/telephonie/telephonie-tarif.class.php"); 34 require_once (DOL_DOCUMENT_ROOT."/telephonie/communication.class.php"); 35 require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); 36 37 $dir = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/"; 38 $dirdone = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/traite/"; 39 40 $dirback = DOL_DATA_ROOT."/telephonie/ligne/commande/retour/backup/"; 41 42 if (! file_exists($dirback)) 43 { 44 umask(0); 45 if (! @mkdir($dirback, 0755)) 46 { 47 dolibarr_syslog("Erreur: creation '$dir'"); 48 } 49 } 50 51 52 $handle=opendir($dir); 53 54 if ($verbose) dolibarr_syslog("Lecture repertoire $dir"); 55 56 while (($file = readdir($handle))!==false) 57 { 58 if (is_file($dir.$file)) 59 { 60 if (is_readable($dir.$file)) 61 { 62 if ($verbose) dolibarr_syslog("Lecture $file"); 63 64 if (! file_exists($dirdone)) 65 { 66 umask(0); 67 if (! @mkdir($dirdone, 0755)) 68 { 69 dolibarr_syslog("Erreur: creation '$dirdone'"); 70 } 71 } 72 73 /* 74 * On teste le fichier 75 */ 76 check_file($db, $dir, $file); 77 } 78 else 79 { 80 dolibarr_syslog("Erreur Lecture $file permissions insuffisante"); 81 } 82 } 83 } 84 85 closedir($handle); 86 87 /** 88 * 89 * 90 * 91 */ 92 93 Function check_file($db,$dir,$file) 94 { 95 $error = 0; 96 $line = 0; 97 $hf = fopen ($dir.$file, "r"); 98 99 $ok = 0; 100 $nok = 0; 101 102 while (!feof($hf)) 103 { 104 $cont = fgets($hf, 1024); 105 106 $tabline = explode(";", $cont); 107 108 if (substr($tabline, 0, 3) <> 'CLI') 109 { 110 if (sizeof($tabline) == 8) 111 { 112 $numero = $tabline[0]; 113 $mode = $tabline[1]; 114 $situation = $tabline[2]; 115 $date_mise_service = $tabline[3]; 116 $date_resiliation = $tabline[4]; 117 $motif_resiliation = $tabline[5]; 118 $commentaire = $tabline[6]; 119 $fichier = $file; 120 121 $ligne = new LigneTel($db); 122 if ($ligne->fetch($numero) == 1) 123 { 124 print "Ligne : $numero OK\n"; 125 $ok++; 126 } 127 else 128 { 129 print "Ligne : $numero ERREUR\n"; 130 $nok++; 131 } 132 } 133 } 134 $line++; 135 } 136 137 fclose($hf); 138 139 print "ok : $ok\n"; 140 print "erreurs : $nok\n"; 141 print "lignes : $line\n"; 142 return $error; 143 144 145 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 12:29:37 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |