From f9c9e518c356e60e316c2bf524143289f896bdb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Apr 2022 19:14:00 +0200 Subject: [PATCH] Load tables for opensurvey only when module opensurvey is enabled --- htdocs/core/modules/modOpenSurvey.class.php | 7 +++++++ ....key.sql => llx_opensurvey_comments-opensurvey.key.sql} | 0 ...comments.sql => llx_opensurvey_comments-opensurvey.sql} | 0 ...ons.sql => llx_opensurvey_formquestions-opensurvey.sql} | 0 ...e.key.sql => llx_opensurvey_sondage-opensurvey.key.sql} | 0 ...y_sondage.sql => llx_opensurvey_sondage-opensurvey.sql} | 0 ....sql => llx_opensurvey_user_formanswers-opensurvey.sql} | 0 ...ey.sql => llx_opensurvey_user_studs-opensurvey.key.sql} | 0 ..._studs.sql => llx_opensurvey_user_studs-opensurvey.sql} | 0 9 files changed, 7 insertions(+) rename htdocs/install/mysql/tables/{llx_opensurvey_comments.key.sql => llx_opensurvey_comments-opensurvey.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_comments.sql => llx_opensurvey_comments-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_formquestions.sql => llx_opensurvey_formquestions-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_sondage.key.sql => llx_opensurvey_sondage-opensurvey.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_sondage.sql => llx_opensurvey_sondage-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_user_formanswers.sql => llx_opensurvey_user_formanswers-opensurvey.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_user_studs.key.sql => llx_opensurvey_user_studs-opensurvey.key.sql} (100%) rename htdocs/install/mysql/tables/{llx_opensurvey_user_studs.sql => llx_opensurvey_user_studs-opensurvey.sql} (100%) diff --git a/htdocs/core/modules/modOpenSurvey.class.php b/htdocs/core/modules/modOpenSurvey.class.php index 87a4f453801..9cc9310cd19 100644 --- a/htdocs/core/modules/modOpenSurvey.class.php +++ b/htdocs/core/modules/modOpenSurvey.class.php @@ -182,6 +182,13 @@ class modOpenSurvey extends DolibarrModules */ public function init($options = '') { + global $conf, $langs; + + $result = $this->_load_tables('/install/mysql/tables/', 'opensurvey'); + 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') + } + // Permissions $this->remove($options); diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_comments.key.sql rename to htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.key.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_comments.sql b/htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_comments.sql rename to htdocs/install/mysql/tables/llx_opensurvey_comments-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql b/htdocs/install/mysql/tables/llx_opensurvey_formquestions-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql rename to htdocs/install/mysql/tables/llx_opensurvey_formquestions-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_sondage.key.sql rename to htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.key.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_sondage.sql rename to htdocs/install/mysql/tables/llx_opensurvey_sondage-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql rename to htdocs/install/mysql/tables/llx_opensurvey_user_formanswers-opensurvey.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_user_studs.key.sql rename to htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.key.sql diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql rename to htdocs/install/mysql/tables/llx_opensurvey_user_studs-opensurvey.sql