diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql
index 287c3bb6aaa..cf99009100e 100644
--- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql
+++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql
@@ -9,8 +9,8 @@
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
--- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
--- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
+-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
+-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
@@ -441,4 +441,13 @@ ALTER TABLE llx_extrafields MODIFY COLUMN list VARCHAR(128);
UPDATE llx_rights_def set module = 'asset' where module = 'assets';
-update llx_c_email_templates set lang = '' where lang IS NULL;
+ALTER TABLE llx_c_accounting_category ADD COLUMN entity integer NOT NULL DEFAULT 1 AFTER rowid;
+-- VMYSQL4.1 DROP INDEX uk_c_accounting_category on llx_c_accounting_category
+-- VPGSQL8.2 DROP INDEX uk_c_accounting_category
+ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code,entity);
+-- VMYSQL4.1 DROP INDEX uk_accounting_journal_code on llx_accounting_journal
+-- VPGSQL8.2 DROP INDEX uk_accounting_journal_code
+ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code (code,entity);
+
+UPDATE llx_c_email_templates SET lang = '' WHERE lang IS NULL;
+
diff --git a/htdocs/install/mysql/tables/llx_accounting_journal.key.sql b/htdocs/install/mysql/tables/llx_accounting_journal.key.sql
index e5083aa83d7..701c39e06a2 100644
--- a/htdocs/install/mysql/tables/llx_accounting_journal.key.sql
+++ b/htdocs/install/mysql/tables/llx_accounting_journal.key.sql
@@ -17,4 +17,4 @@
-- ===========================================================================
-ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code (code);
+ALTER TABLE llx_accounting_journal ADD UNIQUE INDEX uk_accounting_journal_code (code,entity);
diff --git a/htdocs/install/mysql/tables/llx_c_accounting_category.key.sql b/htdocs/install/mysql/tables/llx_c_accounting_category.key.sql
index 6b2d520a156..be927f6e761 100644
--- a/htdocs/install/mysql/tables/llx_c_accounting_category.key.sql
+++ b/htdocs/install/mysql/tables/llx_c_accounting_category.key.sql
@@ -17,5 +17,5 @@
-- Table with category for accounting account
-- ===================================================================
-ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code);
+ALTER TABLE llx_c_accounting_category ADD UNIQUE INDEX uk_c_accounting_category(code,entity);
diff --git a/htdocs/install/mysql/tables/llx_c_accounting_category.sql b/htdocs/install/mysql/tables/llx_c_accounting_category.sql
index 253ff6aef46..9df9a9d6ab0 100644
--- a/htdocs/install/mysql/tables/llx_c_accounting_category.sql
+++ b/htdocs/install/mysql/tables/llx_c_accounting_category.sql
@@ -22,6 +22,7 @@
CREATE TABLE llx_c_accounting_category (
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ entity integer NOT NULL DEFAULT 1,
code varchar(16) NOT NULL,
label varchar(255) NOT NULL,
range_account varchar(255) NOT NULL, -- Comment
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 72a7327a1a1..eaea0dc420c 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1581,6 +1581,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
if ($helpbaseurl && $helppage)
{
$text='';
+ if(!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
+ $langs->load('admin');
+ $appli .= ' ' . $langs->trans("Database") . ': ' . $db->database_name;
+ }
$title=$appli.' ';
$title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage,'_',' ')).'"';