From 1a71f873e65e2b8edc2d33239b04756319aee10d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 9 Dec 2009 13:42:12 +0000 Subject: [PATCH] Fix: add error message --- htdocs/fourn/fournisseur.product.class.php | 7 ++++--- htdocs/langs/en_US/suppliers.lang | 1 + htdocs/langs/fr_FR/suppliers.lang | 1 + htdocs/product/fournisseurs.php | 17 ++++++++++++----- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/fournisseur.product.class.php b/htdocs/fourn/fournisseur.product.class.php index 434b629120c..dac95cd5851 100644 --- a/htdocs/fourn/fournisseur.product.class.php +++ b/htdocs/fourn/fournisseur.product.class.php @@ -261,14 +261,15 @@ class ProductFournisseur extends Product $this->db->begin(); // Supprime prix courant du fournisseur pour cette quantite - $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price "; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price"; if ($this->product_fourn_price_id) { - $sql .= " WHERE rowid = ".$this->product_fourn_price_id; + $sql.= " WHERE rowid = ".$this->product_fourn_price_id; } else { - $sql .= " WHERE fk_product_fournisseur = ".$this->product_fourn_id." AND quantity = ".$qty; + $sql.= " WHERE fk_product_fournisseur = ".$this->product_fourn_id; + $sql.= " AND quantity = ".$qty; } if ($this->db->query($sql)) diff --git a/htdocs/langs/en_US/suppliers.lang b/htdocs/langs/en_US/suppliers.lang index 26f994b8e30..933cbc1a84c 100644 --- a/htdocs/langs/en_US/suppliers.lang +++ b/htdocs/langs/en_US/suppliers.lang @@ -17,6 +17,7 @@ ChangeSupplierPrice=Change supplier price ErrorQtyTooLowForThisSupplier=Quantity too low for this supplier or no price defined on this product for this supplier ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. ProductHasAlreadyReferenceInThisSupplier=This product has already a reference in this supplier +ReferenceSupplierIsAlreadyAssociatedWithAProduct=This reference provider is already associated with a product NoRecordedSuppliers=No suppliers recorded SupplierPayment=Supplier payment SuppliersArea=Suppliers area diff --git a/htdocs/langs/fr_FR/suppliers.lang b/htdocs/langs/fr_FR/suppliers.lang index 52c194b81ec..5975e7fe893 100644 --- a/htdocs/langs/fr_FR/suppliers.lang +++ b/htdocs/langs/fr_FR/suppliers.lang @@ -17,6 +17,7 @@ ChangeSupplierPrice=Modifier prix fournisseur ErrorQtyTooLowForThisSupplier=Quantité insuffisante pour ce fournisseur ou aucun tarif défini sur ce produit pour ce fournisseur ErrorSupplierCountryIsNotDefined=Le pays de ce fournisseur n'est pas défini. Corriger sur sa fiche. ProductHasAlreadyReferenceInThisSupplier=Ce produit a déjà une référence chez ce fournisseur +ReferenceSupplierIsAlreadyAssociatedWithAProduct=Cette référence fournisseur est déjà associée à un produit NoRecordedSuppliers=Pas de fournisseurs enregistrés SupplierPayment=Paiement fournisseur SuppliersArea=Espace fournisseurs diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 845f392b4e8..f1c034c5f1b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -124,15 +124,22 @@ if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Canc $result=$supplier->fetch($_POST["id_fourn"]); $ret=$product->update_buyprice($_POST["qty"], $_POST["price"], $user, $_POST["price_base_type"], $supplier); - if ($ret < 0) + if (!$error) { - $error++; - $mesg=$ret.'
'.$product->error.'
'; - if ($ret == -2) + if ($ret < 0) { - $mesg='
'.$langs->trans("ProductHasAlreadyReferenceInThisSupplier").'
'; + $error++; + $mesg='
'.$product->error.'
'; + if ($ret == -2) + { + $mesg='
'.$langs->trans("ProductHasAlreadyReferenceInThisSupplier").'
'; + } } } + else + { + $mesg='
'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct").'
'; + } } else {