Merge pull request #12046 from frederic34/apisupplierproduct
api supplier price delete
This commit is contained in:
commit
80cbc09f21
@ -18,6 +18,7 @@
|
|||||||
use Luracast\Restler\RestException;
|
use Luracast\Restler\RestException;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +42,11 @@ class Products extends DolibarrApi
|
|||||||
*/
|
*/
|
||||||
public $product;
|
public $product;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ProductFournisseur $productsupplier {@type ProductFournisseur}
|
||||||
|
*/
|
||||||
|
public $productsupplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
@ -49,6 +55,7 @@ class Products extends DolibarrApi
|
|||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->product = new Product($this->db);
|
$this->product = new Product($this->db);
|
||||||
|
$this->productsupplier = new ProductFournisseur($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -475,7 +482,7 @@ class Products extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @url DELETE {id}/purchase_prices/{priceid}
|
* @url DELETE {id}/purchase_prices/{priceid}
|
||||||
*
|
*
|
||||||
* @return array
|
* @return int
|
||||||
*
|
*
|
||||||
* @throws 401
|
* @throws 401
|
||||||
* @throws 404
|
* @throws 404
|
||||||
@ -494,13 +501,13 @@ class Products extends DolibarrApi
|
|||||||
if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
|
if(! DolibarrApi::_checkAccessToResource('product', $this->product->id)) {
|
||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
$resultsupplier = 0;
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->product = new ProductFournisseur($this->db);
|
$this->productsupplier->fetch($id);
|
||||||
$this->product->fetch($id);
|
$resultsupplier = $this->product->remove_product_fournisseur_price($priceid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->product->remove_product_fournisseur_price($priceid);
|
return $resultsupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -636,12 +643,11 @@ class Products extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$this->product = new ProductFournisseur($this->db);
|
$this->productsupplier->fetch($id, $ref);
|
||||||
$this->product->fetch($id, $ref);
|
$this->productsupplier->list_product_fournisseur_price($id, '', '', 0, 0);
|
||||||
$this->product->list_product_fournisseur_price($id, '', '', 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->product);
|
return $this->_cleanObjectDatas($this->productsupplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user