diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7465cdcba7c..f3e34486f9e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1457,7 +1457,16 @@ abstract class CommonObject { if ($trigkey) { - $result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors + // call trigger with updated object values + if (empty($this->fields) && method_exists($this, 'fetch')) + { + $result = $this->fetch($id); + } + else + { + $result = $this->fetchCommon($id); + } + if ($result >= 0) $result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors if ($result < 0) $error++; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 34df9ae725c..03cfbc7f841 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -167,7 +167,7 @@ if (empty($reshook)) if ($result >= 0) { - $result = $object->setValueFrom('barcode', GETPOST('barcode')); + $result = $object->setValueFrom('barcode', GETPOST('barcode'), '', null, 'text', '', $user, 'PRODUCT_MODIFY'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; }