diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 56cb195060b..106dbc22bbc 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -251,6 +251,24 @@ function productlot_prepare_head($object)
$head[$h][2] = 'documents';
$h++;
+ // Notes
+ if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
+ $nbNote = 0;
+ if (!empty($object->note_private)) {
+ $nbNote++;
+ }
+ if (!empty($object->note_public)) {
+ $nbNote++;
+ }
+ $head[$h][0] = DOL_URL_ROOT .'/product/stock/productlot_note.php?id=' . $object->id;
+ $head[$h][1] = $langs->trans('Notes');
+ if ($nbNote > 0) {
+ $head[$h][1] .= '' . $nbNote . '';
+ }
+ $head[$h][2] = 'note';
+ $h++;
+ }
+
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
index 2c093019e72..7a94f70f7c5 100644
--- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
+++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
@@ -142,3 +142,6 @@ CREATE TABLE llx_bank_extrafields
)ENGINE=innodb;
ALTER TABLE llx_bank_extrafields ADD INDEX idx_bank_extrafields (fk_object);
+
+ALTER TABLE llx_product_lot ADD COLUMN note_public text DEFAULT NULL after batch;
+ALTER TABLE llx_product_lot ADD COLUMN note_private text DEFAULT NULL after note_public;
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index d2f21ac372e..bfaee702d01 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -102,6 +102,8 @@ class Productlot extends CommonObject
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
+ 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',),
+ 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0, 'validate'=>'1',)
);
/**
@@ -124,6 +126,8 @@ class Productlot extends CommonObject
//public $qc_frequency = '';
public $datec = '';
public $tms = '';
+ public $note_private;
+ public $note_public;
/**
* @var int ID
@@ -295,7 +299,9 @@ class Productlot extends CommonObject
$sql .= " t.tms,";
$sql .= " t.fk_user_creat,";
$sql .= " t.fk_user_modif,";
- $sql .= " t.import_key";
+ $sql .= " t.import_key,";
+ $sql .= " t.note_public,";
+ $sql .= " t.note_private";
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
if ($product_id > 0 && $batch != '') {
$sql .= " WHERE t.batch = '".$this->db->escape($batch)."' AND t.fk_product = ".((int) $product_id);
@@ -329,6 +335,8 @@ class Productlot extends CommonObject
$this->fk_user_creat = $obj->fk_user_creat;
$this->fk_user_modif = $obj->fk_user_modif;
$this->import_key = $obj->import_key;
+ $this->note_public = $obj->note_public;
+ $this->note_private = $obj->note_private;
// Retrieve all extrafield
// fetch optionals attributes and labels
diff --git a/htdocs/product/stock/productlot_note.php b/htdocs/product/stock/productlot_note.php
new file mode 100644
index 00000000000..c8cd43f2091
--- /dev/null
+++ b/htdocs/product/stock/productlot_note.php
@@ -0,0 +1,113 @@
+
+ * Copyright (C) ---Put here your own copyright and developer email---
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see