diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 711707414a2..c15c074a351 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2847,12 +2847,14 @@ abstract class CommonObject
dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR);
return -2;
}
+
+ $newsuffix = $suffix;
+
// Special cas
- //var_dump($this->table_element);exit;
- if ($this->table_element == 'product') $suffix = '';
+ if ($this->table_element == 'product' && $newsuffix == '_private') $newsuffix = '';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
- $sql .= " SET note".$suffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
+ $sql .= " SET note".$newsuffix." = ".(!empty($note) ? ("'".$this->db->escape($note)."'") : "NULL");
$sql .= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment')) ? "fk_user_mod" : "fk_user_modif")." = ".$user->id;
$sql .= " WHERE rowid =".$this->id;
diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php
index f387725bece..e646be4842a 100644
--- a/htdocs/core/tpl/notes.tpl.php
+++ b/htdocs/core/tpl/notes.tpl.php
@@ -87,17 +87,14 @@ else $typeofdata = 'textarea:12:95%';
print ''."\n";
print '
'."\n";
-if ($module != 'product') {
- // No public note yet on products
- print '
'."\n";
- print '
'."\n";
- print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
- print '
'."\n";
- print '
'."\n";
- print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
- print '
'."\n";
- print '
'."\n";
-}
+print '
'."\n";
+print '
'."\n";
+print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
+print '
'."\n";
+print '
'."\n";
+print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
+print '
'."\n";
+print '
'."\n";
if (empty($user->socid)) {
// Private notes (always hidden to external users)
print '
'."\n";
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 28ca230a56b..055a0702cab 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2025,7 +2025,7 @@ class Product extends CommonObject
return -1;
}
- $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,";
+ $sql = "SELECT rowid, ref, ref_ext, label, description, url, note_public, note as note_private, customcode, fk_country, price, price_ttc,";
$sql .= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,";
$sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,";
$sql .= " length, length_units, width, width_units, height, height_units,";
@@ -2061,8 +2061,9 @@ class Product extends CommonObject
$this->label = $obj->label;
$this->description = $obj->description;
$this->url = $obj->url;
- $this->note_private = $obj->note_private;
- $this->note = $obj->note_private; // deprecated
+ $this->note_public = $obj->note_public;
+ $this->note_private = $obj->note_private;
+ $this->note = $obj->note_private; // deprecated
$this->type = $obj->fk_product_type;
$this->status = $obj->tosell;