diff --git a/htdocs/core/lib/phpsessionindb.lib.php b/htdocs/core/lib/phpsessionindb.lib.php index f38123e2a7c..9dd806d86fc 100644 --- a/htdocs/core/lib/phpsessionindb.lib.php +++ b/htdocs/core/lib/phpsessionindb.lib.php @@ -22,9 +22,14 @@ * \brief Set function handlers for PHP session management in DB. */ -// The session handler file must be included just after the call of the master.inc.php into main.inc.php +// This session handler file must be included just after the call of the master.inc.php into main.inc.php // The $conf is already defined from conf.php file. -// To use it set in your PHP.ini: session.save_handler = user +// To use it set +// - create table ll_session from the llx_session-disabled.sql file +// - uncomment the include DOL_DOCUMENT_ROOT.'/core/lib/phpsessionindb.inc.php into main.inc.php +// - in your PHP.ini, set: session.save_handler = user +// The session_set_save_handler() at end of this fille will replace default session management. + /** * The session open handler called by PHP whenever a session is initialized. diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php index 23a0f892014..bfaf11dbf4c 100644 --- a/htdocs/core/modules/modDynamicPrices.class.php +++ b/htdocs/core/modules/modDynamicPrices.class.php @@ -84,4 +84,27 @@ class modDynamicPrices extends DolibarrModules $this->rights_class = 'dynamicprices'; $r = 0; } + + /** + * Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories. + * + * @param string $options Options + * @return int 1 if OK, 0 if KO + */ + public function init($options = '') + { + $result = $this->_load_tables('/install/mysql/', 'dynamicprices'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + + // Remove permissions and default values + $this->remove($options); + + $sql = array(); + + return $this->_init($sql, $options); + } } diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 536aabd086c..a1ab6b43026 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -245,6 +245,11 @@ class modExpenseReport extends DolibarrModules { global $conf; + $result = $this->_load_tables('/install/mysql/', 'expensereport'); + if ($result < 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + // Remove permissions and default values $this->remove($options); diff --git a/htdocs/install/mysql/data/llx_c_exp_tax_cat.sql b/htdocs/install/mysql/data/llx_c_exp_tax_cat-expensereport.sql similarity index 100% rename from htdocs/install/mysql/data/llx_c_exp_tax_cat.sql rename to htdocs/install/mysql/data/llx_c_exp_tax_cat-expensereport.sql diff --git a/htdocs/install/mysql/data/llx_c_exp_tax_range.sql b/htdocs/install/mysql/data/llx_c_exp_tax_range-expensereport.sql similarity index 100% rename from htdocs/install/mysql/data/llx_c_exp_tax_range.sql rename to htdocs/install/mysql/data/llx_c_exp_tax_range-expensereport.sql diff --git a/htdocs/install/mysql/data/llx_expensereport_ik.sql b/htdocs/install/mysql/data/llx_expensereport_ik-expensereport.sql similarity index 100% rename from htdocs/install/mysql/data/llx_expensereport_ik.sql rename to htdocs/install/mysql/data/llx_expensereport_ik-expensereport.sql diff --git a/htdocs/install/mysql/tables/llx_budget.sql b/htdocs/install/mysql/tables/llx_budget-budget.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_budget.sql rename to htdocs/install/mysql/tables/llx_budget-budget.sql diff --git a/htdocs/install/mysql/tables/llx_budget_lines.key.sql b/htdocs/install/mysql/tables/llx_budget_lines-budget.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_budget_lines.key.sql rename to htdocs/install/mysql/tables/llx_budget_lines-budget.key.sql diff --git a/htdocs/install/mysql/tables/llx_budget_lines.sql b/htdocs/install/mysql/tables/llx_budget_lines-budget.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_budget_lines.sql rename to htdocs/install/mysql/tables/llx_budget_lines-budget.sql diff --git a/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql b/htdocs/install/mysql/tables/llx_c_exp_tax_cat-expensereport.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql rename to htdocs/install/mysql/tables/llx_c_exp_tax_cat-expensereport.sql diff --git a/htdocs/install/mysql/tables/llx_c_exp_tax_range.sql b/htdocs/install/mysql/tables/llx_c_exp_tax_range-expensereport.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_exp_tax_range.sql rename to htdocs/install/mysql/tables/llx_c_exp_tax_range-expensereport.sql diff --git a/htdocs/install/mysql/tables/llx_c_price_expression.sql b/htdocs/install/mysql/tables/llx_c_price_expression-dynamicprices.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_price_expression.sql rename to htdocs/install/mysql/tables/llx_c_price_expression-dynamicprices.sql diff --git a/htdocs/install/mysql/tables/llx_c_price_global_variable.sql b/htdocs/install/mysql/tables/llx_c_price_global_variable-dynamicprices.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_price_global_variable.sql rename to htdocs/install/mysql/tables/llx_c_price_global_variable-dynamicprices.sql diff --git a/htdocs/install/mysql/tables/llx_c_price_global_variable_updater.sql b/htdocs/install/mysql/tables/llx_c_price_global_variable_updater-dynamicprices.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_price_global_variable_updater.sql rename to htdocs/install/mysql/tables/llx_c_price_global_variable_updater-dynamicprices.sql diff --git a/htdocs/install/mysql/tables/llx_c_recruitment_origin.sql b/htdocs/install/mysql/tables/llx_c_recruitment_origin-recruitment.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_c_recruitment_origin.sql rename to htdocs/install/mysql/tables/llx_c_recruitment_origin-recruitment.sql diff --git a/htdocs/install/mysql/tables/llx_expensereport_ik.sql b/htdocs/install/mysql/tables/llx_expensereport_ik-expensereport.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_expensereport_ik.sql rename to htdocs/install/mysql/tables/llx_expensereport_ik-expensereport.sql diff --git a/htdocs/install/mysql/tables/llx_expensereport_rules.sql b/htdocs/install/mysql/tables/llx_expensereport_rules-expensereport.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_expensereport_rules.sql rename to htdocs/install/mysql/tables/llx_expensereport_rules-expensereport.sql diff --git a/htdocs/install/mysql/tables/llx_export_compta.sql b/htdocs/install/mysql/tables/llx_export_compta.sql deleted file mode 100644 index ebe03e4f50c..00000000000 --- a/htdocs/install/mysql/tables/llx_export_compta.sql +++ /dev/null @@ -1,29 +0,0 @@ --- =================================================================== --- Copyright (C) 2004 Rodolphe Quiedeville --- Copyright (C) 2011 Laurent Destailleur --- --- 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 . --- --- =================================================================== - - -create table llx_export_compta -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(12) NOT NULL, - date_export datetime NOT NULL, -- date de creation - fk_user integer NOT NULL, - note text - -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_session.sql b/htdocs/install/mysql/tables/llx_session-disabled.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_session.sql rename to htdocs/install/mysql/tables/llx_session-disabled.sql diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0f38b2ea280..35ba6c86eae 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -357,6 +357,9 @@ if (!defined('NOSESSION')) { // Init the 6 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc, $hookmanager require_once 'master.inc.php'; +// Uncomment this and set session.save_handler = user to use local session storing +// include DOL_DOCUMENT_ROOT.'/core/lib/phpsessionindb.inc.php + // If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed. if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { $ok = 0;