| [ 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: fournisseur.product.class.php,v 1.1 2005/04/14 11:42:45 rodolphe Exp $ 19 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/fournisseur.product.class.php,v $ 20 * 21 */ 22 23 /** 24 \file htdocs/product.class.php 25 \ingroup produit 26 \brief Fichier de la classe des produits prédéfinis 27 \version $Revision: 1.1 $ 28 */ 29 30 31 /** 32 \class Product 33 \brief Classe permettant la gestion des produits prédéfinis 34 */ 35 36 require_once DOL_DOCUMENT_ROOT."/product.class.php"; 37 require_once DOL_DOCUMENT_ROOT."/fourn/fournisseur.product.class.php"; 38 39 class ProductFournisseur extends Product 40 { 41 var $db ; 42 43 var $id ; 44 var $fourn_ref; 45 var $fourn; 46 47 function ProductFournisseur($db) 48 { 49 $this->db = $db; 50 51 $this->fourn = new Fournisseur($this->db); 52 } 53 54 function fetch ($id, $id_fourn) 55 { 56 Product::Fetch($id); 57 $this->fourn->fetch($id_fourn); 58 59 60 $sql = "SELECT ref_fourn"; 61 $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur"; 62 $sql .=" WHERE fk_soc = ".$this->fourn->id; 63 $sql .= " AND fk_product = ".$this->id; 64 65 $resql = $this->db->query($sql) ; 66 67 if ( $resql ) 68 { 69 $result = $this->db->fetch_array($resql); 70 71 $this->fourn_ref = $result["ref_fourn"]; 72 73 $this->db->free($resql); 74 } 75 else 76 { 77 print "Errir"; 78 } 79 80 return 0; 81 } 82 83 /* 84 * 85 * 86 */ 87 88 function get_buyprice($qty) 89 { 90 Product::get_buyprice($this->fourn->id, $qty); 91 } 92 93 /* 94 * 95 * 96 */ 97 98 function update($ref, $qty, $buyprice, $user) 99 { 100 $this->fourn_ref = $ref; 101 102 /* Mise à jour du prix */ 103 104 Product::update_buyprice($this->fourn->id, $qty, $buyprice, $user); 105 106 /* Mise à jour de la référence */ 107 108 $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur "; 109 $sql .= " SET ref_fourn = '" . $this->fourn_ref ."'"; 110 $sql .= " WHERE fk_product = " . $this->id; 111 $sql .=" AND fk_soc = ".$this->fourn->id; 112 113 $resql = $this->db->query($sql) ; 114 } 115 116 } 117 ?>
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 |
|