2
0
forked from Wavyzz/dolibarr

Clean code

This commit is contained in:
Laurent Destailleur
2023-05-10 16:33:07 +02:00
parent fc4aeccf21
commit 4ab5489884
3 changed files with 10 additions and 3 deletions

View File

@@ -161,7 +161,7 @@ function versiondolibarrarray()
* @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0) * @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0)
* @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value * @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value
* @param int $colspan 2=Add a colspan=2 on td * @param int $colspan 2=Add a colspan=2 on td
* @param int $onlysqltoimportwebsite Only sql resquests used to import a website template is allowed * @param int $onlysqltoimportwebsite Only sql resquests used to import a website template are allowed
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0) function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0)

View File

@@ -1721,7 +1721,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$val = ''; $val = '';
} }
$sql = "SELECT count(*)"; $sql = "SELECT count(*) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."const"; $sql .= " FROM ".MAIN_DB_PREFIX."const";
$sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'"; $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'";
$sql .= " AND entity = ".((int) $entity); $sql .= " AND entity = ".((int) $entity);
@@ -1745,7 +1745,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$err++; $err++;
} }
} else { } else {
dol_syslog(get_class($this)."::insert_const constant '".$name."' already exists", LOG_WARNING); dol_syslog(get_class($this)."::insert_const constant '".$name."' already exists", LOG_DEBUG);
} }
} else { } else {
$err++; $err++;

View File

@@ -427,6 +427,13 @@ class modEventOrganization extends DolibarrModules
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
/*$result = run_sql(DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_c_email_templates.sql', 1, '', 1);
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')
}
TODO Instead use the array merge of the sql found into llx_c_email_templates for this module
*/
// Permissions // Permissions
$this->remove($options); $this->remove($options);