Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-02-06 13:28:30 +01:00
commit 2991f992dc
19 changed files with 12 additions and 71 deletions

View File

@ -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
}

View File

@ -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

View File

@ -230,8 +230,6 @@ class modApi extends DolibarrModules
{
$sql = array();
$result = $this->_load_tables('/api/sql/');
return $this->_init($sql, $options);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -265,7 +265,6 @@ class modMultiCurrency extends DolibarrModules
{
$sql = array();
//$this->_load_tables('/multicurrency/sql/');
$res = $this->_init($sql, $options);
if ($res) {

View File

@ -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);

View File

@ -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);

View File

@ -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/');
}
}

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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')

View File

@ -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