FIX prices by customer API

This commit is contained in:
ptibogxiv 2019-11-01 15:36:48 +01:00 committed by GitHub
parent e3b5be7475
commit 0f80ba5353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -445,7 +445,6 @@ class Products extends DolibarrApi
//'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code
);
}
/**
* Get prices per customer for a product
*
@ -471,13 +470,18 @@ class Products extends DolibarrApi
if (! $result ) {
throw new RestException(404, 'Product not found');
}
if ($result < 0) {
throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors));
if ($result > 0) {
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($this->db);
$result = $prodcustprice->fetch_all('', '', 0, 0, array('t.fk_product' => $id));
}
throw new RestException(501, 'Feature not yet available');
//return $result;
if ( empty($prodcustprice->lines)) {
throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($prodcustprice->error), $prodcustprice->errors));
}
return $prodcustprice->lines;
}
/**