diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index edd138c1273..2198336878b 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -93,30 +93,48 @@ if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Canc
$error=0;
- if ($_POST["ref_fourn"]) {
- $ret=$product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]);
- if ($ret < 0) {
- $error++;
- $mesg='
'.$product->error.'
';
- }
+ if ($_POST["ref_fourn"])
+ {
+ $ret=$product->add_fournisseur($user, $_POST["id_fourn"], $_POST["ref_fourn"]);
+ if ($ret < 0)
+ {
+ $error++;
+ $mesg=''.$product->error.'
';
+ }
}
- else {
- $error++;
- $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Ref")).'
';
+ else
+ {
+ $error++;
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Ref")).'
';
}
- if ($_POST["qty"] && $_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["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").'
';
+ }
+ }
+ }
+ else
+ {
+ $error++;
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Price")).'
';
+ }
}
-
+ else
+ {
+ $error++;
+ $mesg=''.$langs->trans("ErrorFieldRequired",$langs->trans("Qty")).'
';
+ }
+
if (! $error)
{
$db->commit();