From 388889a0e39a1042d9d4a73213e7b132d8257d0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Mar 2023 15:54:40 +0100 Subject: [PATCH] Table for TakePOS module created only when module is enabled --- htdocs/core/modules/modLoan.class.php | 2 -- htdocs/core/modules/modTakePos.class.php | 9 +++++++-- ....key.sql => llx_takepos_floor_tables-takepos.key.sql} | 0 ...r_tables.sql => llx_takepos_floor_tables-takepos.sql} | 0 4 files changed, 7 insertions(+), 4 deletions(-) rename htdocs/install/mysql/tables/{llx_takepos_floor_tables.key.sql => llx_takepos_floor_tables-takepos.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_takepos_floor_tables.sql => llx_takepos_floor_tables-takepos.sql} (100%) diff --git a/htdocs/core/modules/modLoan.class.php b/htdocs/core/modules/modLoan.class.php index 36919bc38af..f01391e16af 100644 --- a/htdocs/core/modules/modLoan.class.php +++ b/htdocs/core/modules/modLoan.class.php @@ -158,8 +158,6 @@ class modLoan extends DolibarrModules */ public function init($options = '') { - global $conf; - $result = $this->_load_tables('/install/mysql/', 'loan'); 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') diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index b06bf0fe8b0..ce6395fdb73 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -269,11 +269,16 @@ class modTakePos extends DolibarrModules dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); - $sql = array(); + $result = $this->_load_tables('/install/mysql/', 'takepos'); + 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 + // Clean before activation $this->remove($options); + $sql = array(); + return $this->_init($sql, $options); } diff --git a/htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql b/htdocs/install/mysql/tables/llx_takepos_floor_tables-takepos.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_takepos_floor_tables.key.sql rename to htdocs/install/mysql/tables/llx_takepos_floor_tables-takepos.key.sql diff --git a/htdocs/install/mysql/tables/llx_takepos_floor_tables.sql b/htdocs/install/mysql/tables/llx_takepos_floor_tables-takepos.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_takepos_floor_tables.sql rename to htdocs/install/mysql/tables/llx_takepos_floor_tables-takepos.sql