New: Update product type with update method

This commit is contained in:
Cédric 2019-10-14 22:22:20 +02:00 committed by GitHub
parent 0d4866c38c
commit 2257706a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,7 +247,12 @@ class Products extends DolibarrApi
$this->product->$field = $value; $this->product->$field = $value;
} }
$result = $this->product->update($id, DolibarrApiAccess::$user, 1, 'update'); $updatetype = false;
if ($this->product->type != $oldproduct->type && ($this->product->isProduct() || $this->product->isService())) {
$updatetype = true;
}
$result = $this->product->update($id, DolibarrApiAccess::$user, 1, 'update', $updatetype);
// If price mode is 1 price per product // If price mode is 1 price per product
if ($result > 0 && ! empty($conf->global->PRODUCT_PRICE_UNIQ)) { if ($result > 0 && ! empty($conf->global->PRODUCT_PRICE_UNIQ)) {