dolibarr-dev
[Top][All Lists]
Advanced

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

[Dolibarr-dev] 2 patches


From: Franky Van Liedekerke
Subject: [Dolibarr-dev] 2 patches
Date: Fri, 02 Feb 2007 16:38:49 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20061219)

2 patches:

- remplacer le code

  $product = new Product($db);
  $product->fetch($_GET["id"]);

  par

  $product = new Product($db, $_GET["id"]);

  Naturellement ce n'est pas nécessaire, mais c'est plus facile à
comprendre: si tu veut adapter un produit, tu donne l'id avec, et si tu
veux créer un nouveau produit, tu donne rien comme id.

- extra check dans product.class.php sur l'id du produit. Maintenant, ci
on fait
  http://<your.web.server>/dolibarr/htdocs/product/fiche.php?id=56
  et produit id 56 n'existe pas, tu reçois une erreur
  La même chose se passe pour tout le code qui fait
  new Product($db, <product ID>);
  et <product ID> n'existe pas.

Franky
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/comm/propal.php 
/var/www/localhost/htdocs/dolibarr/htdocs/comm/propal.php
--- orig/dolibarr/htdocs/comm/propal.php        2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/comm/propal.php   2007-02-02 
15:16:02.000000000 +0100
@@ -534,8 +535,7 @@
                // Ecrase $txtva par celui du produit
         if ($_POST['idprod'])
         {
-            $prod = new Product($db, $_POST['idprod']);
-            $prod->fetch($_POST['idprod']);
+            $prod = new Product($db, $_POST['idprod'],$_POST['idprod']);
             
             // multiprix
             if ($conf->global->PRODUIT_MULTIPRICES == 1)
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/commande/fiche.php 
/var/www/localhost/htdocs/dolibarr/htdocs/commande/fiche.php
--- orig/dolibarr/htdocs/commande/fiche.php     2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/commande/fiche.php        
2007-02-02 15:14:12.000000000 +0100
@@ -59,6 +60,7 @@
 {
        $socid = $user->societe_id;
 }
+
 if ($user->societe_id >0 && isset($_GET["id"]) && $_GET["id"]>0)
 {
    $commande = new Commande($db);
@@ -68,8 +70,6 @@
    }
 }
 
-
-
 // Récupération de l'id de projet
 $projetid = 0;
 if ($_GET["projetid"])
@@ -275,7 +275,6 @@
       if ($_POST['idprod'])
        {
          $prod = new Product($db, $_POST['idprod']);
-         $prod->fetch($_POST['idprod']);
 
          $libelle = $prod->libelle;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/compta/facture/facture-rec.class.php 
/var/www/localhost/htdocs/dolibarr/htdocs/compta/facture/facture-rec.class.php
--- orig/dolibarr/htdocs/compta/facture/facture-rec.class.php   2007-01-16 
23:36:24.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/compta/facture/facture-rec.class.php  
    2007-02-02 15:18:38.000000000 +0100
@@ -112,8 +112,7 @@
                 {
                     if ($facsrc->lignes[$i]->produit_id > 0)
                     {
-                        $prod = new Product($this->db);
-                        $prod->fetch($facsrc->lignes[$i]->produit_id);
+                        $prod = new Product($this->db, 
$facsrc->lignes[$i]->produit_id);
                     }
 
                     $result_insert = $this->addline($this->id,
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/compta/facture.php 
/var/www/localhost/htdocs/dolibarr/htdocs/compta/facture.php
--- orig/dolibarr/htdocs/compta/facture.php     2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/compta/facture.php        
2007-02-02 15:18:43.000000000 +0100
@@ -634,7 +635,6 @@
         if ($_POST['idprod'])
         {
             $prod = new Product($db, $_POST['idprod']);
-            $prod->fetch($_POST['idprod']);
 
                  $price_base_type = $prod->price_base_type;
 
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/contrat/contrat.class.php 
/var/www/localhost/htdocs/dolibarr/htdocs/contrat/contrat.class.php
--- orig/dolibarr/htdocs/contrat/contrat.class.php      2007-01-22 
23:35:42.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/contrat/contrat.class.php 
2007-02-02 15:19:25.000000000 +0100
@@ -616,7 +616,7 @@
             
             if ($fk_product > 0)
             {
-                $prod = new Product($this->db, $fk_product);
+                $prod = new Product($this->db);
                 if ($prod->fetch($fk_product) > 0)
                 {
                     $label = $prod->libelle;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/contrat/ligne.php 
/var/www/localhost/htdocs/dolibarr/htdocs/contrat/ligne.php
--- orig/dolibarr/htdocs/contrat/ligne.php      2006-11-12 18:24:39.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/contrat/ligne.php 2007-02-02 
15:19:04.000000000 +0100
@@ -383,8 +383,7 @@
             {
                 if ($objp->fk_product > 0)
                 {
-                    $product=new Product($db);
-                    $product->fetch($objp->fk_product);
+                    $product=new Product($db,$objp->fk_product);
                     $dateactend = dolibarr_time_plus_duree (time(), 
$product->duration_value, $product->duration_unit);
                 }
             }
@@ -429,8 +428,7 @@
             {
                 if ($objp->fk_product > 0)
                 {
-                    $product=new Product($db);
-                    $product->fetch($objp->fk_product);
+                    $product=new Product($db,$objp->fk_product);
                     $dateactend = dolibarr_time_plus_duree (time(), 
$product->duration_value, $product->duration_unit);
                 }
             }
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/expedition/commande.php 
/var/www/localhost/htdocs/dolibarr/htdocs/expedition/commande.php
--- orig/dolibarr/htdocs/expedition/commande.php        2006-12-04 
12:43:09.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/expedition/commande.php   
2007-02-02 15:21:01.000000000 +0100
@@ -331,8 +331,7 @@
                 print "<tr $bc[$var]>";
                 if ($objp->fk_product > 0)
                 {
-                    $product = new Product($db);
-                    $product->fetch($objp->fk_product);
+                    $product = new Product($db,$objp->fk_product);
                     print '<td>';
                     print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">';
                     print img_object($langs->trans("Product"),"product").' 
'.$product->ref.'</a>';
@@ -536,8 +535,7 @@
                     
                     if ($objp->fk_product > 0)
                     {
-                     $product = new Product($db);
-                     $product->fetch($objp->fk_product);
+                     $product = new Product($db,$objp->fk_product);
                      
                      print '<td>';
                      print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.$product->libelle;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/expedition/fiche.php 
/var/www/localhost/htdocs/dolibarr/htdocs/expedition/fiche.php
--- orig/dolibarr/htdocs/expedition/fiche.php   2006-11-11 01:46:15.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/expedition/fiche.php      
2007-02-02 15:21:37.000000000 +0100
@@ -307,8 +307,7 @@
                        print "<tr $bc[$var]>\n";
                        if ($ligne->fk_product > 0)
                        {
-                               $product = new Product($db);
-                               $product->fetch($ligne->fk_product);
+                               $product = new Product($db,$ligne->fk_product);
 
                                print '<td>';
                                print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.$product->libelle;
@@ -571,8 +570,7 @@
                     print "<tr $bc[$var]>";
                     if ($objp->fk_product > 0)
                     {
-                        $product = new Product($db);
-                        $product->fetch($objp->fk_product);
+                        $product = new Product($db,$objp->fk_product);
 
                         print '<td>';
                         print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.$product->libelle;
@@ -712,8 +710,7 @@
                         print '<td align="left" nowrap="nowrap"><a 
href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').'
 '.$objp->ref.'<a></td>';
                         if ($objp->fk_product > 0)
                         {
-                            $product = new Product($db);
-                            $product->fetch($objp->fk_product);
+                            $product = new Product($db,$objp->fk_product);
 
                             print '<td>';
                             print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.dolibarr_trunc($product->libelle,20);
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
--- orig/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php   
2006-12-24 02:42:10.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php
      2007-02-02 15:20:28.000000000 +0100
@@ -177,8 +177,7 @@
                                $nblignes = sizeof($Produits);
                                for ($i = 0 ; $i < $nblignes ; $i++){
                                        //Generation du produit
-                                       $Prod = new Product($this->db);
-                                       $Prod->fetch($Produits[$i]->fk_product);
+                                       $Prod = new 
Product($this->db,$Produits[$i]->fk_product);
                                        //Creation des cases à cocher
                                        $pdf->rect(10+3, $curY+1, 3, 3);
                                        $pdf->rect(20+3, $curY+1, 3, 3);
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
--- orig/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php  
2007-02-01 09:08:57.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/expedition/mods/pdf/pdf_expedition_rouget.modules.php
     2007-02-02 15:20:40.000000000 +0100
@@ -224,8 +225,7 @@
                     // Si ligne associée à un code produit
                     if ($this->expe->lignes[$i]->fk_product)
                     {
-                        $prodser = new Product($this->db);
-                        $prodser->fetch($this->expe->lignes[$i]->fk_product);
+                        $prodser = new 
Product($this->db,$this->expe->lignes[$i]->fk_produc);
 
                                                // On ajoute la ref
                         if ($prodser->ref)
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/facture.class.php 
/var/www/localhost/htdocs/dolibarr/htdocs/facture.class.php
--- orig/dolibarr/htdocs/facture.class.php      2007-01-20 13:15:34.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/facture.class.php 2007-02-02 
15:22:04.000000000 +0100
@@ -247,7 +247,6 @@
                if ($_facrec->lignes[$i]->produit_id)
                  {
                    $prod = new Product($this->db, 
$_facrec->lignes[$i]->produit_id);
-                   $res=$prod->fetch($_facrec->lignes[$i]->produit_id);
                  }
                $tva_tx = get_default_tva($mysoc,$soc,$prod->tva_tx);
 
@@ -1295,8 +1294,7 @@
 
                if ($idproduct > 0)
                {
-                       $prod=new Product($this->db);
-                       $prod->fetch($idproduct);
+                       $prod=new Product($this->db,$idproduct);
        
                        $tva_tx = 
get_default_tva($mysoc,$this->client,$prod->tva_tx);
                        // multiprix
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php
--- orig/dolibarr/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php    
2007-01-04 16:33:42.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php
       2007-02-02 15:23:54.000000000 +0100
@@ -210,9 +210,7 @@
                     // Si ligne associée à un code produit
                     if ($com->lignes[$i]->fk_product)
                     {
-                        $prodser = new Product($this->db);
-
-                        $prodser->fetch($com->lignes[$i]->fk_product);
+                        $prodser = new 
Product($this->db,$com->lignes[$i]->fk_product);
                         if ($prodser->ref)
                         {
                             $libelleproduitservice=$langs->trans("Product")." 
".$prodser->ref." - ".$libelleproduitservice;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/fourn/facture/fiche.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/facture/fiche.php
--- orig/dolibarr/htdocs/fourn/facture/fiche.php        2007-01-31 
13:32:13.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/fourn/facture/fiche.php   
2007-02-02 15:24:04.000000000 +0100
@@ -234,8 +235,7 @@
 
     if ($_POST['idprod'])
     {
-        $nv_prod = new Product($db);
-        $nv_prod->fetch($_POST['idprod']);
+        $nv_prod = new Product($db,$_POST['idprod']);
 
                // cas spécial pour lequel on a les meme référence que le 
fournisseur
                // $label = '['.$nv_prod->ref.'] - '. $nv_prod->libelle;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/fourn/fournisseur.class.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/fournisseur.class.php
--- orig/dolibarr/htdocs/fourn/fournisseur.class.php    2006-10-11 
14:23:22.000000000 +0200
+++ /var/www/localhost/htdocs/dolibarr/htdocs/fourn/fournisseur.class.php       
2007-02-02 15:29:45.000000000 +0100
@@ -169,8 +169,7 @@
        
                if ($idc > 0)
                {
-                       $prod = new Product($this->db);
-                       $prod->fetch($fk_product);
+                       $prod = new Product($this->db,$fk_product);
                        $prod->fetch_fourn_data($this->id);
        
                        $commf->fetch($idc);
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/fourn/fournisseur.commande.class.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/fournisseur.commande.class.php
--- orig/dolibarr/htdocs/fourn/fournisseur.commande.class.php   2007-01-31 
13:32:13.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/fournisseur.commande.class.php  
    2007-02-02 15:23:42.000000000 +0100
@@ -644,7 +644,7 @@
             
        if ($fk_product > 0)
          {
-           $prod = new Product($this->db, $fk_product);
+           $prod = new Product($this->db);
            if ($prod->fetch($fk_product) > 0)
              {
                $result=$prod->get_buyprice($this->fourn_id,$qty);
@@ -1046,7 +1046,7 @@
 
     for ($i = 0 ; $i < sizeof($comclient->lignes) ; $i++)
       {
-       $prod = new Product($this->db, $comclient->lignes[$i]->fk_product);
+       $prod = new Product($this->db);
        if ($prod->fetch($comclient->lignes[$i]->fk_product) > 0)
          {
            $libelle  = $prod->libelle;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/fourn/product/categorie.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/product/categorie.php
--- orig/dolibarr/htdocs/fourn/product/categorie.php    2007-01-31 
13:32:14.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/fourn/product/categorie.php       
2007-02-02 15:29:02.000000000 +0100
@@ -33,8 +34,7 @@
  */  
 if ($_GET["id"])
 {           
-  $product = new Product($db);
-  $result = $product->fetch($_GET["id"]);      
+  $product = new Product($db, $_GET["id"]);
 }
 
 llxHeader("","",$langs->trans("CardProduct0"));
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/fourn/product/fiche.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/product/fiche.php
--- orig/dolibarr/htdocs/fourn/product/fiche.php        2007-01-31 
13:32:14.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/fourn/product/fiche.php   
2007-02-02 15:28:38.000000000 +0100
@@ -46,8 +47,7 @@
 
 if ($_GET["action"] == 'fastappro')
 {
-       $product = new Product($db);
-       $product->fetch($_GET["id"]);
+       $product = new Product($db,$_GET["id"]);
        $result = $product->fastappro($user);
        Header("Location: fiche.php?id=".$_GET["id"]);
        exit;
@@ -169,9 +169,7 @@
 if ($_POST["action"] == 'update_price' && 
     $_POST["cancel"] <> $langs->trans("Cancel") && 
$user->rights->produit->creer)
 {
-  $product = new Product($db);
-
-  $result = $product->fetch($_GET["id"]);
+  $product = new Product($db, $_GET["id"]);
 
   $product->price = ereg_replace(" ","",$_POST["price"]);
 
@@ -285,8 +283,7 @@
 
       if ($_GET["action"] <> 're-edit')
        {
-         $product = new Product($db);
-         $result = $product->fetch($_GET["id"]);
+         $product = new Product($db,$_GET["id"]);
        }
 
       if ( $product->id > 0 )
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/fourn/product/photos.php 
/var/www/localhost/htdocs/dolibarr/htdocs/fourn/product/photos.php
--- orig/dolibarr/htdocs/fourn/product/photos.php       2007-01-31 
13:32:14.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/fourn/product/photos.php  
2007-02-02 15:29:30.000000000 +0100
@@ -43,8 +44,7 @@
 {
   if ($_GET["id"])
     {           
-      $product = new Product($db);
-      $result = $product->fetch($_GET["id"]);
+      $product = new Product($db, $_GET["id"]);
 
       $product->add_photo($conf->produit->dir_output, $_FILES['photofile']);
     }
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/includes/modules/commande/pdf_einstein.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/commande/pdf_einstein.modules.php
--- orig/dolibarr/htdocs/includes/modules/commande/pdf_einstein.modules.php     
2007-02-01 09:08:57.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/commande/pdf_einstein.modules.php
        2007-02-02 15:32:30.000000000 +0100
@@ -231,8 +232,7 @@
                     // Si ligne associée à un code produit
                     if ($com->lignes[$i]->fk_product)
                     {
-                        $prodser = new Product($this->db);
-                        $prodser->fetch($com->lignes[$i]->fk_product);
+                        $prodser = new 
Product($this->db,$com->lignes[$i]->fk_product);
 
                                                // On ajoute la ref
                         if ($prodser->ref)
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/includes/modules/facture/pdf_crabe.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/facture/pdf_crabe.modules.php
--- orig/dolibarr/htdocs/includes/modules/facture/pdf_crabe.modules.php 
2007-02-01 09:08:57.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/facture/pdf_crabe.modules.php
    2007-02-02 15:32:41.000000000 +0100
@@ -225,8 +226,7 @@
                     // Si ligne associée à un code produit
                     if ($fac->lignes[$i]->produit_id)
                     {
-                        $prodser = new Product($this->db);
-                        $prodser->fetch($fac->lignes[$i]->produit_id);
+                        $prodser = new 
Product($this->db,$fac->lignes[$i]->produit_id);
 
                                                // On ajoute la ref
                         if ($prodser->ref)
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/includes/modules/facture/pdf_oursin.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/facture/pdf_oursin.modules.php
--- orig/dolibarr/htdocs/includes/modules/facture/pdf_oursin.modules.php        
2006-12-17 13:48:00.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/facture/pdf_oursin.modules.php
   2007-02-02 15:32:53.000000000 +0100
@@ -186,9 +186,8 @@
                if (defined("FACTURE_CODEPRODUITSERVICE") && 
FACTURE_CODEPRODUITSERVICE) {
                  // Affiche code produit si ligne associée à un code produit
 
-                 $prodser = new Product($this->db);
+                 $prodser = new 
Product($this->db,$fac->lignes[$i]->produit_id);
 
-                 $prodser->fetch($fac->lignes[$i]->produit_id);
                  if ($prodser->ref) {
                    $codeproduitservice=" - 
".$langs->transnoentities("ProductCode")." ".$prodser->ref;
                  }
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/includes/modules/propale/pdf_propale_azur.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
--- orig/dolibarr/htdocs/includes/modules/propale/pdf_propale_azur.modules.php  
2007-02-01 09:08:57.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/includes/modules/propale/pdf_propale_azur.modules.php
     2007-02-02 15:33:10.000000000 +0100
@@ -223,8 +224,7 @@
                                        // Si ligne associée à un code produit
                                        if ($propale->lignes[$i]->fk_product)
                                        {
-                                               $prodser = new 
Product($this->db);
-                                               
$prodser->fetch($propale->lignes[$i]->fk_product);
+                                               $prodser = new 
Product($this->db,$propale->lignes[$i]->fk_product);
 
                                                // On ajoute la ref
                                                if ($prodser->ref)
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/livraison/fiche.php 
/var/www/localhost/htdocs/dolibarr/htdocs/livraison/fiche.php
--- orig/dolibarr/htdocs/livraison/fiche.php    2007-01-05 14:23:08.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/livraison/fiche.php       
2007-02-02 15:33:51.000000000 +0100
@@ -274,8 +274,7 @@
          print "<tr $bc[$var]>\n";
          if ($ligne->fk_product > 0)
            {      
-             $product = new Product($db);
-             $product->fetch($ligne->fk_product);
+             $product = new Product($db,$ligne->fk_product);
              
              print '<td>';
              print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$ligne->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.$product->libelle;
@@ -494,8 +493,7 @@
                     print "<tr $bc[$var]>";
                     if ($objp->fk_product > 0)
                     {
-                        $product = new Product($db);
-                        $product->fetch($objp->fk_product);
+                        $product = new Product($db,$objp->fk_product);
     
                         print '<td>';
                         print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.$product->libelle;
@@ -620,8 +618,7 @@
                         print '<td align="left"><a 
href="'.DOL_URL_ROOT.'/livraison/fiche.php?id='.$objp->livraison_id.'">'.img_object($langs->trans("ShowSending"),'sending').'
 '.$objp->ref.'<a></td>';
                         if ($objp->fk_product > 0)
                         {
-                            $product = new Product($db);
-                            $product->fetch($objp->fk_product);
+                            $product = new Product($db,$objp->fk_produc);
     
                             print '<td>';
                             print '<a 
href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$objp->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").'
 '.$product->ref.'</a> - '.$product->libelle;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/livraison/mods/pdf/pdf_typhon.modules.php 
/var/www/localhost/htdocs/dolibarr/htdocs/livraison/mods/pdf/pdf_typhon.modules.php
--- orig/dolibarr/htdocs/livraison/mods/pdf/pdf_typhon.modules.php      
2007-01-05 13:40:45.000000000 +0100
+++ 
/var/www/localhost/htdocs/dolibarr/htdocs/livraison/mods/pdf/pdf_typhon.modules.php
 2007-02-02 15:33:22.000000000 +0100
@@ -211,9 +211,7 @@
                     // Si ligne associée à un code produit
                     if ($lignesdelivery[$i]->fk_product)
                     {
-                        $prodser = new Product($this->db);
-
-                        $prodser->fetch($lignesdelivery[$i]->fk_product);
+                        $prodser = new 
Product($this->db,$lignesdelivery[$i]->fk_product);
                         if ($prodser->ref)
                         {
                             
$libelleproduitservice=$langs->transnoentities("Product")." ".$prodser->ref." - 
".$libelleproduitservice;
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/product/fiche.php 
/var/www/localhost/htdocs/dolibarr/htdocs/product/fiche.php
--- orig/dolibarr/htdocs/product/fiche.php      2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product/fiche.php 2007-02-02 
15:36:00.000000000 +0100
@@ -49,8 +50,7 @@
  */
 if ($_GET["action"] == 'fastappro')
 {
-  $product = new Product($db);
-  $product->fetch($_GET["id"]);
+  $product = new Product($db,$_GET["id"]);
   $result = $product->fastappro($user);
   Header("Location: fiche.php?id=".$_GET["id"]);
   exit;
@@ -239,8 +240,7 @@
 */
 if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && 
$user->rights->produit->supprimer)
 {
-  $product = new Product($db);
-  $product->fetch($_GET["id"]);
+  $product = new Product($db,$_GET["id"]);
   $result = $product->delete($_GET["id"]);
   
   if ($result == 0)
@@ -316,8 +316,7 @@
  */
 if ($_POST["action"] == 'addincommande')
 {
-  $product = new Product($db);
-  $result = $product->fetch($_GET["id"]);
+  $product = new Product($db,$_GET["id"]);
   
   $commande = New Commande($db);
   $commande->fetch($_POST["commandeid"]);
@@ -354,8 +353,7 @@
  */
 if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer)
 {
-  $product = new Product($db);
-  $result = $product->fetch($_GET["id"]);
+  $product = new Product($db,$_GET["id"]);
 
   $facture = New Facture($db);
   $facture->fetch($_POST["factureid"]);
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/product/photos.php 
/var/www/localhost/htdocs/dolibarr/htdocs/product/photos.php
--- orig/dolibarr/htdocs/product/photos.php     2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product/photos.php        
2007-02-02 15:37:35.000000000 +0100
@@ -53,8 +54,7 @@
 {
     if ($_GET["id"])
     {
-        $product = new Product($db);
-        $result = $product->fetch($_GET["id"]);
+        $product = new Product($db,$_GET["id"]);
 
         // if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir 
. "/" . $_FILES['userfile']['name']))
 
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/product/price.php 
/var/www/localhost/htdocs/dolibarr/htdocs/product/price.php
--- orig/dolibarr/htdocs/product/price.php      2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product/price.php 2007-02-02 
15:37:49.000000000 +0100
@@ -51,9 +52,7 @@
 if ($_POST["action"] == 'update_price' && 
     $_POST["cancel"] <> $langs->trans("Cancel") && 
$user->rights->produit->creer)
 {
-  $product = new Product($db);
-  
-  $result = $product->fetch($_GET["id"]);
+  $product = new Product($db,$_GET["id"]);
 
   $product->SetSellprice($_POST["price"], $_POST["price_base_type"]);
 
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright 
orig/dolibarr/htdocs/product/stock/product.php 
/var/www/localhost/htdocs/dolibarr/htdocs/product/stock/product.php
--- orig/dolibarr/htdocs/product/stock/product.php      2007-02-01 
09:08:57.000000000 +0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product/stock/product.php 
2007-02-02 15:38:37.000000000 +0100
@@ -49,8 +50,7 @@
 
 if ($_POST["action"] == "create_stock")
 {
-  $product = new Product($db);
-  $product->id = $_GET["id"];
+  $product = new Product($db,$_GET["id"]);
   $product->create_stock($_POST["id_entrepot"], $_POST["nbpiece"]);
 }
 
@@ -59,8 +59,7 @@
   if (is_numeric($_POST["nbpiece"]))
     {
 
-      $product = new Product($db);
-      $product->id = $_GET["id"];
+      $product = new Product($db,$_GET["id"]);
       $product->correct_stock($user, 
                              $_POST["id_entrepot"], 
                              $_POST["nbpiece"],
@@ -75,8 +74,7 @@
       if (is_numeric($_POST["nbpiece"]))
        {
          
-         $product = new Product($db);
-         $product->id = $_GET["id"];
+         $product = new Product($db,$_GET["id"]);
 
          $product->correct_stock($user, 
                                  $_POST["id_entrepot_source"], 
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/product/traduction.php 
/var/www/localhost/htdocs/dolibarr/htdocs/product/traduction.php
--- orig/dolibarr/htdocs/product/traduction.php 2007-02-01 09:08:57.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product/traduction.php    
2007-02-02 15:34:25.000000000 +0100
@@ -55,8 +56,7 @@
     $_POST["cancel"] != $langs->trans("Cancel") && 
        $user->rights->produit->creer)
 {
-       $product = new Product($db);
-       $product->fetch($_POST["id"]);
+       $product = new Product($db,$_POST["id"]);
        $current_lang = $langs->getDefaultLang();
 
        // update de l'objet
@@ -91,8 +91,7 @@
     $_POST["cancel"] != $langs->trans("Cancel") && 
        $user->rights->produit->creer)
 {
-       $product = new Product($db);
-       $product->fetch($_POST["id"]);
+       $product = new Product($db,$_POST["id"]);
        $current_lang = $langs->getDefaultLang();
        
        foreach ( $product->multilangs as $key => $value ) // enregistrement 
des nouvelles valeurs dans l'objet
diff -bwur --ignore-matching-lines='$Id:' --ignore-matching-lines='$Revision:' 
--ignore-matching-lines=Copyright orig/dolibarr/htdocs/propal.class.php 
/var/www/localhost/htdocs/dolibarr/htdocs/propal.class.php
--- orig/dolibarr/htdocs/propal.class.php       2006-09-19 00:43:45.000000000 
+0200
+++ /var/www/localhost/htdocs/dolibarr/htdocs/propal.class.php  2007-02-02 
15:15:13.000000000 +0100
@@ -142,8 +143,7 @@
                dolibarr_syslog("Propal.class::add_product $idproduct, $qty, 
$remise_percent");
                if ($idproduct > 0)
                {
-                       $prod=new Product($this->db);
-                       $prod->fetch($idproduct);
+                       $prod=new Product($this->db,$idproduct);
        
                        // on ajoute la description du produit si l'option est 
active
                        if ($conf->global->PRODUIT_CHANGE_PROD_DESC)
--- orig/dolibarr/htdocs/product.class.php      2007-02-02 09:12:22.000000000 
+0100
+++ /var/www/localhost/htdocs/dolibarr/htdocs/product.class.php 2007-02-02 
16:27:48.000000000 +0100
@@ -32,7 +33,6 @@
 /**
    \class      Product
    \brief      Classe permettant la gestion des produits prédéfinis
-   \todo comment $typeprodserv
 */
 
 class Product
@@ -72,7 +72,6 @@
   var $stats_facture=array();
   var $multilangs=array();
 
-  var $typeprodserv;
   //! Intitule de l'erreur
   var $error;
   //! Numero de l'erreur
@@ -92,7 +91,7 @@
     global $langs;
     
     $this->db = $DB;
-    $this->id   = $id ;
+    $this->id = 0 ;
     $this->status = 0;
     $this->seuil_stock_alerte = 0;
     
@@ -936,6 +936,10 @@
     $result = $this->db->query($sql) ;
     if ( $result )
       {
+        $num=$this->db->num_rows($result);
+       if ($num != 1) {
+           accessforbidden($langs->trans("NoProductMatching"));
+       }
        $result = $this->db->fetch_array();
        
        $this->id                 = $result["rowid"];

reply via email to

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