Clean code

This commit is contained in:
Laurent Destailleur 2021-06-23 10:42:27 +02:00
parent d57699b7d7
commit 82ee5c2825
2 changed files with 734 additions and 734 deletions

View File

@ -110,7 +110,6 @@ class Conf
// Common objects that are not modules // Common objects that are not modules
$this->mycompany = new stdClass(); $this->mycompany = new stdClass();
$this->admin = new stdClass(); $this->admin = new stdClass();
$this->user = new stdClass();
$this->browser = new stdClass(); $this->browser = new stdClass();
$this->medias = new stdClass(); $this->medias = new stdClass();
$this->global = new stdClass(); $this->global = new stdClass();
@ -136,7 +135,7 @@ class Conf
'syslog' => array() 'syslog' => array()
); );
// First level object // First level object that are modules.
// TODO Remove this part. // TODO Remove this part.
$this->syslog = new stdClass(); $this->syslog = new stdClass();
$this->multicompany = new stdClass(); $this->multicompany = new stdClass();
@ -152,6 +151,7 @@ class Conf
$this->propal = new stdClass(); $this->propal = new stdClass();
$this->facture = new stdClass(); $this->facture = new stdClass();
$this->contrat = new stdClass(); $this->contrat = new stdClass();
$this->user = new stdClass();
$this->usergroup = new stdClass(); $this->usergroup = new stdClass();
$this->adherent = new stdClass(); $this->adherent = new stdClass();
$this->bank = new stdClass(); $this->bank = new stdClass();
@ -173,7 +173,8 @@ class Conf
{ {
dol_syslog(get_class($this)."::setValues"); dol_syslog(get_class($this)."::setValues");
//Define all global constants into $this->global->key=value if (!defined('NOREQUIREDB')) {
// Define all global constants into $this->global->key=value
$sql = "SELECT ".$db->decrypt('name')." as name,"; $sql = "SELECT ".$db->decrypt('name')." as name,";
$sql .= " ".$db->decrypt('value')." as value, entity"; $sql .= " ".$db->decrypt('value')." as value, entity";
$sql .= " FROM ".MAIN_DB_PREFIX."const"; $sql .= " FROM ".MAIN_DB_PREFIX."const";
@ -917,6 +918,18 @@ class Conf
} }
} }
} }
}
// Overwrite database values from conf into the conf.php file.
if (!empty($this->file->mailing_limit_sendbyweb)) {
$this->global->MAILING_LIMIT_SENDBYWEB = $this->file->mailing_limit_sendbyweb;
}
if (empty($this->global->MAILING_LIMIT_SENDBYWEB)) {
$this->global->MAILING_LIMIT_SENDBYWEB = 25;
}
if (!empty($this->file->mailing_limit_sendbycli)) {
$this->global->MAILING_LIMIT_SENDBYCLI = $this->file->mailing_limit_sendbycli;
}
return 0; return 0;
} }

View File

@ -195,23 +195,10 @@ if (!is_numeric($conf->entity)) {
$conf->entity = 1; $conf->entity = 1;
} }
if (!defined('NOREQUIREDB')) { //print "We work with data into entity instance number '".$conf->entity."'";
//print "Will work with data into entity instance number '".$conf->entity."'";
// Here we read database (llx_const table) and define $conf->global->XXX var. // Here we read database (llx_const table) and define $conf->global->XXX var.
$conf->setValues($db); $conf->setValues($db);
}
// Overwrite database value
if (!empty($conf->file->mailing_limit_sendbyweb)) {
$conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb;
}
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) {
$conf->global->MAILING_LIMIT_SENDBYWEB = 25;
}
if (!empty($conf->file->mailing_limit_sendbycli)) {
$conf->global->MAILING_LIMIT_SENDBYCLI = $conf->file->mailing_limit_sendbycli;
}
// Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr. // Create object $mysoc (A thirdparty object that contains properties of companies managed by Dolibarr.
if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) { if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) {