diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 87291071162..267121015ab 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -253,6 +253,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 9b0018b124f..618e001b21c 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
@@ -145,6 +145,9 @@ CREATE TABLE llx_bank_extrafields
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;
+
ALTER TABLE llx_user CHANGE COLUMN note note_private text;
UPDATE llx_c_effectif SET code='EF101-500', libelle='101 - 500' WHERE code='EF100-500';
diff --git a/htdocs/install/mysql/tables/llx_product_lot.sql b/htdocs/install/mysql/tables/llx_product_lot.sql
index 162f1c6c122..4e6914884ac 100644
--- a/htdocs/install/mysql/tables/llx_product_lot.sql
+++ b/htdocs/install/mysql/tables/llx_product_lot.sql
@@ -22,6 +22,8 @@ CREATE TABLE llx_product_lot (
entity integer DEFAULT 1,
fk_product integer NOT NULL, -- Id of product
batch varchar(128) DEFAULT NULL, -- Lot or serial number
+ note_public text DEFAULT NULL,
+ note_private text DEFAULT NULL,
eatby date DEFAULT NULL, -- Eatby date
sellby date DEFAULT NULL, -- Sellby date
eol_date datetime NULL,
diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php
index d2f21ac372e..7009d0d55fc 100644
--- a/htdocs/product/stock/class/productlot.class.php
+++ b/htdocs/product/stock/class/productlot.class.php
@@ -101,7 +101,7 @@ class Productlot extends CommonObject
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
'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),
+ 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000)
);
/**
@@ -295,7 +295,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 +331,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