Fix: add error message

This commit is contained in:
Regis Houssin 2009-12-09 13:42:12 +00:00
parent 987127d634
commit 1a71f873e6
4 changed files with 18 additions and 8 deletions

View File

@ -261,14 +261,15 @@ class ProductFournisseur extends Product
$this->db->begin(); $this->db->begin();
// Supprime prix courant du fournisseur pour cette quantite // 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) if ($this->product_fourn_price_id)
{ {
$sql .= " WHERE rowid = ".$this->product_fourn_price_id; $sql.= " WHERE rowid = ".$this->product_fourn_price_id;
} }
else 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)) if ($this->db->query($sql))

View File

@ -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 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. ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
ProductHasAlreadyReferenceInThisSupplier=This product has already a reference in this supplier ProductHasAlreadyReferenceInThisSupplier=This product has already a reference in this supplier
ReferenceSupplierIsAlreadyAssociatedWithAProduct=This reference provider is already associated with a product
NoRecordedSuppliers=No suppliers recorded NoRecordedSuppliers=No suppliers recorded
SupplierPayment=Supplier payment SupplierPayment=Supplier payment
SuppliersArea=Suppliers area SuppliersArea=Suppliers area

View File

@ -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 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. 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 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 NoRecordedSuppliers=Pas de fournisseurs enregistrés
SupplierPayment=Paiement fournisseur SupplierPayment=Paiement fournisseur
SuppliersArea=Espace fournisseurs SuppliersArea=Espace fournisseurs

View File

@ -124,15 +124,22 @@ if ($_POST["action"] == 'updateprice' && $_POST["cancel"] <> $langs->trans("Canc
$result=$supplier->fetch($_POST["id_fourn"]); $result=$supplier->fetch($_POST["id_fourn"]);
$ret=$product->update_buyprice($_POST["qty"], $_POST["price"], $user, $_POST["price_base_type"], $supplier); $ret=$product->update_buyprice($_POST["qty"], $_POST["price"], $user, $_POST["price_base_type"], $supplier);
if ($ret < 0) if (!$error)
{ {
$error++; if ($ret < 0)
$mesg=$ret.'<div class="error">'.$product->error.'</div>';
if ($ret == -2)
{ {
$mesg='<div class="error">'.$langs->trans("ProductHasAlreadyReferenceInThisSupplier").'</div>'; $error++;
$mesg='<div class="error">'.$product->error.'</div>';
if ($ret == -2)
{
$mesg='<div class="error">'.$langs->trans("ProductHasAlreadyReferenceInThisSupplier").'</div>';
}
} }
} }
else
{
$mesg='<div class="error">'.$langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct").'</div>';
}
} }
else else
{ {