From 71645f76fcc20b474af4a3914ba3410c3c648c7e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 2 Dec 2006 14:13:57 +0000 Subject: [PATCH] Possibilite d'avoir un prix d'achat = 0 --- htdocs/product/fournisseurs.php | 164 ++++++++++++++++---------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 8e73875aeb3..7b46e674004 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -87,62 +87,62 @@ if ($_GET["action"] == 'remove_fourn') if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel")) { - $product = new Product($db); - if( $product->fetch($_GET["id"]) ) + $product = new Product($db); + if( $product->fetch($_GET["id"]) ) { - $db->begin(); - - $error=0; - - if ($_POST["ref_fourn"]) + $db->begin(); + + $error=0; + + if ($_POST["ref_fourn"]) { - $ret=$product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]); - if ($ret < 0) - { - $error++; - $mesg='
'.$product->error.'
'; - } + $ret=$product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]); + if ($ret < 0) + { + $error++; + $mesg='
'.$product->error.'
'; + } } - else + else { - $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Ref")).'
'; + $error++; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Ref")).'
'; } - - if ($_POST["qty"]) + + if ($_POST["qty"]) { - if ($_POST["price"] > 0) - { - $ret=$product->update_buyprice($_POST["id_fourn"], $_POST["qty"], $_POST["price"], $user); - if ($ret < 0) - { - $error++; - $mesg='
'.$product->error.'
'; - if ($ret == -2) - { - $mesg='
'.$langs->trans("ProductHasAlreadyReferenceInThisSupplier").'
'; - } - } - } + if ($_POST["price"] >= 0) + { + $ret=$product->update_buyprice($_POST["id_fourn"], $_POST["qty"], $_POST["price"], $user); + if ($ret < 0) + { + $error++; + $mesg='
'.$product->error.'
'; + if ($ret == -2) + { + $mesg='
'.$langs->trans("ProductHasAlreadyReferenceInThisSupplier").'
'; + } + } + } else - { - $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Price")).'
'; - } + { + $error++; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Price")).'
'; + } } - else + else { - $error++; - $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Qty")).'
'; + $error++; + $mesg='
'.$langs->trans("ErrorFieldRequired",$langs->trans("Qty")).'
'; } - - if (! $error) + + if (! $error) { - $db->commit(); - } - else { - $db->rollback(); + $db->commit(); } + else { + $db->rollback(); + } } } @@ -215,45 +215,45 @@ if ($_GET["id"] || $_GET["ref"]) // Formulaire ajout prix - if ($_GET["action"] == 'add_price' && $user->rights->produit->creer) - { - $langs->load("suppliers"); - - if ($_GET["id_fourn"]) { - print_fiche_titre($langs->trans("ChangeSupplierPrice")); - } else { - print_fiche_titre($langs->trans("AddSupplierPrice")); - } - print ''; - print ''; - print ''; - - if ($_GET["id_fourn"]) { - print ''; - $product->fetch_fourn_data($_GET["id_fourn"]); - print ''; - } else { - print ''; - print ''; + if ($_GET["action"] == 'add_price' && $user->rights->produit->creer) + { + $langs->load("suppliers"); + + if ($_GET["id_fourn"]) { + print_fiche_titre($langs->trans("ChangeSupplierPrice")); + } else { + print_fiche_titre($langs->trans("AddSupplierPrice")); + } + print '
'.$langs->trans("Supplier").''; - $html=new Form($db); - $html->select_societes('','id_fourn','fournisseur=1'); - print '
'.$langs->trans("Ref").''; - print ''; - print '
'; + print ''; + print ''; + + if ($_GET["id_fourn"]) { + print ''; + $product->fetch_fourn_data($_GET["id_fourn"]); + print ''; + } else { + print ''; + print ''; } - - print ''; - $quantity = $_GET["qty"] ? $_GET["qty"] : "1"; - print ''; - print ''; - print ''; - - print ''; - print ''; - print '
'.$langs->trans("Supplier").''; + $html=new Form($db); + $html->select_societes('','id_fourn','fournisseur=1'); + print '
'.$langs->trans("Ref").''; + print ''; + print '
'.$langs->trans("Qty").''.$langs->trans("Price").'
 '; - print '
'; - } - + + print ''.$langs->trans("Qty").''; + $quantity = $_GET["qty"] ? $_GET["qty"] : "1"; + print ''; + print ''.$langs->trans("Price").''; + print ''; + + print ' '; + print ''; + print ''; + print ''; + } + /* ************************************************************************** */ /* */ /* Barre d'action */