[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/lolix/ -> lolix.societe.class.php (source)

   1  <?php
   2  /* Copyright (C) 2004 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: lolix.societe.class.php,v 1.4 2004/10/23 17:35:45 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/lolix/lolix.societe.class.php,v $
  20   *
  21   */
  22  
  23  class LolixSociete {
  24    var $db;
  25  
  26    var $id;
  27    var $nom;
  28    var $adresse;
  29    var $cp;
  30    var $ville;
  31    var $tel;
  32    var $fax;
  33    var $url;
  34    var $siren;
  35    var $client;
  36    var $note;
  37    var $fournisseur;
  38   
  39  
  40    Function LolixSociete($DB, $id=0)
  41    {
  42      global $config;
  43  
  44      $this->db = $DB;
  45      $this->id = $id;
  46  
  47      return 1;
  48    }
  49    /*
  50     *
  51     *
  52     *
  53     */
  54    Function update($id)
  55    {
  56      $sql = "SELECT short_desc";
  57      $sql .= " FROM ".MAIN_DB_PREFIX."societe_details as sd";
  58      $sql .= " WHERE sd.fk_soc = ".$this->id;
  59      
  60      if ($this->db->query($sql))
  61        {
  62      if ($this->db->num_rows() == 0)
  63        {
  64          $this->db->free();
  65          $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_details (fk_soc) VALUES ($id)";
  66          $result = $this->db->query($sql);
  67        }
  68        }
  69  
  70      $sql = "UPDATE ".MAIN_DB_PREFIX."societe_details ";
  71      $sql .= " SET short_desc = '" . trim($this->short_desc) ."'";
  72      $sql .= ", long_desc = '" . trim($this->long_desc) ."'";
  73      $sql .= ", contact_nom = '" . trim($this->contact_nom) ."'";
  74      $sql .= ", contact_email = '" . trim($this->contact_email) ."'";
  75      $sql .= ", date_creation = ',".$this->db->idate($this->date_creation). "'";
  76      $sql .= " WHERE fk_soc = " . $id .";";
  77      
  78      if ($this->db->query($sql)) 
  79        {
  80  
  81        }
  82      else
  83        {
  84      print $this->db->error();
  85        }
  86    }
  87  
  88    /*
  89     *
  90     *
  91     */
  92    Function fetch($socid)
  93      {
  94        $this->id = $socid;
  95  
  96        $sql = "SELECT s.nom,s.active,s.siren,s.tel,s.url,s.fax,";
  97        $sql .= $this->db->pdate("s.datec")." as dc";
  98        $sql .= " FROM lolixfr.societe as s";
  99        $sql .= " WHERE s.idp = ".$this->id;
 100  
 101        if ($this->db->query($sql)) 
 102      {
 103        if ($this->db->num_rows())
 104          {
 105            $obj = $this->db->fetch_object();
 106  
 107            $this->nom = $obj->nom;
 108            $this->active = $obj->active;
 109            $this->tel = $obj->tel;
 110            $this->fax = $obj->fax;
 111            $this->url = $obj->url;
 112  
 113            $this->date_creation = $obj->dc;
 114  
 115            $this->siren = $obj->siren;
 116  
 117  
 118            return 1;
 119            
 120          }
 121        else
 122          {
 123            print "Error";
 124          }
 125        $this->db->free();
 126      }
 127        else
 128      {
 129        print $this->db->error();
 130      }
 131    }
 132    /*
 133     *
 134     *
 135     */
 136    
 137  }
 138  
 139  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics