[ 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: fournisseurtel.class.php,v 1.7 2005/04/18 09:50:01 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/fournisseurtel.class.php,v $ 20 * 21 */ 22 23 class FournisseurTelephonie { 24 var $db; 25 var $id; 26 27 /** 28 * Créateur 29 * 30 * 31 */ 32 function FournisseurTelephonie($DB, $id=0) 33 { 34 $this->db = $DB; 35 $this->id = $id; 36 $this->classdir = DOL_DOCUMENT_ROOT.'/telephonie/fournisseur/commande/'; 37 return 1; 38 } 39 /** 40 * 41 * 42 */ 43 function create() 44 { 45 $res = 0; 46 $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_fournisseur"; 47 $sql .= " (nom, email_commande, commande_active)"; 48 $sql .= " VALUES ('".$this->nom."','".$this->email_commande."',1)"; 49 50 if (! $this->db->query($sql) ) 51 { 52 $res = -1; 53 } 54 return $res; 55 } 56 /** 57 * 58 * 59 */ 60 function update() 61 { 62 $res = 0; 63 64 $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur"; 65 $sql .= " SET "; 66 $sql .= " email_commande = '".$this->email_commande."'"; 67 $sql .= ", num_client = '".$this->num_client."'"; 68 $sql .= ", class_commande = '".$this->methode_commande."'"; 69 $sql .= ", commande_bloque = '".$this->commande_bloque."'"; 70 71 $sql .= " WHERE rowid = ".$this->id; 72 73 if (! $this->db->query($sql) ) 74 { 75 $res = -1; 76 } 77 return $res; 78 } 79 /** 80 * 81 * 82 */ 83 function fetch($id) 84 { 85 $this->id = $id; 86 87 $sql = "SELECT f.rowid, f.nom, f.email_commande, f.commande_active"; 88 $sql .= ", f.class_commande, f.commande_bloque"; 89 $sql .= ", f.num_client"; 90 $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; 91 $sql .= " WHERE f.rowid = ".$this->id; 92 93 if ($this->db->query($sql)) 94 { 95 if ($this->db->num_rows()) 96 { 97 $obj = $this->db->fetch_object(0); 98 99 $this->nom = stripslashes($obj->nom); 100 $this->num_client = $obj->num_client; 101 $this->email_commande = $obj->email_commande; 102 $this->commande_enable = $obj->commande_active; 103 $this->class_commande = $obj->class_commande; 104 $this->commande_bloque = $obj->commande_bloque; 105 106 return 0; 107 } 108 else 109 { 110 dolibarr_syslog("FournisseurTelephonie::Fetch Erreur id=".$this->id); 111 return -1; 112 } 113 } 114 else 115 { 116 dolibarr_syslog("FournisseurTelephonie::Fetch Erreur SQL id=".$this->id); 117 return -2; 118 } 119 } 120 /** 121 * 122 * 123 */ 124 function active() 125 { 126 $res = 0; 127 $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur"; 128 $sql .= " SET commande_active = 1"; 129 $sql .= " WHERE rowid = ".$this->id; 130 131 if (! $this->db->query($sql) ) 132 { 133 $res = -1; 134 } 135 return $res; 136 } 137 /** 138 * 139 * 140 */ 141 function desactive() 142 { 143 $res = 0; 144 $sql = "UPDATE ".MAIN_DB_PREFIX."telephonie_fournisseur"; 145 $sql .= " SET commande_active = 0"; 146 $sql .= " WHERE rowid = ".$this->id; 147 148 if (! $this->db->query($sql) ) 149 { 150 $res = -1; 151 } 152 return $res; 153 } 154 /** 155 * 156 * 157 * 158 * 159 */ 160 function array_methode() 161 { 162 clearstatcache(); 163 164 $handle=opendir($this->classdir); 165 166 $arr = array(); 167 168 while (($file = readdir($handle))!==false) 169 { 170 171 dolibarr_syslog($file); 172 173 if (is_readable($this->classdir.$file) && substr($file, 0, 8) == 'commande' && substr($file, -10) == '.class.php') 174 { 175 176 $name = substr($file, 9, strlen($file) -19); 177 178 $filebis = $this->classdir . $file; 179 180 // Chargement de la classe de numérotation 181 $classname = "CommandeMethode".ucfirst($name); 182 183 require_once($filebis); 184 185 $obj = new $classname($this->db); 186 187 $arr[$name] = $obj->nom; 188 } 189 190 } 191 return $arr; 192 } 193 /** 194 * Crée une commande pour ce fournisseur 195 * 196 * 197 * 198 */ 199 function CreateCommande($user) 200 { 201 dolibarr_syslog("FournisseurTelephonie::CreateCommande User:$user->id"); 202 203 $fileclass = $this->classdir.'commande.'.$this->class_commande.'.class.php'; 204 205 require_once($fileclass); 206 207 $classname = "CommandeMethode".ucfirst($this->class_commande); 208 209 dolibarr_syslog("FournisseurTelephonie::CreateCommande user $classname"); 210 211 $ct = new $classname($this->db, $user, $this); 212 213 $result = $ct->create(); 214 215 return $result; 216 } 217 218 } 219 ?>
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 |
![]() |