API New can customize reference when addvariant
This commit is contained in:
parent
3aef39c64d
commit
76fd794559
@ -1328,11 +1328,12 @@ class Products extends DolibarrApi
|
||||
*
|
||||
* "features" is a list of attributes pairs id_attribute=>id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||
*
|
||||
* @param int $id ID of Product
|
||||
* @param float $weight_impact Weight impact of variant
|
||||
* @param float $price_impact Price impact of variant
|
||||
* @param bool $price_impact_is_percent Price impact in percent (true or false)
|
||||
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||
* @param int $id ID of Product
|
||||
* @param float $weight_impact Weight impact of variant
|
||||
* @param float $price_impact Price impact of variant
|
||||
* @param bool $price_impact_is_percent Price impact in percent (true or false)
|
||||
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
|
||||
* @param bool|string $reference Customized reference of variant
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException
|
||||
@ -1341,7 +1342,7 @@ class Products extends DolibarrApi
|
||||
*
|
||||
* @url POST {id}/variants
|
||||
*/
|
||||
public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features)
|
||||
public function addVariant($id, $weight_impact, $price_impact, $price_impact_is_percent, $features, $reference = false)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->produit->creer) {
|
||||
throw new RestException(401);
|
||||
@ -1373,7 +1374,7 @@ class Products extends DolibarrApi
|
||||
$prodcomb = new ProductCombination($this->db);
|
||||
if (! $prodcomb->fetchByProductCombination2ValuePairs($id, $features))
|
||||
{
|
||||
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact);
|
||||
$result = $prodcomb->createProductCombination(DolibarrApiAccess::$user, $this->product, $features, array(), $price_impact_is_percent, $price_impact, $weight_impact, $reference);
|
||||
if ($result > 0)
|
||||
{
|
||||
return $result;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user