diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 4f5557279f4..82e4f0c96dd 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -321,7 +321,7 @@ class FormSetup */ public function addItemsFromParamsArray($params) { - if (!array($params)) { return false; } + if (!is_array($params) || empty($params)) { return false; } foreach ($params as $confKey => $param) { $this->addItemFromParams($confKey, $param); // todo manage error } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 675b0a80ab9..9f2676dfd72 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1052,12 +1052,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Create tables and keys required by module: - * - Files module.sql files with create table instructions - * - Then files modules.key.sql with create keys instructions + * - Files module.sql with create table instructions + * - Then modules.key.sql with create keys instructions * - Then data_xxx.sql (usualy provided by external modules only) * - Then update_xxx.sql (usualy provided by external modules only) * Files must be stored in directory defined by reldir (Example: '/install/mysql/tables' or '/module/sql/') - * This function is usually called by the this->init of module descriptors. + * This function may also be called by : + * - _load_tables('/install/mysql/tables/', 'modulename') into the this->init() of core module descriptors. + * - _load_tables('/mymodule/sql/') into the this->init() of external module descriptors. * * @param string $reldir Relative directory where to scan files. Example: '/install/mysql/tables' or '/module/sql/' * @param string $onlywithsuffix Only with the defined suffix diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 254e3f86983..6ad632c944e 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -230,8 +230,6 @@ class modApi extends DolibarrModules { $sql = array(); - $result = $this->_load_tables('/api/sql/'); - return $this->_init($sql, $options); } diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index b166166b95f..5eba97b1103 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -467,11 +467,6 @@ class modBom extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/bom/sql/'); - if ($result < 0) { - return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') - } - // Create extrafields //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 047ff2b5a8d..1b82334a95b 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -211,8 +211,6 @@ class modDataPolicy extends DolibarrModules { { global $langs; - $this->_load_tables('/datapolicy/sql/'); - // Create extrafields include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modDav.class.php b/htdocs/core/modules/modDav.class.php index 09f7d814553..46168280575 100644 --- a/htdocs/core/modules/modDav.class.php +++ b/htdocs/core/modules/modDav.class.php @@ -266,8 +266,6 @@ class modDav extends DolibarrModules */ public function init($options = '') { - //$this->_load_tables('/dav/sql/'); - // Create extrafields include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 96ee96efae2..f2dc614cb03 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -351,11 +351,6 @@ class modEventOrganization extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/eventorganization/sql/'); - 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/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index b3fb24aa7b3..00e3e12b946 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -442,11 +442,6 @@ class modKnowledgeManagement extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/knowledgemanagement/sql/'); - 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') - } - // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php index ac300fc26e3..2bfc026d959 100644 --- a/htdocs/core/modules/modMrp.class.php +++ b/htdocs/core/modules/modMrp.class.php @@ -446,11 +446,6 @@ class modMrp extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/mrp/sql/'); - 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') - } - // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modMultiCurrency.class.php b/htdocs/core/modules/modMultiCurrency.class.php index 98d7222f082..bc7e044c7af 100644 --- a/htdocs/core/modules/modMultiCurrency.class.php +++ b/htdocs/core/modules/modMultiCurrency.class.php @@ -265,7 +265,6 @@ class modMultiCurrency extends DolibarrModules { $sql = array(); - //$this->_load_tables('/multicurrency/sql/'); $res = $this->_init($sql, $options); if ($res) { diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 87ce98abb4a..aab042ba386 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -408,11 +408,6 @@ class modPartnership extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/partnership/sql/'); - 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') - } - // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php index 239c48135d7..6da69ed888d 100644 --- a/htdocs/core/modules/modRecruitment.class.php +++ b/htdocs/core/modules/modRecruitment.class.php @@ -403,11 +403,6 @@ class modRecruitment extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/recruitment/sql/'); - 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') - } - // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 377d5aadbc4..51117868e35 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -301,21 +301,6 @@ class modResource extends DolibarrModules { $sql = array(); - $result = $this->loadTables(); - return $this->_init($sql, $options); } - - /** - * Create tables, keys and data required by module - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys - * and create data commands must be stored in directory /resource/sql/ - * This function is called by this->init - * - * @return int <=0 if KO, >0 if OK - */ - protected function loadTables() - { - return $this->_load_tables('/resource/sql/'); - } } diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 5cb7a7f0c38..6c7d43a8388 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -283,8 +283,6 @@ class modTakePos extends DolibarrModules dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); - $this->_load_tables('/takepos/sql/'); - $sql = array(); // Remove permissions and default values diff --git a/htdocs/core/modules/modWorkstation.class.php b/htdocs/core/modules/modWorkstation.class.php index 6106c194544..8f088bdcc2a 100644 --- a/htdocs/core/modules/modWorkstation.class.php +++ b/htdocs/core/modules/modWorkstation.class.php @@ -390,11 +390,6 @@ class modWorkstation extends DolibarrModules { global $conf, $langs; - $result = $this->_load_tables('/workstation/sql/'); - 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') - } - // Create extrafields during init //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/core/modules/modZapier.class.php b/htdocs/core/modules/modZapier.class.php index 430622465ca..e41fe839777 100644 --- a/htdocs/core/modules/modZapier.class.php +++ b/htdocs/core/modules/modZapier.class.php @@ -281,11 +281,6 @@ class modZapier extends DolibarrModules */ public function init($options = '') { - $result = $this->_load_tables('/zapier/sql/'); - if ($result < 0) { - return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') - } - // Create extrafields //include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; //$extrafields = new ExtraFields($this->db); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index c9eb9043084..eeca8b77358 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -95,7 +95,7 @@ $setupnotempty = 0; // Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only $useFormSetup = 0; // Convert arrayofparameter into a formSetup object -if (!empty($arrayofparameters) && $useFormSetup && (float) DOL_VERSION >= 15) { +if ($useFormSetup && (float) DOL_VERSION >= 15) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; $formSetup = new FormSetup($db); diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 80cee0a35b3..13e34593bba 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -411,6 +411,7 @@ class modMyModule extends DolibarrModules { global $conf, $langs; + //$result = $this->_load_tables('/install/mysql/tables/', 'mymodule'); $result = $this->_load_tables('/mymodule/sql/'); 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/website/class/website.class.php b/htdocs/website/class/website.class.php index 396646ac40a..0e66e01db01 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1031,7 +1031,7 @@ class Website extends CommonObject fputs($fp, $line); // Warning: We must keep llx_ here. It is a generic SQL. - $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content, author_alias)'; + $line = 'INSERT INTO llx_website_page(rowid, fk_page, fk_website, pageurl, aliasalt, title, description, lang, image, keywords, status, date_creation, tms, import_key, grabbed_from, type_container, htmlheader, content, author_alias, allowed_in_frames)'; $line .= " VALUES("; $line .= $objectpageold->newid."__+MAX_llx_website_page__, "; @@ -1076,9 +1076,11 @@ class Website extends CommonObject $stringtoexport = str_replace('="image/'.$website->ref.'/', '="image/__WEBSITE_KEY__/', $stringtoexport); $line .= "'".$this->db->escape($stringtoexport)."', "; // Replace \r \n to have record on 1 line - $line .= "'".$this->db->escape($objectpageold->author_alias)."'"; + $line .= "'".$this->db->escape($objectpageold->author_alias)."', "; + $line .= "'".$this->db->escape($objectpageold->allowed_in_frames)."'"; $line .= ");"; $line .= "\n"; + fputs($fp, $line); // Add line to update home page id during import