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();
// 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))

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
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

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
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

View File

@ -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.'<div class="error">'.$product->error.'</div>';
if ($ret == -2)
if ($ret < 0)
{
$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
{