[ 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: telephonie.commercial.class.php,v 1.2 2005/09/05 14:37:53 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/telephonie.commercial.class.php,v $ 20 * 21 */ 22 23 class CommercialTelephonie { 24 var $db; 25 var $id; 26 27 /** 28 * Créateur 29 * 30 * 31 */ 32 function CommercialTelephonie($DB, $id=0) 33 { 34 $this->db = $DB; 35 $this->id = $id; 36 37 return 0; 38 } 39 /** 40 * 41 * 42 */ 43 function create() 44 { 45 $error = 0; 46 47 if (strlen(trim($this->nom)) == 0) 48 { 49 $this->error_string["nom"] = "Valeur manquante"; 50 $error++; 51 } 52 if (strlen(trim($this->prenom)) == 0) 53 { 54 $this->error_string["prenom"] = "Valeur manquante"; 55 $error++; 56 } 57 58 59 if ($error == 0) 60 { 61 62 $nuser = new User($this->db); 63 $nuser->nom = trim($this->nom); 64 $nuser->prenom = trim($this->prenom); 65 $nuser->admin = 0; 66 $nuser->email = trim($this->email); 67 $nuser->login = substr($this->nom,0,3).substr($this->prenom,0,3); 68 69 $uid = $nuser->create(); 70 71 if ($uid > 0) 72 { 73 $nuser->SetInGroup(TELEPHONIE_GROUPE_COMMERCIAUX_ID); 74 75 $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_distributeur_commerciaux "; 76 $sql .= " (fk_distributeur, fk_user)"; 77 78 $sql .= " VALUES ('".$this->distri."','$uid')"; 79 80 81 if ($this->db->query($sql)) 82 { 83 84 } 85 else 86 { 87 dolibarr_syslog("DistributeurTelephonie::Create"); 88 $this->error_string["prenom"] = "Erreur SQL : $sql"; 89 $this->error_string["nom"] = $this->db->error(); 90 $error++; 91 } 92 93 } 94 else 95 { 96 $this->error_string["prenom"] = "Erreur création user"; 97 $this->error_string["nom"] = $user->error(); 98 $error++; 99 } 100 101 } 102 else 103 { 104 105 } 106 107 return $error; 108 109 } 110 111 112 113 114 } 115 ?>
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 |
![]() |