mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +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 = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
if ($object->id > 0) {
|
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)) {
|
if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
|
||||||
$object->ref = $ref;
|
$object->ref = $ref;
|
||||||
|
|||||||
@@ -1149,9 +1149,8 @@ class Product extends CommonObject
|
|||||||
if ($result >= 0) {
|
if ($result >= 0) {
|
||||||
// $this->oldcopy should have been set by the caller of update (here properties were already modified)
|
// $this->oldcopy should have been set by the caller of update (here properties were already modified)
|
||||||
if (empty($this->oldcopy)) {
|
if (empty($this->oldcopy)) {
|
||||||
$this->oldcopy = dol_clone($this);
|
$this->oldcopy = dol_clone($this, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if batch management is activated on existing product
|
// Test if batch management is activated on existing product
|
||||||
// If yes, we create missing entries into product_batch
|
// If yes, we create missing entries into product_batch
|
||||||
if ($this->hasbatch() && !$this->oldcopy->hasbatch()) {
|
if ($this->hasbatch() && !$this->oldcopy->hasbatch()) {
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ if (empty($reshook)) {
|
|||||||
if ($action == 'setcost_price') {
|
if ($action == 'setcost_price') {
|
||||||
if ($id) {
|
if ($id) {
|
||||||
$result = $object->fetch($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);
|
$object->cost_price = price2num($cost_price);
|
||||||
$result = $object->update($object->id, $user);
|
$result = $object->update($object->id, $user);
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user