diff --git a/htdocs/fourn/product/fiche.php b/htdocs/fourn/product/fiche.php index 0a92f92f39f..592f9863b6b 100644 --- a/htdocs/fourn/product/fiche.php +++ b/htdocs/fourn/product/fiche.php @@ -199,10 +199,8 @@ if ($_POST["cancel"] == $langs->trans("Cancel")) } // Le produit n'est pas encore chargé a ce stade -//llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct0")); - /* * Création du produit * @@ -291,7 +289,7 @@ else $result = $product->fetch($_GET["id"]); } - if ( $result ) + if ( $product->id > 0 ) { if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') @@ -410,16 +408,16 @@ else { $dur=array("d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); } - else { - $dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); - } + else + { + $dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); + } print $langs->trans($dur[$product->duration_unit])." "; - + print ''; } print "
\n"; - - + print ''; print ''; @@ -430,8 +428,9 @@ else $sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON s.idp = pfp.fk_soc AND pfp.fk_product =".$product->id; - $sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON s.idp = pfp.fk_soc"; + $sql .= " AND pfp.fk_product =".$product->id; + $sql .= " WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id; $sql .= " ORDER BY pfp.price ASC, lower(s.nom)"; if ( $db->query($sql) ) @@ -460,147 +459,154 @@ else $db->free(); } print '
'; print $langs->trans("Suppliers").'
'; - print "\n"; - } + + + /* + * Ajouter un fournisseur + * + */ + if ($_GET["action"] == 'ajout_fourn' && $user->rights->produit->creer) + { + $langs->load("suppliers"); + + print_titre($langs->trans("AddSupplier")); + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.$langs->trans("Suppliers").'
'.$langs->trans("SupplierRef").'
'; + print ' '; + print '
'; + print '
'; + } + } /* - * Ajouter un fournisseur + * + * Fiche en mode edition * */ - if ($_GET["action"] == 'ajout_fourn' && $user->rights->produit->creer) + if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer) { - $langs->load("suppliers"); - - print_titre($langs->trans("AddSupplier")); - print '
'; - print ''; - print ''; - print ''; - print '
'.$langs->trans("Suppliers").''; + print ''; + print ''; + print "".''; + print ''; + + + if ($product->type == 0 && defined("MAIN_MODULE_STOCK")) + { + print "".''; } - print ''; - print ''; - print '"; + + if ($product->type == 1) + { + print ''; + } + + print ''; print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
Seuil stock'; + print ''; + print '
'.$langs->trans("Ref").'
'; - print ' '; + else + { + print ''; + } + print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Duration").''; + print '  '; + print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); + print '  '; + print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); + print '  '; + print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); + print '  '; + print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); + + print '
 '; print '
'; print ''; - } - } - - /* - * - * Fiche en mode edition - * - */ - if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer) - { - - print_fiche_titre('Edition de la fiche '.$types[$product->type].' : '.$product->ref, ""); - - if ($mesg) { - print '
'.$mesg.'

'; - } + } - print "
\n"; - print ''; - print ''; - print ''; - print "".''; - print ''; - - - if ($product->type == 0 && defined("MAIN_MODULE_STOCK")) + + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ + + print "\n
\n"; + + if ($_GET["action"] == '') { - print "
".''; + + print ''.$langs->trans("AddSupplier").''; + + if ($product->type == 0 && $user->rights->produit->commander && $num_fournisseur == 1) + { + print ''; + print $langs->trans("Order").''; + } + + if ( $user->rights->produit->creer) + { + print ''.$langs->trans("Edit").''; + } + + if ($product->type == 0 && $conf->stock->enabled) + { + print ''.$langs->trans("CorrectStock").''; + } } - else - { - print ''; - } - print '"; - - if ($product->type == 1) - { - print ''; - } - - print ''; - print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
Seuil stock'; - print ''; - print '
'.$langs->trans("Description").''; - print '
'.$langs->trans("Duration").''; - print '  '; - print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); - print '  '; - print 'duration_unit=='w'?' checked':'').'>'.$langs->trans("Week"); - print '  '; - print 'duration_unit=='m'?' checked':'').'>'.$langs->trans("Month"); - print '  '; - print 'duration_unit=='y'?' checked':'').'>'.$langs->trans("Year"); - - print '
 '; - print '
'; - print '
'; + + print "\n\n"; + } + else + { + print $langs->trans("BadId"); + } } else { - print $langs->trans("ErrorUnknown"); + print $langs->trans("BadId"); } } - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print "\n
\n"; - -if ($_GET["action"] == '') -{ - - print ''.$langs->trans("AddSupplier").''; - - if ($product->type == 0 && $user->rights->produit->commander && $num_fournisseur == 1) - { - print ''; - print $langs->trans("Order").''; - } - - if ( $user->rights->produit->creer) - { - print ''.$langs->trans("Edit").''; - } - - if ($product->type == 0 && $conf->stock->enabled) - { - print ''.$langs->trans("CorrectStock").''; - } -} - -print "\n
\n"; - $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$");