2
0
forked from Wavyzz/dolibarr

FIX: better error management at product selling price update

This commit is contained in:
Marc de Lima Lucio
2022-03-08 14:49:26 +01:00
parent df9fa39d34
commit e989371651
3 changed files with 48 additions and 15 deletions

View File

@@ -534,7 +534,14 @@ class ProductCombination
$new_price += $variation_price;
}
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
if ($ret < 0) {
$this->db->rollback();
$this->error = $child->error;
$this->errors = $child->errors;
return $ret;
}
}
}
} else {
@@ -556,7 +563,14 @@ class ProductCombination
$new_price += $this->variation_price;
}
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
$ret = $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, 1, $new_npr, $new_psq);
if ($ret < 0) {
$this->db->rollback();
$this->error = $child->error;
$this->errors = $child->errors;
return $ret;
}
}
$this->db->commit();
@@ -565,6 +579,8 @@ class ProductCombination
}
$this->db->rollback();
$this->error = $child->error;
$this->errors = $child->errors;
return -1;
}