addPurchasePrice Update the price if already exist

This commit is contained in:
Cédric 2019-12-01 14:56:39 +01:00 committed by GitHub
parent 1bad6f5c9c
commit 7b295bf738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -633,7 +633,7 @@ class Products extends DolibarrApi
}
/**
* Add purchase prices for a product.
* Add/Update purchase prices for a product.
*
* @param int $id ID of Product
* @param float $qty Min quantity for which price is valid
@ -681,7 +681,7 @@ class Products extends DolibarrApi
}
$result = $this->productsupplier->add_fournisseur(DolibarrApiAccess::$user, $fourn_id, $ref_fourn, $qty);
if ($result <= 0) {
if ($result < 0) {
throw new RestException(500, "Error adding supplier to product : ".$this->db->lasterror());
}