Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0
This commit is contained in:
commit
44cb60e61d
@ -1116,7 +1116,7 @@ class Product extends CommonObject
|
||||
//If it is a parent product, then we remove the association with child products
|
||||
$prodcomb = new ProductCombination($this->db);
|
||||
|
||||
if ($prodcomb->deleteByFkProductParent($id) < 0) {
|
||||
if ($prodcomb->deleteByFkProductParent($user, $id) < 0) {
|
||||
$error++;
|
||||
$this->errors[] = 'Error deleting combinations';
|
||||
}
|
||||
|
||||
@ -275,10 +275,11 @@ class ProductCombination
|
||||
/**
|
||||
* Deletes all product combinations of a parent product
|
||||
*
|
||||
* @param int $fk_product_parent Rowid of parent product
|
||||
* @param User $user Object user
|
||||
* @param int $fk_product_parent Rowid of parent product
|
||||
* @return int <0 KO >0 OK
|
||||
*/
|
||||
public function deleteByFkProductParent($fk_product_parent)
|
||||
public function deleteByFkProductParent($user, $fk_product_parent)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -289,11 +290,11 @@ class ProductCombination
|
||||
$res = $prodstatic->fetch($prodcomb->fk_product_child);
|
||||
|
||||
if ($res > 0) {
|
||||
$res = $prodcomb->delete();
|
||||
$res = $prodcomb->delete($user);
|
||||
}
|
||||
|
||||
if ($res > 0 && !$prodstatic->isObjectUsed($prodstatic->id)) {
|
||||
$res = $prodstatic->delete();
|
||||
$res = $prodstatic->delete($user);
|
||||
}
|
||||
|
||||
if ($res < 0) {
|
||||
|
||||
@ -95,7 +95,7 @@ if ($_POST) {
|
||||
$delete_prev_comb_res = 1;
|
||||
|
||||
if (!$donotremove) {
|
||||
$delete_prev_comb_res = $combination->deleteByFkProductParent($id);
|
||||
$delete_prev_comb_res = $combination->deleteByFkProductParent($user, $id);
|
||||
}
|
||||
|
||||
//Current combinations will be deleted
|
||||
|
||||
Loading…
Reference in New Issue
Block a user