[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?PHP 2 /* Copyright (C) 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: affect-id-ligne.php,v 1.2 2005/03/16 14:31:52 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/affect-id-ligne.php,v $ 20 * 21 * 22 * Synchronise les id dans la tables des comm 23 * scrip temporaire le temps de ré-écrire la facturation 24 * 25 */ 26 require ("../../master.inc.php"); 27 28 $error = 0; 29 $stop = 0 ; 30 31 $sql = "SELECT distinct(ligne) as l, count(*)"; 32 $sql .= " FROM llx_telephonie_societe_ligne"; 33 $sql .= " GROUP by l DESC "; 34 35 if ($db->query($sql)) 36 { 37 $num = $db->num_rows(); 38 39 if ($num) 40 { 41 $row = $db->fetch_row(); 42 if ( $row[1] > 1) 43 { 44 print "Doublons ligne $row[0]\n"; 45 $stop = 1; 46 } 47 } 48 $db->free(); 49 } 50 51 if ($stop == 0) 52 { 53 54 for ($i = 0 ; $i < 5000 ; $i++) 55 { 56 57 $sql = "SELECT fk_ligne, ligne"; 58 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details"; 59 $sql .= " WHERE fk_ligne is null"; 60 $sql .= " LIMIT 1"; 61 62 if ($db->query($sql)) 63 { 64 $num = $db->num_rows(); 65 66 if ($num) 67 { 68 $row = $db->fetch_row(); 69 $ligne = $row[1]; 70 } 71 $db->free(); 72 } 73 74 $sql = "SELECT rowid, ligne"; 75 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne"; 76 $sql .= " WHERE ligne =".$ligne; 77 78 if ($db->query($sql)) 79 { 80 $num = $db->num_rows(); 81 82 if ($num) 83 { 84 $row = $db->fetch_row(); 85 $id = $row[0]; 86 } 87 $db->free(); 88 } 89 90 $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_communications_details"; 91 $sql .= " SET fk_ligne = ".$id; 92 $sql .= " WHERE ligne =".$ligne; 93 94 if ($db->query($sql)) 95 { 96 print "$ligne -> $id -> "; 97 print $db->affected_rows()."\n"; 98 } 99 } 100 } 101 102 ?>
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 |
![]() |