[ 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: comptacompte.class.php,v 1.3 2005/04/04 10:40:36 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/comptacompte.class.php,v $ 20 * 21 */ 22 23 /*! \file htdocs/compta/comptacompte.class.php 24 \ingroup compta 25 \brief Fichier de la classe des comptes comptable 26 \version $Revision: 1.3 $ 27 */ 28 29 30 /*! \class ComptaCompte 31 \brief Classe permettant la gestion des comptes généraux de compta 32 */ 33 34 class ComptaCompte 35 { 36 var $db ; 37 38 var $id ; 39 var $num; 40 var $intitule; 41 42 /** 43 * \brief Constructeur de la classe 44 * \param DB handler accès base de données 45 * \param id id compte (0 par defaut) 46 */ 47 48 function ComptaCompte($DB, $id=0) 49 { 50 $this->db = $DB; 51 $this->id = $id ; 52 } 53 54 /** 55 * \brief Insère le produit en base 56 * \param user utilisateur qui effectue l'insertion 57 */ 58 59 function create($user) 60 { 61 if (strlen(trim($this->numero)) && strlen(trim($this->intitule))) 62 { 63 $sql = "SELECT count(*)"; 64 $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux "; 65 $sql .= " WHERE numero = '" .trim($this->numero)."'"; 66 67 $resql = $this->db->query($sql) ; 68 69 if ( $resql ) 70 { 71 $row = $this->db->fetch_array($resql); 72 if ($row[0] == 0) 73 { 74 $sql = "INSERT INTO ".MAIN_DB_PREFIX."compta_compte_generaux (date_creation, fk_user_author, numero,intitule)"; 75 $sql .= " VALUES (now(),".$user->id.",'".$this->numero."','".$this->intitule."')"; 76 77 $resql = $this->db->query($sql); 78 if ( $resql ) 79 { 80 $id = $this->db->last_insert_id(MAIN_DB_PREFIX."compta_compte_generaux"); 81 82 if ($id > 0) 83 { 84 $this->id = $id; 85 $result = 0; 86 } 87 else 88 { 89 $result = -2; 90 dolibarr_syslog("ComptaCompte::Create Erreur $result lecture ID"); 91 } 92 } 93 else 94 { 95 $result = -1; 96 dolibarr_syslog("ComptaCompte::Create Erreur $result INSERT Mysql"); 97 } 98 } 99 else 100 { 101 $result = -3; 102 dolibarr_syslog("ComptaCompte::Create Erreur $result SELECT Mysql"); 103 } 104 } 105 else 106 { 107 $result = -5; 108 dolibarr_syslog("ComptaCompte::Create Erreur $result SELECT Mysql"); 109 } 110 } 111 else 112 { 113 $result = -4; 114 dolibarr_syslog("ComptaCompte::Create Erreur $result Valeur Manquante"); 115 } 116 117 return $result; 118 } 119 } 120 ?>
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 |
![]() |