diff --git a/htdocs/fourn/product/fourn.php b/htdocs/fourn/product/fourn.php index b500796ced2..cad91bd7233 100644 --- a/htdocs/fourn/product/fourn.php +++ b/htdocs/fourn/product/fourn.php @@ -34,6 +34,19 @@ $user->getrights('produit'); if (!$user->rights->produit->lire) accessforbidden(); +if ($_POST["action"] == 'update' && $_POST["cancel"] <> $langs->trans("Cancel")) +{ + $product = new Product($db); + if( $product->fetch($_GET["id"]) ) + { + $product->update_buyprice($_GET["id_fourn"], '1', $_POST["price"], $user); + } + + Header('Location :fourn.php?id='.$product->id.'&id_fourn='.$_GET["id_fourn"]); +} + + + llxHeader("","",$langs->trans("CardProduct0")); /* @@ -45,16 +58,18 @@ if ($_GET["id"]) { $product = new Product($db); $result = $product->fetch($_GET["id"]); + $fourn = new Fournisseur($db); $result = $fourn->fetch($_GET["id_fourn"]); + + $product->get_buyprice($fourn->id, 1); } if ( $result ) { - if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') - { + /* * En mode visu */ @@ -73,15 +88,34 @@ if ($_GET["id"]) dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); print ''; + + if ($conf->categorie->enabled) + { + print ''; + print ''; + } + print ""; print ''; print ''; - print ''; - + print ''; print ""; print ''; - print ''; - + print ''; + print ''; + print ''; print ''; @@ -140,8 +174,8 @@ if ($_GET["id"]) $db->free($resql); } print '
'; + $cat = new Categorie ($db); + $way = $cat->print_primary_way($product->id," > ",'fourn/product/liste.php'); + if ($way == "") + { + print "Ce produit n'appartient à aucune catégorie"; + } + else + { + print $langs->trans("Categorie")." : "; + print $way; + } + print '
'.$langs->trans("InternalRef").''.$product->ref.'
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("Supplier").''.$fourn->nom_url.'
'.$langs->trans("BuiingPrice").''.price($product->buyprice).'
'.$langs->trans("Description").''.nl2br($product->description).'
'; - print "\n"; - } + + /* * @@ -151,74 +185,29 @@ if ($_GET["id"]) if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer) { - print_fiche_titre('Edition de la fiche '.$types[$product->type].' : '.$product->ref, ""); + $action = 'fourn.php?id='.$product->id.'&id_fourn='.$fourn->id; - if ($mesg) { - print '
'.$mesg.'

'; - } - - print "
\n"; + print ''; print ''; - print ''; - print ''; - print "".''; - print ''; + print '
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'; + print ''; + print ''; - $langs->load("bills"); - print ''; - print ''; - if ($product->type == 0 && defined("MAIN_MODULE_STOCK")) - { - print "".''; - } - else - { - print ''; - } - print ''; + print ''; + + print '"; - if ($product->type == 1) - { - print ''; - } - - print ''; print '
'.$langs->trans("Price").'
'.$langs->trans("VATRate").''; - $html = new Form($db); - print $html->select_tva("tva_tx", $product->tva_tx); - print '
'.$langs->trans("Status").''; - print '
Seuil stock'; - print ''; - print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Ref").'
'.$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 '
'; } - + print "\n"; /* ************************************************************************** */ /* */ /* Barre d'action */ @@ -232,7 +221,7 @@ if ($_GET["id"]) if ( $user->rights->produit->creer) { - print ''.$langs->trans("Edit").''; + print ''.$langs->trans("Edit").''; } }