mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
fix: update setcost_price in htdocs/product/fournisseurs.php (#26700)
* fix: update setcost_price in htdocs/product/fournisseurs.php * bettre fix --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
@@ -738,7 +738,8 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
} else {
|
||||
if ($object->id > 0) {
|
||||
$object->oldcopy = clone $object;
|
||||
//Need dol_clone methode 1 (same object class) because update product use hasbatch() method on oldcopy
|
||||
$object->oldcopy = dol_clone($object, 1);
|
||||
|
||||
if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
|
||||
$object->ref = $ref;
|
||||
|
||||
@@ -1149,9 +1149,8 @@ class Product extends CommonObject
|
||||
if ($result >= 0) {
|
||||
// $this->oldcopy should have been set by the caller of update (here properties were already modified)
|
||||
if (empty($this->oldcopy)) {
|
||||
$this->oldcopy = dol_clone($this);
|
||||
$this->oldcopy = dol_clone($this, 1);
|
||||
}
|
||||
|
||||
// Test if batch management is activated on existing product
|
||||
// If yes, we create missing entries into product_batch
|
||||
if ($this->hasbatch() && !$this->oldcopy->hasbatch()) {
|
||||
|
||||
@@ -141,7 +141,8 @@ if (empty($reshook)) {
|
||||
if ($action == 'setcost_price') {
|
||||
if ($id) {
|
||||
$result = $object->fetch($id);
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
//Need dol_clone methode 1 (same object class) because update product use hasbatch method on oldcopy
|
||||
$object->oldcopy = dol_clone($object, 1);
|
||||
$object->cost_price = price2num($cost_price);
|
||||
$result = $object->update($object->id, $user);
|
||||
if ($result > 0) {
|
||||
|
||||
Reference in New Issue
Block a user