diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index df796c5a943..ef34dd01718 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -69,170 +69,168 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
llxHeader("","",$langs->trans("CardProduct".$product->type));
-
-
- /*
- * Fiche produit
- */
- if ($_GET["id"])
+/*
+ * Fiche produit
+ */
+if ($_GET["id"])
+{
+
+ if ($_GET["action"] <> 're-edit')
{
-
- if ($_GET["action"] <> 're-edit')
+ $product = new Product($db);
+ $result = $product->fetch($_GET["id"]);
+ }
+
+ if ( $result )
+ {
+
+ if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
{
- $product = new Product($db);
- $result = $product->fetch($_GET["id"]);
- }
-
- if ( $result )
- {
-
- if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
+ /*
+ * En mode visu
+ */
+
+ // Zone recherche
+ print '
';
+ print '
';
+
+ $h=0;
+
+ $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
+ $head[$h][1] = $langs->trans("Card");
+ $h++;
+
+ $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
+ $head[$h][1] = $langs->trans("Price");
+ $h++;
+
+ if($product->type == 0)
{
- /*
- * En mode visu
- */
-
- // Zone recherche
- print '';
- print '
';
-
- $h=0;
-
- $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
- $head[$h][1] = $langs->trans("Card");
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id;
- $head[$h][1] = $langs->trans("Price");
- $h++;
-
- if($product->type == 0)
+ if ($conf->stock->enabled)
{
- if ($conf->stock->enabled)
- {
- $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
- $head[$h][1] = 'Stock';
- $h++;
- }
- $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
- $head[$h][1] = 'Fournisseurs';
- $hselected = $h;
-
+ $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
+ $head[$h][1] = 'Stock';
$h++;
+ }
+ $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
+ $head[$h][1] = 'Fournisseurs';
+ $hselected = $h;
- }
-
- $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
- $head[$h][1] = $langs->trans('Statistics');
$h++;
-
-
- dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
-
-
- print($mesg);
- print '';
- print "";
- print '| '.$langs->trans("Ref").' | '.$product->ref.' | ';
- print '';
- if ($product->envente)
- {
- print $langs->trans("OnSell");
- }
- else
- {
- print $langs->trans("NotOnSell");
- }
- print ' |
';
- print '| '.$langs->trans("Label").' | '.$product->libelle.' |
';
- print '| '.$langs->trans("SellingPrice").' | '.price($product->price).' |
';
- if ($product->type == 0)
- {
- $nblignefour=4;
- }
- else
- {
- $nblignefour=4;
- }
-
- print '| ';
- print $langs->trans("Suppliers").' | ';
- print ''.$langs->trans("Ref").' | ';
- print ''.$langs->trans("Qty").' | ';
- print 'Prix d\'achat | ';
- print '
';
-
- $sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity";
- $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
- $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur as pf";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
- $sql .=" ON pf.fk_soc = pfp.fk_soc AND pf.fk_product = pfp.fk_product";
- $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id;
- $sql .= " ORDER BY lower(s.nom)";
-
- if ( $db->query($sql) )
- {
- $num = $db->num_rows();
- $i = 0;
-
- $var=True;
- while ($i < $num)
- {
- $objp = $db->fetch_object();
- $var=!$var;
- print "";
- print '| '.$objp->nom.' | ';
- print ''.$objp->ref_fourn.' | ';
- print '';
- print $objp->quantity;
- print ' | ';
-
- print '';
- print price($objp->price);
- print '';
- print img_edit(). " | ";
- print '
';
-
- if ($_GET["action"] == 'add_price'
- && $user->rights->produit->creer
- && $_GET["qty"] == $objp->quantity
- && $_GET["id_fourn"] == $objp->idp)
- {
- $langs->load("suppliers");
-
-
- print '';
- }
- $i++;
- }
-
- $db->free();
- }
-
- print '';
- print "
\n";
- print "\n";
+
}
+
+ $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
+ $head[$h][1] = $langs->trans('Statistics');
+ $h++;
+
+
+ dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
+
+
+ print($mesg);
+ print '';
+ print "";
+ print '| '.$langs->trans("Ref").' | '.$product->ref.' | ';
+ print '';
+ if ($product->envente)
+ {
+ print $langs->trans("OnSell");
+ }
+ else
+ {
+ print $langs->trans("NotOnSell");
+ }
+ print ' |
';
+ print '| '.$langs->trans("Label").' | '.$product->libelle.' |
';
+ print '| '.$langs->trans("SellingPrice").' | '.price($product->price).' |
';
+ if ($product->type == 0)
+ {
+ $nblignefour=4;
+ }
+ else
+ {
+ $nblignefour=4;
+ }
+
+ print '| ';
+ print $langs->trans("Suppliers").' | ';
+ print ''.$langs->trans("Ref").' | ';
+ print ''.$langs->trans("Qty").' | ';
+ print 'Prix d\'achat | ';
+ print '
';
+
+ $sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql .= " , ".MAIN_DB_PREFIX."product_fournisseur as pf";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
+ $sql .=" ON pf.fk_soc = pfp.fk_soc AND pf.fk_product = pfp.fk_product";
+ $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id;
+ $sql .= " ORDER BY lower(s.nom), pfp.quantity";
+
+ if ( $db->query($sql) )
+ {
+ $num = $db->num_rows();
+ $i = 0;
+
+ $var=True;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object();
+ $var=!$var;
+ print "";
+ print '| '.$objp->nom.' | ';
+ print ''.$objp->ref_fourn.' | ';
+ print '';
+ print $objp->quantity;
+ print ' | ';
+
+ print '';
+ print price($objp->price);
+ print '';
+ print img_edit(). " | ";
+ print '
';
+
+ if ($_GET["action"] == 'add_price'
+ && $user->rights->produit->creer
+ && $_GET["qty"] == $objp->quantity
+ && $_GET["id_fourn"] == $objp->idp)
+ {
+ $langs->load("suppliers");
+
+
+ print '';
+ }
+ $i++;
+ }
+
+ $db->free();
+ }
+
+ print '';
+ print "
\n";
+ print "\n";
}
}
- else
- {
- print $langs->trans("ErrorUnknown");
- }
+}
+else
+{
+ print $langs->trans("ErrorUnknown");
+}
/* ************************************************************************** */