diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index 9c9d9929f46..9b455851507 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -140,15 +140,16 @@ class ProductAttributeValue /** * Creates a value for a product attribute * - * @return int <0 KO >0 OK + * @param User $user Object user + * @return int <0 KO >0 OK */ - public function create() + public function create(User $user) { if (!$this->fk_product_attribute) { return -1; } - //Ref must be uppercase + // Ref must be uppercase $this->ref = strtoupper($this->ref); $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_attribute_value (fk_product_attribute, ref, value, entity) diff --git a/htdocs/variants/create_val.php b/htdocs/variants/create_val.php index 7c624765e32..b290182a042 100644 --- a/htdocs/variants/create_val.php +++ b/htdocs/variants/create_val.php @@ -65,7 +65,7 @@ if ($action == 'add') $objectval->ref = $ref; $objectval->value = $value; - if ($objectval->create() > 0) { + if ($objectval->create($user) > 0) { setEventMessage($langs->trans('RecordSaved')); header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$object->id); exit();