diff --git a/dev/tools/rector/rector.php b/dev/tools/rector/rector.php
index 55cf6117d97..23540fa78bb 100644
--- a/dev/tools/rector/rector.php
+++ b/dev/tools/rector/rector.php
@@ -39,11 +39,16 @@ return static function (RectorConfig $rectorConfig): void {
$arrayoftraitfiles = array(
__DIR__ . '/../../../htdocs/core/class/commonincoterm.class.php',
__DIR__ . '/../../../htdocs/core/class/commonpeople.class.php',
- __DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php'
+ __DIR__ . '/../../../htdocs/core/class/commonsignedobject.class.php',
+ __DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php',
+ __DIR__ . '/../../../htdocs/core/class/commontrigger.class.php',
+ __DIR__ . '/../../../htdocs/core/class/doldeprecationhandler.class.php',
+ __DIR__ . '/../../../htdocs/subtotals/class/commonsubtotal.class.php',
);
$rectorConfig->bootstrapFiles($arrayoftraitfiles);
$rectorConfig->paths([
+ __DIR__ . '/../../../dev/',
__DIR__ . '/../../../htdocs/',
__DIR__ . '/../../../scripts/',
__DIR__ . '/../../../test/phpunit/',
@@ -54,7 +59,8 @@ return static function (RectorConfig $rectorConfig): void {
'**/custom/**',
'**/vendor/**',
'**/rector/**', // Disable this line to test the "test.php" file.
- __DIR__ . '/../../../htdocs/custom/',
+ __DIR__ . '/../../../dev/tools/phan/stubs/*',
+ __DIR__ . '/../../../htdocs/custom/*',
__DIR__ . '/../../../htdocs/install/doctemplates/*'
//'test.php',
]);
@@ -78,11 +84,11 @@ return static function (RectorConfig $rectorConfig): void {
//Not yet ready: $rectorconfig->rule(Rector\CodeQuality\Rector\If_\CompleteMissingIfElseBracketRector::class);
$rectorConfig->rule(Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector::class);
- //$rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyGlobalToFunction::class);
- //$rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyUserRightsToFunction::class);
+ $rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyGlobalToFunction::class);
+ $rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyUserRightsToFunction::class);
$rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class);
- //$rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class);
- //$rectorConfig->rule(Dolibarr\Rector\Renaming\UsePositiveExit::class);
+ $rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class);
+ $rectorConfig->rule(Dolibarr\Rector\Renaming\UsePositiveExit::class);
// This fix <> into != but it breaks other rules, so added at end.
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index a32bfc7a3e4..c762eb1094d 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -254,7 +254,7 @@ if (isModEnabled('eventorganization') && $user->hasRight('eventorganization', 'r
if (isModEnabled('partnership') && $user->hasRight('partnership', 'read')) {
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership'));
}
-if (isModEnabled('product') && !empty($user->rights->produit->lire)) {
+if (isModEnabled('product') && $user->hasRight('produit', 'lire')) {
$elementList['product_send'] = img_picto('', 'product', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('Product'));
}
diff --git a/htdocs/admin/openid_connect.php b/htdocs/admin/openid_connect.php
index a6ce1fc1076..97e0c64b86e 100644
--- a/htdocs/admin/openid_connect.php
+++ b/htdocs/admin/openid_connect.php
@@ -163,7 +163,7 @@ print '
' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcLoginClaimName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcLoginClaimDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_CLIENT_ID
@@ -171,7 +171,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcClientIdName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcClientIdDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_CLIENT_SECRET
@@ -179,7 +179,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcClientSecretName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcClientSecretDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_SCOPES
@@ -187,7 +187,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcScopesName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcScopesDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_AUTHORIZE_URL
@@ -195,7 +195,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcAuthorizeUrlName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcAuthorizeUrlDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_TOKEN_URL
@@ -203,7 +203,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcTokenUrlName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcTokenUrlDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_USERINFO_URL
@@ -211,7 +211,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcUserinfoUrlName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcUserinfoUrlDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// MAIN_AUTHENTICATION_OIDC_LOGOUT_URL
@@ -219,7 +219,7 @@ print '' . "\n";
print '| '.$langs->trans("MainAuthenticationOidcLogoutUrlName").' | '."\n";
print ''.$langs->trans("MainAuthenticationOidcLogoutUrlDesc").' | '."\n";
print '' . "\n";
-print ' |
';
+print '';
print '' . "\n";
// REDIRECT_URL
diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php
index 77c0257d359..f20c4328489 100644
--- a/htdocs/api/class/api_access.class.php
+++ b/htdocs/api/class/api_access.class.php
@@ -194,7 +194,7 @@ class DolibarrApiAccess implements iAuthenticate
$mysoc = $fmysoc;
// Reload langs
- $langcode = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
+ $langcode = (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
$langcode = $user->conf->MAIN_LANG_DEFAULT;
}
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index c06c5dc246e..6e75a7bbb05 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -1457,7 +1457,7 @@ if ($type == Categorie::TYPE_FICHINTER) {
if ($type == Categorie::TYPE_ORDER) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
- $permission = $user->rights->commande->creer;
+ $permission = $user->hasRight('commande', 'creer');
$objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($objects < 0) {
@@ -1538,7 +1538,7 @@ if ($type == Categorie::TYPE_ORDER) {
if ($type == Categorie::TYPE_INVOICE) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
- $permission = $user->rights->facture->creer;
+ $permission = $user->hasRight('facture', 'creer');
$objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($objects < 0) {
@@ -1619,7 +1619,7 @@ if ($type == Categorie::TYPE_INVOICE) {
if ($type == Categorie::TYPE_SUPPLIER_ORDER) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
- $permission = $user->rights->fournisseur->commande->creer;
+ $permission = $user->hasRight('fournisseur', 'commande', 'creer');
$objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($objects < 0) {
@@ -1701,7 +1701,7 @@ if ($type == Categorie::TYPE_SUPPLIER_ORDER) {
if ($type == Categorie::TYPE_SUPPLIER_INVOICE) {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
- $permission = $user->rights->fournisseur->facture->creer;
+ $permission = $user->hasRight('fournisseur', 'facture', 'creer');
$objects = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($objects < 0) {
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 5c2762df0ef..9f7591ea60e 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1725,11 +1725,11 @@ if (empty($reshook)) {
}
$subprice_multicurrency = $line->subprice;
if (is_numeric($margin_rate) && $margin_rate > 0) {
- $line->subprice = floatval(price2num(floatval($line->pa_ht) * (1 + floatval($margin_rate) / 100), 'MU'));
+ $line->subprice = (float) price2num((float) $line->pa_ht * (1 + (float) $margin_rate / 100), 'MU');
} elseif (is_numeric($mark_rate) && $mark_rate > 0) {
- $line->subprice = floatval($line->pa_ht / (1 - (floatval($mark_rate) / 100)));
+ $line->subprice = (float) ($line->pa_ht / (1 - ((float) $mark_rate / 100)));
} else {
- $line->subprice = floatval($line->pa_ht);
+ $line->subprice = (float) $line->pa_ht;
}
$prod = new Product($db);
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 5b1d4018414..63fb222ced4 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -813,11 +813,11 @@ if (empty($reshook)) {
}
$subprice_multicurrency = $line->subprice;
if (is_numeric($margin_rate) && $margin_rate > 0) {
- $line->subprice = floatval(price2num(floatval($line->pa_ht) * (1 + floatval($margin_rate) / 100), 'MU'));
+ $line->subprice = (float) price2num((float) $line->pa_ht * (1 + (float) $margin_rate / 100), 'MU');
} elseif (is_numeric($mark_rate) && $mark_rate > 0) {
- $line->subprice = floatval($line->pa_ht / (1 - (floatval($mark_rate) / 100)));
+ $line->subprice = (float) ($line->pa_ht / (1 - ((float) $mark_rate / 100)));
} else {
- $line->subprice = floatval($line->pa_ht);
+ $line->subprice = (float) $line->pa_ht;
}
$prod = new Product($db);
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index f87d6c8b529..09f4a367d62 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1852,7 +1852,7 @@ if (empty($reshook)) {
null,
0,
'',
- (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA) ? 0 : 1)
+ (getDolGlobalString('MAIN_DEPOSIT_MULTI_TVA') ? 0 : 1)
);
}
@@ -2886,11 +2886,11 @@ if (empty($reshook)) {
}
$subprice_multicurrency = $line->subprice;
if (is_numeric($margin_rate) && $margin_rate > 0) {
- $line->subprice = floatval(price2num(floatval($line->pa_ht) * (1 + floatval($margin_rate) / 100), 'MU'));
+ $line->subprice = (float) price2num((float) $line->pa_ht * (1 + (float) $margin_rate / 100), 'MU');
} elseif (is_numeric($mark_rate) && $mark_rate > 0) {
- $line->subprice = floatval($line->pa_ht / (1 - (floatval($mark_rate) / 100)));
+ $line->subprice = (float) ($line->pa_ht / (1 - ((float) $mark_rate / 100)));
} else {
- $line->subprice = floatval($line->pa_ht);
+ $line->subprice = (float) $line->pa_ht;
}
$prod = new Product($db);
diff --git a/htdocs/compta/facture/class/factureligne.class.php b/htdocs/compta/facture/class/factureligne.class.php
index be3416ea08f..e47974c3d34 100644
--- a/htdocs/compta/facture/class/factureligne.class.php
+++ b/htdocs/compta/facture/class/factureligne.class.php
@@ -1035,7 +1035,7 @@ class FactureLigne extends CommonInvoiceLine
if ($resql && $this->db->num_rows($resql) > 0) {
$obj = $this->db->fetch_object($resql);
- $cumulated_percent += floatval($obj->situation_percent);
+ $cumulated_percent += (float) $obj->situation_percent;
if ($include_credit_note) {
$sql_credit_note = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd';
@@ -1047,7 +1047,7 @@ class FactureLigne extends CommonInvoiceLine
$res_credit_note = $this->db->query($sql_credit_note);
if ($res_credit_note) {
while ($cn = $this->db->fetch_object($res_credit_note)) {
- $cumulated_percent += floatval($cn->situation_percent);
+ $cumulated_percent += (float) $cn->situation_percent;
}
} else {
dol_print_error($this->db);
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index cfb00e37d7e..3b24929d916 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -725,8 +725,8 @@ class CMailFile
$adressEmailFrom = array();
$emailMatchs = preg_match_all($regexp, $from, $adressEmailFrom);
$adressEmailFrom = reset($adressEmailFrom);
- if ($emailMatchs !== false && filter_var($conf->global->MAIN_MAIL_SMTPS_ID, FILTER_VALIDATE_EMAIL) && $conf->global->MAIN_MAIL_SMTPS_ID !== $adressEmailFrom) {
- $this->message->setFrom($conf->global->MAIN_MAIL_SMTPS_ID);
+ if ($emailMatchs !== false && filter_var(getDolGlobalString('MAIN_MAIL_SMTPS_ID'), FILTER_VALIDATE_EMAIL) && getDolGlobalString('MAIN_MAIL_SMTPS_ID') !== $adressEmailFrom) {
+ $this->message->setFrom(getDolGlobalString('MAIN_MAIL_SMTPS_ID'));
} else {
$this->message->setFrom($this->getArrayAddress($this->addr_from));
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index f3e9c18e8fe..019151edd6e 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4553,7 +4553,7 @@ class Form
/**
* Loads into a cache property the list of possible rules for line dates
*
- * @return -1|1 OK=1 ; Empty=-1
+ * @return <-1,1> Return 1 if OK, -1 if empty
*/
public function load_cache_rule_for_lines_dates()
{
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index d0b57e34bb7..036a149c9c5 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -250,7 +250,7 @@ class FormCompany extends Form
* Thus the links with the departments are done on a department independently of its name.
*
* @param string $selected Code state preselected
- * @param 0|string $country_codeid 0=list for all countries, otherwise country code or country rowid to show
+ * @param <0>|string $country_codeid 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department
* @return void
*/
@@ -524,7 +524,7 @@ class FormCompany extends Form
* A country separator is included in case the list for all countries is returned.
*
* @param int $selected Preselected code for juridical type
- * @param 0|string $country_codeid 0=All countries, else the code of the country to display
+ * @param <0>|string $country_codeid 0=All countries, else the code of the country to display
* @param string $filter Add a SQL filter on list
* @return void
* @deprecated Use print xxx->select_juridicalstatus instead
@@ -542,7 +542,7 @@ class FormCompany extends Form
* A country separator is included in case the list for all countries is returned.
*
* @param int $selected Preselected code of juridical type
- * @param 0|string $country_codeid 0=list for all countries, otherwise list only country requested
+ * @param <0>|string $country_codeid 0=list for all countries, otherwise list only country requested
* @param string $filter Add a SQL filter on list. Data must not come from user input.
* @param string $htmlname HTML name of select
* @param string $morecss More CSS
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index 82cb3eb2e08..b183c4da211 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -500,7 +500,7 @@ class DoliDBSqlite3 extends DoliDB
$errormsg .= ' ('.$this->lasterrno.')';
}
- if ($conf->global->SYSLOG_LEVEL < LOG_DEBUG) {
+ if (getDolGlobalString('SYSLOG_LEVEL') < LOG_DEBUG) {
dol_syslog(get_class($this)."::query SQL Error query: ".$query, LOG_ERR); // Log of request was not yet done previously
}
dol_syslog(get_class($this)."::query SQL Error message: ".$errormsg, LOG_ERR);
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index f61b828d0d8..f84a0ba5708 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1133,7 +1133,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
// To verify role of users
$userAccess = $projecttmp->restrictedProjectArea($user);
- if ($user->rights->projet->lire && $userAccess > 0) {
+ if ($user->hasRight('projet', 'lire') && $userAccess > 0) {
print '';
// Ref
diff --git a/htdocs/core/lib/functions_fi.lib.php b/htdocs/core/lib/functions_fi.lib.php
index e09f49bd589..fc3a89f04b8 100644
--- a/htdocs/core/lib/functions_fi.lib.php
+++ b/htdocs/core/lib/functions_fi.lib.php
@@ -83,8 +83,8 @@ function dolFIGenerateInvoiceBarcodeData($recipient_account, $amount, $bank_refe
$recipient_account = str_pad($recipient_account, 16, '0', STR_PAD_LEFT); // Add leading zeros if necessary
$referencetobarcode = preg_replace('/[^0-9]/', '', $bank_reference); // Remove non-numeric characters (spaces)
$referencetobarcode = substr($referencetobarcode, 0, 2) . str_pad(substr($referencetobarcode, 2), 21, '0', STR_PAD_LEFT);
- $euros = floor(floatval($amount)); // Separate euros and cents
- $cents = round((floatval($amount) - $euros) * 100);
+ $euros = floor((float) $amount); // Separate euros and cents
+ $cents = round(((float) $amount - $euros) * 100);
$due_date = date('ymd', (int) $due_date); // Format the due date to YYMMDD
$barcodeData = '5'; // Version number // Construct the string
$barcodeData .= $recipient_account; // Recipient's account number (IBAN)
@@ -96,8 +96,8 @@ function dolFIGenerateInvoiceBarcodeData($recipient_account, $amount, $bank_refe
$recipient_account = preg_replace('/[^0-9]/', '', $recipient_account); // Remove non-numeric characters from account number
$recipient_account = str_pad($recipient_account, 16, '0', STR_PAD_LEFT); // Add leading zeros if necessary
$referencetobarcode = preg_replace('/[^0-9]/', '', $bank_reference); // Remove non-numeric characters (spaces)
- $euros = floor(floatval($amount)); // Separate euros and cents
- $cents = round((floatval($amount) - $euros) * 100);
+ $euros = floor((float) $amount); // Separate euros and cents
+ $cents = round(((float) $amount - $euros) * 100);
$due_date = date('ymd', (int) $due_date); // Format the due date to YYMMDD
$barcodeData = '4'; // Version number // Construct the string
$barcodeData .= $recipient_account; // Recipient's account number (IBAN)
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 7db8c5ee8db..7b038a7f30c 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -552,7 +552,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'attributes';
$h++;
- if (empty($conf->global->PROJECT_HIDE_TASKS)) {
+ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
$head[$h][0] = DOL_URL_ROOT . '/projet/admin/project_task_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsProjectTask");
$nbExtrafields = $extrafields->attributes['projet_task']['count'];
diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php
index 8eae1c18718..26d9561c948 100644
--- a/htdocs/core/lib/usergroups.lib.php
+++ b/htdocs/core/lib/usergroups.lib.php
@@ -458,7 +458,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
$url = DOL_URL_ROOT.'/public/theme/common/nophoto.png';
}
print 'id : '').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
- if ($subdir == $conf->global->MAIN_THEME) {
+ if ($subdir == getDolGlobalString('MAIN_THEME')) {
$title = $langs->trans("ThemeCurrentlyActive");
} else {
$title = $langs->trans("ShowPreview");
diff --git a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
index 479631f3a15..dc1dc2a4203 100644
--- a/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
+++ b/htdocs/core/modules/asset/doc/doc_generic_asset_odt.modules.php
@@ -409,7 +409,7 @@ class doc_generic_asset_odt extends ModelePDFAsset
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
index 9e1b5f01c0e..e8ac8b84dac 100644
--- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
+++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php
@@ -396,7 +396,7 @@ class doc_generic_bom_odt extends ModelePDFBom
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
index b4dd9900f77..3ae3c4b0eaf 100644
--- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
+++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@@ -407,7 +407,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
index 84fc83f3d02..58c551b49e0 100644
--- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php
@@ -856,7 +856,7 @@ class pdf_einstein extends ModelePDFCommandes
$posy = $pdf->GetY() + 2;
}
}
- if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
+ if (getDolGlobalString('FACTURE_CHQ_NUMBER') == -1) {
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', false);
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index 75e1fedac80..01a01125caa 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -1135,7 +1135,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$posy = $pdf->GetY() + 2;
}
}
- if ($conf->global->FACTURE_CHQ_NUMBER == -1) {
+ if (getDolGlobalString('FACTURE_CHQ_NUMBER') == -1) {
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', false);
diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
index c920f0908ae..e2b3b486fb9 100644
--- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
+++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php
@@ -391,7 +391,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
index 7f82572e00f..7c9584012ae 100644
--- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
+++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php
@@ -379,7 +379,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index 7e97b0b6b30..f1da2f2c391 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -455,7 +455,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php
index fed4e211fa2..67baac3af04 100644
--- a/htdocs/core/modules/facture/doc/pdf_octopus.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_octopus.modules.php
@@ -3178,7 +3178,7 @@ class pdf_octopus extends ModelePDFFactures
// 2. recalculer la TVA associée à ce montant HT
// 3. le cas échéant stocker cette information comme travaux_sup si cette ligne n'est pas liée à une ligne de la situation précédente
foreach ($previousInvoice->lines as $k => $l) {
- $total_ht = floatval($l->total_ht);
+ $total_ht = (float) $l->total_ht;
if (empty($total_ht)) {
continue;
}
@@ -3459,7 +3459,7 @@ class pdf_octopus extends ModelePDFFactures
// Scroll through the lines of the current invoice to retrieve all data
foreach ($object->lines as $k => $l) {
- $total_ht = floatval($l->total_ht);
+ $total_ht = (float) $l->total_ht;
if (empty($total_ht)) {
continue;
}
diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
index 8d5135c1c71..3f3da296e5b 100644
--- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
+++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php
@@ -355,7 +355,7 @@ class doc_generic_member_odt extends ModelePDFMember
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
index 8a8fefe0657..25eedc6a07f 100644
--- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
+++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php
@@ -380,7 +380,7 @@ class doc_generic_mo_odt extends ModelePDFMo
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
index ec2251afde7..ab0f60ec417 100644
--- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
+++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php
@@ -392,7 +392,7 @@ class doc_generic_product_odt extends ModelePDFProduct
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
index 09b59508db8..e9e3670d12d 100644
--- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
+++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php
@@ -653,7 +653,7 @@ class doc_generic_project_odt extends ModelePDFProjects
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
index 1327cc1c720..86c68f6acd1 100644
--- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
+++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php
@@ -592,7 +592,7 @@ class doc_generic_task_odt extends ModelePDFTask
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
index d99e5a4080c..c779e9e9abe 100644
--- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
+++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
@@ -452,7 +452,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
index cfcf8f541d6..3c197f6fc12 100644
--- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
+++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
@@ -394,7 +394,7 @@ class doc_generic_reception_odt extends ModelePdfReception
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
index 2c90ce35230..bd851f8cab5 100644
--- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
+++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php
@@ -386,7 +386,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php
index e26f0b8c6a3..32d208f2bce 100644
--- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php
+++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php
@@ -131,7 +131,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte = str_replace(array('{s1}', '{s2}', '{s3}', '{s4}'), array($s1, $s2, $s3, $s4), $texte);
$texte .= "
\n";
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
- if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || !empty($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) {
+ if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || getDolGlobalString('COMPANY_DIGITARIA_REMOVE_SPECIAL')) {
$texte .= $langs->trans('RemoveSpecialChars').' = '.yn(1)."
\n";
}
// Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
index 4598a98940b..3faa7f75fc4 100644
--- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
+++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php
@@ -390,7 +390,7 @@ class doc_generic_stock_odt extends ModelePDFStock
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php
index 824ff9c2ffc..79afacc9afb 100644
--- a/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php
+++ b/htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php
@@ -392,7 +392,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
index 31f4080baac..569a96800ac 100644
--- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php
@@ -387,7 +387,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
index 6c778fb5e30..24fc5e4d85e 100644
--- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
+++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php
@@ -416,7 +416,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
index 1acba934b2e..4c13ce62cb6 100644
--- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
+++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php
@@ -349,7 +349,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
index 88f80165b72..51e9c738bf6 100644
--- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
+++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php
@@ -382,7 +382,7 @@ class doc_generic_user_odt extends ModelePDFUser
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
index e82a231108e..dc6d4b1495a 100644
--- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
+++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php
@@ -417,7 +417,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php
index e32af87569d..f1165dc9b51 100644
--- a/htdocs/core/tpl/objectline_view.tpl.php
+++ b/htdocs/core/tpl/objectline_view.tpl.php
@@ -472,7 +472,7 @@ if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) {
$coldisplay++;
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$previous_progress = $line->getAllPrevProgress($object->id);
- $current_progress = $previous_progress + floatval($line->situation_percent);
+ $current_progress = $previous_progress + (float) $line->situation_percent;
print ''.$current_progress.'% | ';
$coldisplay++;
print ''.$line->situation_percent.'% | ';
diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
index cdd09250bec..126a9287642 100644
--- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
+++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php
@@ -182,7 +182,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
$old_MAIN_MAIL_AUTOCOPY_TO = '';
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
- $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
+ $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
@@ -210,7 +210,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
$sendto = $userstat->email;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
- $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
+ $old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php
index dec5583393b..094513580f4 100644
--- a/htdocs/cron/card.php
+++ b/htdocs/cron/card.php
@@ -105,7 +105,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $permissiontodelete) {
// Execute jobs
if ($action == 'confirm_execute' && $confirm == "yes" && $permissiontoexecute) {
- if (getDolGlobalString('CRON_KEY') && $conf->global->CRON_KEY != $securitykey) {
+ if (getDolGlobalString('CRON_KEY') && getDolGlobalString('CRON_KEY') != $securitykey) {
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
} else {
$now = dol_now(); // Date we start
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index 41960e4b001..783c3f06167 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -161,7 +161,7 @@ if (empty($reshook)) {
// Execute jobs
if ($action == 'confirm_execute' && $confirm == "yes" && $permissiontoexecute) {
- if (getDolGlobalString('CRON_KEY') && $conf->global->CRON_KEY != $securitykey) {
+ if (getDolGlobalString('CRON_KEY') && getDolGlobalString('CRON_KEY') != $securitykey) {
setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors');
$action = '';
} else {
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 9483eff02fd..560f443a0eb 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -157,8 +157,8 @@ $arrayfields = array(
'l.ref' => array('label' => $langs->trans("DeliveryRef"), 'checked' => '1', 'position' => 1010, 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')),
'l.date_delivery' => array('label' => $langs->trans("DateReceived"), 'position' => 1020, 'checked' => '1', 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')),
'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => '1', 'position' => 1100, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_SHIPMENT") !== "0"'),
- 'e.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position' => 135),
- 'e.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position' => 140),
+ 'e.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_ALLOW_PUBLIC_NOTES')), 'position' => 135),
+ 'e.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_ALLOW_PRIVATE_NOTES')), 'position' => 140),
);
// Extra fields
@@ -364,7 +364,7 @@ if (empty($reshook)) {
$desc = dol_concatdesc($desc, $langs->trans("Order").': '.$expdCmdSrc->ref. ' - '. $langs->trans("Shipment").': '.$expd->ref.($expd->date_shipping ? ' - '.dol_print_date($expd->date_shipping, 'day') : ''));
}
- if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) {
+ if ($lines[$i]->subprice < 0 && !getDolGlobalString('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
// Negative line, we create a discount line
$discount = new DiscountAbsolute($db);
$discount->socid = $objecttmp->socid;
@@ -1112,14 +1112,14 @@ if ($massaction == 'createbills') {
print $langs->trans('ValidateInvoices');
print '';
print '';
- if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
+ if (!empty($conf->stock->enabled) && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
print $form->selectyesno('validate_invoices', 0, 1, true);
$langs->load("errors");
print ' ('.$langs->trans("WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").')';
} else {
print $form->selectyesno('validate_invoices', 0, 1);
}
- if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) {
+ if (!empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
print ' '.$langs->trans("IfValidateInvoiceIsNoSendingStayUnbilled").'';
} else {
print ' '.$langs->trans("OptionToSetSendingBilledNotEnabled").'';
diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php
index 555441a7fcd..083f15978d0 100644
--- a/htdocs/expensereport/list.php
+++ b/htdocs/expensereport/list.php
@@ -526,7 +526,7 @@ if ($id > 0) { // For user tab
$childids = $user->getAllChildIds(1);
$canedit = ((in_array($user_id, $childids) && $user->hasRight('expensereport', 'creer'))
- || ($conf->global->MAIN_USE_ADVANCED_PERMS && $user->hasRight('expensereport', 'writeall_advance')));
+ || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('expensereport', 'writeall_advance')));
// Buttons for actions
if ($canedit) {
diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php
index 5a2d398da9b..1ef26524a04 100644
--- a/htdocs/fichinter/card.php
+++ b/htdocs/fichinter/card.php
@@ -441,7 +441,7 @@ if (empty($reshook)) {
$label = $lines[$i]->product_label;
}
- if ($prod->duration_value && $conf->global->FICHINTER_USE_SERVICE_DURATION) {
+ if ($prod->duration_value && getDolGlobalString('FICHINTER_USE_SERVICE_DURATION')) {
switch ($prod->duration_unit) {
default:
case 'h':
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 81f18a6b66a..84756bc52e2 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -3514,7 +3514,7 @@ class FactureFournisseur extends CommonInvoice
$langs->load('bills');
- if (!isModEnabled(empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) ? 'fournisseur' : 'supplier_invoice')) { // Should not happen. If module disabled, cron job should not be visible.
+ if (!isModEnabled(!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') ? 'fournisseur' : 'supplier_invoice')) { // Should not happen. If module disabled, cron job should not be visible.
$this->output .= $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv('Suppliers'));
return 0;
}
@@ -3671,7 +3671,7 @@ class FactureFournisseur extends CommonInvoice
}
// Errors Recipient
- $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
+ $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO');
$trackid = 'inv'.$tmpinvoice->id;
$sendcontext = 'standard';
diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php
index 2748517eb11..7b90a9b4c98 100644
--- a/htdocs/install/step5.php
+++ b/htdocs/install/step5.php
@@ -496,7 +496,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
// If first install
if ($action == "set") {
if ($success) {
- if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
+ if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') || (getDolGlobalString('MAIN_VERSION_LAST_UPGRADE') == DOL_VERSION)) {
// Install is finished (database is on same version than files)
print ' '.$langs->trans("SystemIsInstalled")." ";
diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
index 492153f20aa..34a2c29dc25 100644
--- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
+++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php
@@ -422,7 +422,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index f9d771f2a28..6f7408f83c1 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -298,7 +298,7 @@ $arrayfields = array(
if (! empty($conf->stock->enabled)) {
// service
if ($type == 1) {
- if (! empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
+ if (getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
$arrayfields['p.stockable_product'] = array('label' => $langs->trans('StockableProduct'), 'checked' => '0', 'position' => 1001);
}
} else {
diff --git a/htdocs/product/stats/expedition.php b/htdocs/product/stats/expedition.php
index 83d6c52e444..e6f2d8e48bb 100644
--- a/htdocs/product/stats/expedition.php
+++ b/htdocs/product/stats/expedition.php
@@ -152,14 +152,14 @@ if ($id > 0 || !empty($ref)) {
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, e.ref, e.ref_customer";
$sql .= ", e.date_creation, e.date_delivery, e.fk_statut as statut, e.rowid as expeditionid, ed.rowid";
$sql .= ", ed.qty , cd.subprice * (100 - cd.remise_percent) / 100 * ed.qty AS total_ht";
- if (empty($user->rights->societe->client->voir) && !$socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expedition as e ON e.fk_soc = s.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expeditiondet as ed ON ed.fk_expedition = e.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."commandedet as cd ON cd.rowid = ed.fk_elementdet AND (ed.element_type = 'commande' OR ed.element_type = 'order')";
- if (empty($user->rights->societe->client->voir) && !$socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
diff --git a/htdocs/product/stats/reception.php b/htdocs/product/stats/reception.php
index 6b4ef95cf6a..bfde1cee7cc 100644
--- a/htdocs/product/stats/reception.php
+++ b/htdocs/product/stats/reception.php
@@ -151,14 +151,14 @@ if ($id > 0 || !empty($ref)) {
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_fournisseur, r.ref, r.ref_supplier";
$sql .= ", r.date_creation, r.date_delivery, r.fk_statut as statut, r.rowid as receptionid, cfd.rowid";
$sql .= ", cfd.qty, cfdet.subprice * (100 - cfdet.remise_percent) / 100 * cfd.qty AS total_ht";
- if (empty($user->rights->societe->client->voir) && !$socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."reception as r ON r.fk_soc = s.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as cfd ON cfd.fk_reception = r.rowid AND element_type = 'supplier_order'";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfdet ON cfdet.rowid = cfd.fk_elementdet";
- if (empty($user->rights->societe->client->voir) && !$socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " WHERE r.entity IN (".getEntity('reception').")";
diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
index 9a8f89d21b4..b3e2ef87827 100644
--- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
+++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php
@@ -408,7 +408,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
// retrieve the constant to apply a ratio for image size or set the ratio to 1
if (getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO')) {
- $ratio = floatval(getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO'));
+ $ratio = (float) getDolGlobalString('MAIN_DOC_ODT_IMAGE_RATIO');
} else {
$ratio = 1;
}
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index 0e03fa312fd..e04c68f2ec4 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -434,7 +434,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) {
print ' | '.$modCodeTiers->info($langs).' | '."\n";
print ''.$modCodeTiers->getExample($langs).' | '."\n";
- if ($conf->global->SOCIETE_CODECLIENT_ADDON == (string) $file) {
+ if (getDolGlobalString('SOCIETE_CODECLIENT_ADDON') == (string) $file) {
print ''."\n";
print img_picto($langs->trans("Activated"), 'switch_on');
print " | \n";
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 6c2387f2148..b1444b12703 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -322,7 +322,7 @@ class SupplierProposal extends CommonObject
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $this->thirdparty, $tva_npr);
// multiprix
- if ($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) {
+ if (getDolGlobalString('PRODUIT_MULTIPRICES') && $this->thirdparty->price_level) {
$price = $prod->multiprices[$this->thirdparty->price_level];
} else {
$price = $prod->price;
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 82d6e4c2a8d..6743e293960 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -742,7 +742,7 @@ if ($action == 'create' || $action == 'presend') {
$formticket->showForm(1, 'create', 0, null, $action, $object);
print dol_get_fiche_end();
-} elseif ($action == 'edit' && $user->rights->ticket->write && $object->status < Ticket::STATUS_CLOSED) {
+} elseif ($action == 'edit' && $user->hasRight('ticket', 'write') && $object->status < Ticket::STATUS_CLOSED) {
if (empty($permissiontoadd)) {
accessforbidden('NotEnoughPermissions', 0, 1);
}
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index eb97b2f8199..56aa624636d 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1653,8 +1653,6 @@ class User extends CommonObject
*/
public function delete(User $user)
{
- global $conf, $langs;
-
$error = 0;
$this->db->begin();
@@ -1886,7 +1884,7 @@ class User extends CommonObject
public function create_from_contact($contact, $login = '', $password = '')
{
// phpcs:enable
- global $conf, $user, $langs;
+ global $user;
$error = 0;
@@ -2105,7 +2103,7 @@ class User extends CommonObject
*/
public function update($user, $notrigger = 0, $nosyncmember = 0, $nosyncmemberpass = 0, $nosynccontact = 0)
{
- global $conf, $langs;
+ global $langs;
if (empty($this->country_id) && !empty($this->country_code)) {
$country_id = getCountry($this->country_code, '3');
@@ -2527,7 +2525,7 @@ class User extends CommonObject
if (empty($passwordalreadycrypted)) {
if (getDolGlobalString('USER_PASSWORD_GENERATED')) {
// Add a check on rules for password syntax using the setup of the password generator
- $modGeneratePassClass = 'modGeneratePass'.ucfirst($conf->global->USER_PASSWORD_GENERATED);
+ $modGeneratePassClass = 'modGeneratePass'.ucfirst(getDolGlobalString('USER_PASSWORD_GENERATED'));
include_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/'.$modGeneratePassClass.'.class.php';
if (class_exists($modGeneratePassClass)) {
@@ -2861,7 +2859,7 @@ class User extends CommonObject
public function SetInGroup($group, $entity, $notrigger = 0)
{
// phpcs:enable
- global $conf, $langs, $user;
+ global $langs, $user;
$error = 0;
@@ -2917,7 +2915,7 @@ class User extends CommonObject
public function RemoveFromGroup($group, $entity, $notrigger = 0)
{
// phpcs:enable
- global $conf, $langs, $user;
+ global $langs, $user;
$error = 0;
@@ -3479,7 +3477,7 @@ class User extends CommonObject
$info[getDolGlobalString($constname)] = $this->$varname;
// Check if it is the LDAP key and if its value has been changed
- if (getDolGlobalString('LDAP_KEY_USERS') && $conf->global->LDAP_KEY_USERS == getDolGlobalString($constname)) {
+ if (getDolGlobalString('LDAP_KEY_USERS') && gtDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString($constname)) {
if (is_object($this->oldcopy) && !$this->oldcopy->isEmpty() && $this->$varname != $this->oldcopy->$varname) {
$keymodified = true; // For check if LDAP key has been modified
}
@@ -3586,7 +3584,7 @@ class User extends CommonObject
}
}
if (getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY') && getDolGlobalString('LDAP_FIELD_HOMEDIRECTORYPREFIX')) {
- $info[getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY')] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login";
+ $info[getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY')] = getDolGlobalString('LDAP_FIELD_HOMEDIRECTORYPREFIX')."/".$this->login;
}
return $info;
@@ -3602,7 +3600,7 @@ class User extends CommonObject
*/
public function initAsSpecimen()
{
- global $user, $langs;
+ global $user;
$now = dol_now();
@@ -3720,8 +3718,6 @@ class User extends CommonObject
*/
public function getNbOfUsers($limitTo, $option = '', $admin = -1)
{
- global $conf;
-
$sql = "SELECT count(rowid) as nb";
$sql .= " FROM ".$this->db->prefix()."user";
if ($option == 'superadmin') {
@@ -3760,7 +3756,7 @@ class User extends CommonObject
{
// phpcs:enable
// TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?)
- global $user, $conf;
+ global $user;
$socialnetworks = getArrayOfSocialNetworks();
@@ -3840,8 +3836,6 @@ class User extends CommonObject
*/
private function loadParentOf()
{
- global $conf;
-
$this->parentof = array();
// Load array[child]=parent
@@ -4075,8 +4069,6 @@ class User extends CommonObject
*/
public function loadStateBoard()
{
- global $conf;
-
$this->nb = array();
$sql = "SELECT COUNT(DISTINCT u.rowid) as nb";
@@ -4118,7 +4110,7 @@ class User extends CommonObject
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
- global $conf, $user, $langs;
+ global $langs;
$langs->load("user");
diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php
index 9b64b2f80ee..14e2ddb90a3 100644
--- a/test/phpunit/SocieteTest.php
+++ b/test/phpunit/SocieteTest.php
@@ -62,7 +62,7 @@ class SocieteTest extends CommonClassTest
{
global $conf,$user,$langs,$db;
- if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') {
+ if (getDolGlobalString('SOCIETE_CODECLIENT_ADDON') != 'mod_codeclient_monkey') {
print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '" . getDolGlobalString('SOCIETE_CODECLIENT_ADDON')."'.\n";
die(1);
}