dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-dev] suit du patch


From: Franky Van Liedekerke
Subject: [Dolibarr-dev] suit du patch
Date: Thu, 01 Feb 2007 09:56:34 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20061219)

Apparemment quelques lignes étaient pas dans le patch pour
product.class.php, alors les voila (voir attach)
J'ai aussi ajouté:

if ($id>0) $this->fetch($id);

dans le constructeur du class. Cela nous permets d'enlever des lignes comme:
                    $prod = new Product($this->db,
$_facrec->lignes[$i]->produit_id);
                    $res=$prod->fetch($_facrec->lignes[$i]->produit_id);
et justement faire:
                    $prod = new Product($this->db,
$_facrec->lignes[$i]->produit_id);
ou:
                        $prod=new Product($this->db);
                        $prod->fetch($idproduct);
devient
                        $prod=new Product($this->db,$idproduct);

En effet, cela peut être utilisé aussi pour des autres classes, eg:
    $soc = new Societe($this->db);
    $soc->fetch($this->socid);

Qu'est-ce-que vous en pensez?

Franky
--- orig/dolibarr/htdocs/product.class.php      2007-02-01 09:08:56.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product.class.php 2007-02-01 
09:42:18.000000000 +0100
@@ -55,8 +55,9 @@
   var $multiprices_base_type=array();
   //! Taux de TVA
   var $tva_tx;
-  //! Type 0 pour produit, 1 pour service
+  //! Type 0 for regural product, 1 for service, 2 for assembly kit, 3 for 
stock kit
   var $type;
+  var $typestring;
   var $seuil_stock_alerte;
   //! Duree de validite du service
   var $duration_value;
@@ -95,9 +96,8 @@
     $this->status = 0;
     $this->seuil_stock_alerte = 0;
     
-    $this->typeprodser[0]=$langs->trans("Product");
-    $this->typeprodser[1]=$langs->trans("Service");
     $this->canvas = '';
+    if ($id>0) $this->fetch($id);
   }
   /**
    *    \brief      Vérifie que la référence et libellé du produit est non null
@@ -963,17 +963,6 @@
 
        $this->label_url = '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$this->id.'">'.$this->libelle.'</a>';
        
-       if ($this->type == 0)
-         {
-           $this->isproduct = 1;
-           $this->isservice = 0;
-         }
-       else
-         {
-           $this->isproduct = 0;
-           $this->isservice = 1;
-         }
-       
        $this->db->free();
        // multilangs
        if( $conf->global->MAIN_MULTILANGS) $this->getMultiLangs();
@@ -2493,7 +2482,7 @@
        $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON 
cp.fk_product = p.rowid";
        $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie 
= c.rowid";
       }
-    $sql.= " WHERE p.fk_product_type = 0";
+    $sql.= " WHERE p.fk_product_type <> 1";
     if ($conf->categorie->enabled && !$user->rights->categorie->voir)
       {
        $sql.= " AND IFNULL(c.visible,1)=1";

reply via email to

[Prev in Thread] Current Thread [Next in Thread]