فهرست منبع

Fix warning php8.2

Laurent Destailleur 1 سال پیش
والد
کامیت
de96af8543
35فایلهای تغییر یافته به همراه349 افزوده شده و 333 حذف شده
  1. 7 2
      dev/tools/rector/README.md
  2. 9 0
      dev/tools/rector/rector.php
  3. 35 35
      htdocs/core/class/CMailFile.class.php
  4. 3 3
      htdocs/core/class/CSMSFile.class.php
  5. 6 6
      htdocs/core/class/commoninvoice.class.php
  6. 16 16
      htdocs/core/class/commonobject.class.php
  7. 7 7
      htdocs/core/class/commonpeople.class.php
  8. 2 0
      htdocs/core/class/commonsocialnetworks.class.php
  9. 1 1
      htdocs/core/class/defaultvalues.class.php
  10. 7 7
      htdocs/core/class/doleditor.class.php
  11. 4 4
      htdocs/core/class/dolgeoip.class.php
  12. 1 1
      htdocs/core/class/dolgraph.class.php
  13. 1 1
      htdocs/core/class/dolreceiptprinter.class.php
  14. 1 1
      htdocs/core/class/emailsenderprofile.class.php
  15. 5 5
      htdocs/core/class/extrafields.class.php
  16. 1 1
      htdocs/core/class/extralanguages.class.php
  17. 1 1
      htdocs/core/class/fiscalyear.class.php
  18. 116 116
      htdocs/core/class/html.form.class.php
  19. 3 3
      htdocs/core/class/html.formactions.class.php
  20. 1 1
      htdocs/core/class/html.formadmin.class.php
  21. 15 15
      htdocs/core/class/html.formcompany.class.php
  22. 3 3
      htdocs/core/class/html.formcontract.class.php
  23. 13 13
      htdocs/core/class/html.formfile.class.php
  24. 24 24
      htdocs/core/class/html.formmail.class.php
  25. 9 9
      htdocs/core/class/html.formmargin.class.php
  26. 5 5
      htdocs/core/class/html.formother.class.php
  27. 5 5
      htdocs/core/class/html.formprojet.class.php
  28. 5 5
      htdocs/core/class/html.formticket.class.php
  29. 3 3
      htdocs/core/class/ldap.class.php
  30. 4 4
      htdocs/core/class/notify.class.php
  31. 7 7
      htdocs/core/class/rssparser.class.php
  32. 9 9
      htdocs/core/class/smtps.class.php
  33. 6 6
      htdocs/core/class/timespent.class.php
  34. 7 7
      htdocs/core/class/translate.class.php
  35. 7 7
      htdocs/core/class/utils.class.php

+ 7 - 2
dev/tools/rector/README.md

@@ -3,12 +3,17 @@
 
 #### Installation
 
-run in this folder
+Run in this folder
+```shell
+cd dev/tools/rector
+```
 
+Install rector with composer
 ```shell
 composer install
 ```
- #### Usage
+
+#### Usage
 
 ##### To make changes (Add --dry-run for test mode only)
 ```shell

+ 9 - 0
dev/tools/rector/rector.php

@@ -9,6 +9,15 @@ use Rector\Set\ValueObject\LevelSetList;
 return static function (RectorConfig $rectorConfig): void {
 	$rectorConfig->phpVersion(PhpVersion::PHP_71);
 	//$rectorConfig->indent(' ', 4);
+
+	// Traits seems not supported correctly by rector without declaring them as bootstrapFiles
+	$arrayoftraitfiles = array(
+		__DIR__ . '/../../../htdocs/core/class/commonincoterm.class.php',
+		__DIR__ . '/../../../htdocs/core/class/commonpeople.class.php',
+		__DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php'
+	);
+	$rectorConfig->bootstrapFiles($arrayoftraitfiles);
+
 	$rectorConfig->paths([
 		__DIR__ . '/../../../htdocs/',
 		__DIR__ . '/../../../scripts/',

+ 35 - 35
htdocs/core/class/CMailFile.class.php

@@ -197,14 +197,14 @@ class CMailFile
 			}
 		}
 		if (empty($this->sendmode)) {
-			$this->sendmode = (!empty($conf->global->MAIN_MAIL_SENDMODE) ? $conf->global->MAIN_MAIL_SENDMODE : 'mail');
+			$this->sendmode = (getDolGlobalString('MAIN_MAIL_SENDMODE') ? $conf->global->MAIN_MAIL_SENDMODE : 'mail');
 		}
 
 		// We define end of line (RFC 821).
 		$this->eol = "\r\n";
 		// We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n).
 		$this->eol2 = "\r\n";
-		if (!empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
+		if (getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
 			$this->eol = "\n";
 			$this->eol2 = "\n";
 			$moreinheader = str_replace("\r\n", "\n", $moreinheader);
@@ -249,7 +249,7 @@ class CMailFile
 		// Replace relative /viewimage to absolute path
 		$msg = preg_replace('/src="'.preg_quote(DOL_URL_ROOT, '/').'\/viewimage\.php/ims', 'src="'.$urlwithroot.'/viewimage.php', $msg, -1);
 
-		if (!empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) {
+		if (getDolGlobalString('MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML')) {
 			$this->msgishtml = 1; // To force to send everything with content type html.
 		}
 
@@ -258,7 +258,7 @@ class CMailFile
 			$this->html = $msg;
 
 			$findimg = 0;
-			if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) {	// Off by default
+			if (getDolGlobalString('MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS')) {	// Off by default
 				// Search into the body for <img tags of links in medias files to replace them with an embedded file
 				// Note because media links are public, this should be useless, except avoid blocking images with email browser.
 				// This convert an embedd file with src="/viewimage.php?modulepart... into a cid link
@@ -266,7 +266,7 @@ class CMailFile
 				$findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');
 			}
 
-			if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA)) {
+			if (getDolGlobalString('MAIN_MAIL_ADD_INLINE_IMAGES_IF_DATA')) {
 				// Search into the body for <img src="data:image/ext;base64,..." to replace them with an embedded file
 				// This convert an embedded file with src="data:image... into a cid link + attached file
 				$findimg = $this->findHtmlImagesIsSrcData($upload_dir_tmp);
@@ -310,7 +310,7 @@ class CMailFile
 
 		// Add auto copy to if not already in $to (Note: Adding bcc for specific modules are also done from pages)
 		// For example MAIN_MAIL_AUTOCOPY_TO can be 'email@example.com, __USER_EMAIL__, ...'
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO')) {
 			$listofemailstoadd = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
 			foreach ($listofemailstoadd as $key => $val) {
 				$emailtoadd = $listofemailstoadd[$key];
@@ -354,7 +354,7 @@ class CMailFile
 		$this->mimefilename_list = $mimefilename_list;
 		$this->cid_list = $cid_list;
 
-		if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) {
+		if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
 			$this->addr_to = dol_sanitizeEmail($conf->global->MAIN_MAIL_FORCE_SENDTO);
 			$this->addr_cc = '';
 			$this->addr_bcc = '';
@@ -521,7 +521,7 @@ class CMailFile
 			//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
 			if (!empty($this->addr_from)) {
 				try {
-					if (!empty($conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING)) {
+					if (getDolGlobalString('MAIN_FORCE_DISABLE_MAIL_SPOOFING')) {
 						// Prevent email spoofing for smtp server with a strict configuration
 						$regexp = '/([a-z0-9_\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i'; // This regular expression extracts all emails from a string
 						$adressEmailFrom = array();
@@ -656,7 +656,7 @@ class CMailFile
 
 		$res = false;
 
-		if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
+		if (!getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
 			if (!is_object($hookmanager)) {
 				include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
 				$hookmanager = new HookManager($db);
@@ -677,7 +677,7 @@ class CMailFile
 			}
 
 			$sendingmode = $this->sendmode;
-			if ($this->sendcontext == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') {
+			if ($this->sendcontext == 'emailing' && getDolGlobalString('MAILING_NO_USING_PHPMAIL') && $sendingmode == 'mail') {
 				// List of sending methods
 				$listofmethods = array();
 				$listofmethods['mail'] = 'PHP mail function';
@@ -692,7 +692,7 @@ class CMailFile
 				$this->errors[] = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
 				$this->error .= '<br>'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
 				$this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
-				if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) {
+				if (getDolGlobalString('MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS')) {
 					$this->error .= '<br>'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
 					$this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
 				}
@@ -702,7 +702,7 @@ class CMailFile
 			}
 
 			// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
-			if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) {
+			if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL')) {
 				$conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL = 10;
 			}
 			$tmparray1 = explode(',', $this->addr_to);
@@ -711,7 +711,7 @@ class CMailFile
 				dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING);
 				return false;
 			}
-			if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) {
+			if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL')) {
 				$conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL = 10;
 			}
 			$tmparray2 = explode(',', $this->addr_cc);
@@ -720,7 +720,7 @@ class CMailFile
 				dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING);
 				return false;
 			}
-			if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) {
+			if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL')) {
 				$conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL = 10;
 			}
 			$tmparray3 = explode(',', $this->addr_bcc);
@@ -729,7 +729,7 @@ class CMailFile
 				dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING);
 				return false;
 			}
-			if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) {
+			if (!getDolGlobalString('MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL')) {
 				$conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL = 10;
 			}
 			if ((count($tmparray1) + count($tmparray2) + count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) {
@@ -803,18 +803,18 @@ class CMailFile
 
 				if ($res) {
 					$additionnalparam = ''; // By default
-					if (!empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) {
+					if (getDolGlobalString('MAIN_MAIL_ALLOW_SENDMAIL_F')) {
 						// le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA
 						// Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie.
 						// Having this variable defined may create problems with some sendmail (option -f refused)
 						// Having this variable not defined may create problems with some other sendmail (option -f required)
-						$additionnalparam .= ($additionnalparam ? ' ' : '').(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f'.$this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f'.$this->getValidAddress($this->addr_from, 2) : ''));
+						$additionnalparam .= ($additionnalparam ? ' ' : '').(getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '-f'.$this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f'.$this->getValidAddress($this->addr_from, 2) : ''));
 					}
-					if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) {    // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender
+					if (getDolGlobalString('MAIN_MAIL_SENDMAIL_FORCE_BA')) {    // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender
 						$additionnalparam .= ($additionnalparam ? ' ' : '').'-ba';
 					}
 
-					if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) {
+					if (getDolGlobalString('MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM')) {
 						$additionnalparam .= ($additionnalparam ? ' ' : '').'-U '.$additionnalparam; // Use -U to add additionnal params
 					}
 
@@ -830,7 +830,7 @@ class CMailFile
 
 					$this->message = stripslashes($this->message);
 
-					if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+					if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 						$this->dump_mail();
 					}
 
@@ -856,7 +856,7 @@ class CMailFile
 						$this->error .= $langs->trans("ErrorPhpMailDelivery");
 						dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
 
-						if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+						if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 							$this->save_dump_mail_in_err('Mail with topic '.$this->subject);
 						}
 					} else {
@@ -999,13 +999,13 @@ class CMailFile
 				if ($res) {
 					dol_syslog("CMailFile::sendfile: sendMsg, HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport), LOG_DEBUG);
 
-					if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+					if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 						$this->smtps->setDebug(true);
 					}
 
 					$result = $this->smtps->sendMsg();
 
-					if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+					if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 						$this->dump_mail();
 					}
 
@@ -1040,7 +1040,7 @@ class CMailFile
 						dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport)." - ".$this->error, LOG_ERR);
 						$res = false;
 
-						if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+						if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 							$this->save_dump_mail_in_err('Mail smtp error '.$smtperrorcode.' with topic '.$this->subject);
 						}
 					}
@@ -1158,7 +1158,7 @@ class CMailFile
 					$this->message->attachSigner($signer->ignoreHeader('Return-Path'));
 				}
 
-				if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+				if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 					// To use the ArrayLogger
 					$this->logger = new Swift_Plugins_Loggers_ArrayLogger();
 					// Or to use the Echo Logger
@@ -1175,7 +1175,7 @@ class CMailFile
 				} catch (Exception $e) {
 					$this->errors[] = $e->getMessage();
 				}
-				if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+				if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 					$this->dump_mail();
 				}
 
@@ -1187,7 +1187,7 @@ class CMailFile
 					dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
 					$res = false;
 
-					if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
+					if (getDolGlobalString('MAIN_MAIL_DEBUG')) {
 						$this->save_dump_mail_in_err('Mail with topic '.$this->subject);
 					}
 				} else {
@@ -1415,7 +1415,7 @@ class CMailFile
 		// Sender
 		//$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2;
 		$out .= "From: ".$this->getValidAddress($this->addr_from, 3, 1).$this->eol2;
-		if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) {
+		if (getDolGlobalString('MAIN_MAIL_SENDMAIL_FORCE_BA')) {
 			$out .= "To: ".$this->getValidAddress($this->addr_to, 0, 1).$this->eol2;
 		}
 		// Return-Path is important because it is used by SPF. Some MTA does not read Return-Path from header but from command line. See option MAIN_MAIL_ALLOW_SENDMAIL_F for that.
@@ -1526,7 +1526,7 @@ class CMailFile
 
 		// Make RFC821 Compliant, replace bare linefeeds
 		$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $msgtext); // PCRE modifier /s means new lines are common chars
-		if (!empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
+		if (getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
 			$strContent = preg_replace("/\r\n/si", "\n", $strContent); // PCRE modifier /s means new lines are common chars
 		}
 
@@ -1536,7 +1536,7 @@ class CMailFile
 			$strContentAltText = preg_replace("/<br\s*[^>]*>/", " ", $strContent);
 			// TODO We could replace <img ...> with [Filename.ext] like Gmail do.
 			$strContentAltText = html_entity_decode(strip_tags($strContentAltText));	// Remove any HTML tags
-			$strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n"));
+			$strContentAltText = trim(wordwrap($strContentAltText, 75, !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA') ? "\r\n" : "\n"));
 
 			// Check if html header already in message, if not complete the message
 			$strContent = $this->checkIfHTML($strContent);
@@ -1545,7 +1545,7 @@ class CMailFile
 		// Make RFC2045 Compliant, split lines
 		//$strContent = rtrim(chunk_split($strContent));    // Function chunck_split seems ko if not used on a base64 content
 		// TODO Encode main content into base64 and use the chunk_split, or quoted-printable
-		$strContent = rtrim(wordwrap($strContent, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); // TODO Using this method creates unexpected line break on text/plain content.
+		$strContent = rtrim(wordwrap($strContent, 75, !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA') ? "\r\n" : "\n")); // TODO Using this method creates unexpected line break on text/plain content.
 
 		if ($this->msgishtml) {
 			if ($this->atleastoneimage) {
@@ -1558,7 +1558,7 @@ class CMailFile
 				$out .= "--".$this->related_boundary.$this->eol;
 			}
 
-			if (!$this->atleastoneimage && $strContentAltText && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {    // Add plain text message part before html part
+			if (!$this->atleastoneimage && $strContentAltText && getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) {    // Add plain text message part before html part
 				$out .= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol;
 				$out .= $this->eol;
 				$out .= "--".$this->alternative_boundary.$this->eol;
@@ -1572,7 +1572,7 @@ class CMailFile
 			//$out.= "Content-Transfer-Encoding: 7bit".$this->eol;	// TODO Use base64
 			$out .= $this->eol.$strContent.$this->eol;
 
-			if (!$this->atleastoneimage && $strContentAltText && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {    // Add plain text message part after html part
+			if (!$this->atleastoneimage && $strContentAltText && getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) {    // Add plain text message part after html part
 				$out .= "--".$this->alternative_boundary."--".$this->eol;
 			}
 		} else {
@@ -2010,7 +2010,7 @@ class CMailFile
 					$newemail = '<'.$email.'>';
 				}
 				if ($format == 0 || $format == 3) {
-					if (!empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)) {
+					if (getDolGlobalString('MAIN_MAIL_NO_FULL_EMAIL')) {
 						$newemail = '<'.$email.'>';
 					} elseif (!$name) {
 						$newemail = '<'.$email.'>';
@@ -2059,7 +2059,7 @@ class CMailFile
 				$email = trim($val);
 			}
 
-			$ret[$email] = empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL) ? $name : null;
+			$ret[$email] = !getDolGlobalString('MAIN_MAIL_NO_FULL_EMAIL') ? $name : null;
 		}
 
 		return $ret;

+ 3 - 3
htdocs/core/class/CSMSFile.class.php

@@ -136,11 +136,11 @@ class CSMSFile
 
 		$this->message = stripslashes($this->message);
 
-		if (!empty($conf->global->MAIN_SMS_DEBUG)) {
+		if (getDolGlobalString('MAIN_SMS_DEBUG')) {
 			$this->dump_sms();
 		}
 
-		if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) {
+		if (!getDolGlobalString('MAIN_DISABLE_ALL_SMS')) {
 			// Action according to the choosed sending method
 			if (getDolGlobalString('MAIN_SMS_SENDMODE')) {
 				$sendmode = getDolGlobalString('MAIN_SMS_SENDMODE');	// $conf->global->MAIN_SMS_SENDMODE looks like a value 'module'
@@ -180,7 +180,7 @@ class CSMSFile
 						} else {
 							dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG);
 							//var_dump($res);        // 1973128
-							if (!empty($conf->global->MAIN_SMS_DEBUG)) {
+							if (getDolGlobalString('MAIN_SMS_DEBUG')) {
 								$this->dump_sms_result($res);
 							}
 						}

+ 6 - 6
htdocs/core/class/commoninvoice.class.php

@@ -548,7 +548,7 @@ abstract class CommonInvoice extends CommonObject
 			return 1;
 		}
 
-		if (!empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) {
+		if (getDolGlobalString('INVOICE_CAN_NEVER_BE_REMOVED')) {
 			return 0;
 		}
 
@@ -568,7 +568,7 @@ abstract class CommonInvoice extends CommonObject
 
 				// If there is no invoice into the reset range and not already dispatched, we can delete
 				// If invoice to delete is last one and not already dispatched, we can delete
-				if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $maxref != '' && $maxref != $this->ref) {
+				if (!getDolGlobalString('INVOICE_CAN_ALWAYS_BE_REMOVED') && $maxref != '' && $maxref != $this->ref) {
 					return -2;
 				}
 
@@ -585,7 +585,7 @@ abstract class CommonInvoice extends CommonObject
 		}
 
 		// Test if there is at least one payment. If yes, refuse to delete.
-		if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $this->getSommePaiement() > 0) {
+		if (!getDolGlobalString('INVOICE_CAN_ALWAYS_BE_REMOVED') && $this->getSommePaiement() > 0) {
 			return -4;
 		}
 
@@ -1099,16 +1099,16 @@ abstract class CommonInvoice extends CommonObject
 	{
 		global $conf, $user, $langs;
 
-		if ($type != 'bank-transfer' && $type != 'credit-transfer' && empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) {
+		if ($type != 'bank-transfer' && $type != 'credit-transfer' && !getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT')) {
 			return 0;
 		}
-		if ($type != 'direct-debit' && empty($conf->global->STRIPE_SEPA_CREDIT_TRANSFER)) {
+		if ($type != 'direct-debit' && !getDolGlobalString('STRIPE_SEPA_CREDIT_TRANSFER')) {
 			return 0;
 		}
 		// Set a default value for service if not provided
 		if (empty($service)) {
 			$service = 'StripeTest';
-			if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) {
+			if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) {
 				$service = 'StripeLive';
 			}
 		}

+ 16 - 16
htdocs/core/class/commonobject.class.php

@@ -1752,7 +1752,7 @@ abstract class CommonObject
 			$this->thirdparty = $thirdparty;
 
 			// Use first price level if level not defined for third party
-			if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) {
+			if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($this->thirdparty->price_level)) {
 				$this->thirdparty->price_level = 1;
 			}
 
@@ -1815,7 +1815,7 @@ abstract class CommonObject
 
 		$idtype = $this->barcode_type;
 		if (empty($idtype) && $idtype != '0') {	// If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined
-			if ($this->element == 'product' && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) {
+			if ($this->element == 'product' && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) {
 				$idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
 			} elseif ($this->element == 'societe') {
 				$idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY;
@@ -4628,7 +4628,7 @@ abstract class CommonObject
 		if (empty($id) && empty($ref)) {
 			return 0;
 		}
-		if (!empty($conf->global->MAIN_DISABLE_CANVAS)) {
+		if (getDolGlobalString('MAIN_DISABLE_CANVAS')) {
 			return 0; // To increase speed. Not enabled by default.
 		}
 
@@ -5167,7 +5167,7 @@ abstract class CommonObject
 					if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
 						$newlang = GETPOST('lang_id', 'aZ09');
 					}
-					if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang) && is_object($this->thirdparty)) {
+					if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && empty($newlang) && is_object($this->thirdparty)) {
 						$newlang = $this->thirdparty->default_lang; // To use language of customer
 					}
 					if (!empty($newlang)) {
@@ -6306,7 +6306,7 @@ abstract class CommonObject
 	{
 		global $conf;
 
-		if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
+		if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
 			return 0;
 		}
 
@@ -6346,7 +6346,7 @@ abstract class CommonObject
 	{
 		global $conf, $langs, $user;
 
-		if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
+		if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
 			return 0;
 		}
 
@@ -6403,7 +6403,7 @@ abstract class CommonObject
 				//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
 
 				if (!empty($attrfieldcomputed)) {
-					if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) {
+					if (getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) {
 						$value = dol_eval($attrfieldcomputed, 1, 0, '2');
 						dol_syslog($langs->trans("Extrafieldcomputed")." on ".$attributeLabel."(".$value.")", LOG_DEBUG);
 						$new_array_options[$key] = $value;
@@ -6650,7 +6650,7 @@ abstract class CommonObject
 
 		$error = 0;
 
-		if (!empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) {
+		if (getDolGlobalString('MAIN_EXTRALANGUAGES_DISABLED')) {
 			return 0; // For avoid conflicts if trigger used
 		}
 
@@ -6762,7 +6762,7 @@ abstract class CommonObject
 	{
 		global $conf, $langs, $user;
 
-		if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
+		if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
 			return 0;
 		}
 
@@ -6809,7 +6809,7 @@ abstract class CommonObject
 			//dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG);
 			//dol_syslog("attributeType=".$attributeType, LOG_DEBUG);
 			if (!empty($attrfieldcomputed)) {
-				if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) {
+				if (getDolGlobalString('MAIN_STORE_COMPUTED_EXTRAFIELDS')) {
 					$value = dol_eval($attrfieldcomputed, 1, 0, '2');
 					dol_syslog($langs->trans("Extrafieldcomputed")." sur ".$attributeLabel."(".$value.")", LOG_DEBUG);
 					$this->array_options["options_".$key] = $value;
@@ -7045,7 +7045,7 @@ abstract class CommonObject
 
 		$error = 0;
 
-		if (!empty($conf->global->MAIN_EXTRALANGUAGES_DISABLED)) {
+		if (getDolGlobalString('MAIN_EXTRALANGUAGES_DISABLED')) {
 			return 0; // For avoid conflicts if trigger used
 		}
 
@@ -7260,7 +7260,7 @@ abstract class CommonObject
 			$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam ? $moreparam : '').'> ';
 		} elseif ($type == 'select') {	// combo list
 			$out = '';
-			if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
+			if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) {
 				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
 				$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
 			}
@@ -7284,7 +7284,7 @@ abstract class CommonObject
 			$out .= '</select>';
 		} elseif ($type == 'sellist') {
 			$out = '';
-			if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
+			if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) {
 				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
 				$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
 			}
@@ -8586,7 +8586,7 @@ abstract class CommonObject
 
 						$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
 						if ($display_type=='card') {
-							if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) {
+							if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && ($e % 2) == 0) {
 								$colspan = 0;
 							}
 
@@ -8639,7 +8639,7 @@ abstract class CommonObject
 
 						if ($display_type == 'card') {
 							$out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="field_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$collapse_group.'" '.$domData.' >';
-							if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) {
+							if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER') && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) {
 								$out .= '<td></td>';
 							}
 							$out .= '<td class="'.(empty($params['tdclass']) ? 'titlefieldcreate' : $params['tdclass']).' wordbreak';
@@ -8698,7 +8698,7 @@ abstract class CommonObject
 
 						$out .= ($display_type=='card' ? '</td>' : '</div>');
 
-						if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) {
+						if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && (($e % 2) == 1)) {
 							$out .= ($display_type=='card' ? '</tr>' : '</div>');
 						} else {
 							$out .= ($display_type=='card' ? '</tr>' : '</div>');

+ 7 - 7
htdocs/core/class/commonpeople.class.php

@@ -131,7 +131,7 @@ trait CommonPeople
 			if (!empty($conf->use_javascript_ajax)) {
 				// Add picto with tooltip on map
 				$namecoords = '';
-				if ($this->element == 'contact' && !empty($conf->global->MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS)) {
+				if ($this->element == 'contact' && getDolGlobalString('MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
 					$namecoords .= $object->name.'<br>';
 				}
 				$namecoords .= $this->getFullName($langs, 1).'<br>'.$coords;
@@ -149,7 +149,7 @@ trait CommonPeople
 
 			// List of extra languages
 			$arrayoflangcode = array();
-			if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
+			if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
 				$arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
 			}
 
@@ -180,8 +180,8 @@ trait CommonPeople
 		}
 
 		// If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
-		if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
-				&& empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) {
+		if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
+				&& !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
 			if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
 				$out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
 			} else {
@@ -278,7 +278,7 @@ trait CommonPeople
 	{
 		global $conf;
 
-		if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
+		if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
 			$this->lastname = dol_ucwords(dol_strtolower($this->lastname));
 			$this->firstname = dol_ucwords(dol_strtolower($this->firstname));
 			$this->name = dol_ucwords(dol_strtolower($this->name));
@@ -286,14 +286,14 @@ trait CommonPeople
 				$this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):'';
 			}
 		}
-		if (!empty($conf->global->MAIN_ALL_TO_UPPER)) {
+		if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
 			$this->lastname = dol_strtoupper($this->lastname);
 			$this->name = dol_strtoupper($this->name);
 			if (property_exists($this, 'name_alias')) {
 				$this->name_alias = dol_strtoupper($this->name_alias);
 			}
 		}
-		if (!empty($conf->global->MAIN_ALL_TOWN_TO_UPPER)) {
+		if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
 			$this->address = dol_strtoupper($this->address);
 			$this->town = dol_strtoupper($this->town);
 		}

+ 2 - 0
htdocs/core/class/commonsocialnetworks.class.php

@@ -21,6 +21,8 @@
  *       \brief      File of the superclass of object classes that support socialnetworks
  */
 
+namespace Dolibarr\Traits;
+
 
 /**
  *      Superclass for social networks

+ 1 - 1
htdocs/core/class/defaultvalues.class.php

@@ -145,7 +145,7 @@ class DefaultValues extends CommonObject
 
 		$this->db = $db;
 
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
+		if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) {
 			$this->fields['rowid']['visible'] = 0;
 		}
 		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {

+ 7 - 7
htdocs/core/class/doleditor.class.php

@@ -83,7 +83,7 @@ class DolEditor
 
 		// Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor')
 		$defaulteditor = 'ckeditor';
-		$this->tool = empty($conf->global->FCKEDITOR_EDITORNAME) ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME;
+		$this->tool = !getDolGlobalString('FCKEDITOR_EDITORNAME') ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME;
 		$this->uselocalbrowser = $uselocalbrowser;
 		$this->readonly = $readonly;
 
@@ -136,7 +136,7 @@ class DolEditor
 
 		$fullpage = false;
 		if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT)) {
-			$disallowAnyContent = empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
+			$disallowAnyContent = !getDolGlobalString('FCKEDITOR_ALLOW_ANY_CONTENT'); // Only predefined list of html tags are allowed or all
 		}
 
 		$found = 0;
@@ -165,17 +165,17 @@ class DolEditor
 				if (!empty($conf->dol_optimize_smallscreen)) {
 					$pluginstodisable .= ',scayt,wsc,find,undo';
 				}
-				if (empty($conf->global->FCKEDITOR_ENABLE_WSC)) {	// spellchecker has end of life december 2021
+				if (!getDolGlobalString('FCKEDITOR_ENABLE_WSC')) {	// spellchecker has end of life december 2021
 					$pluginstodisable .= ',wsc';
 				}
-				if (empty($conf->global->FCKEDITOR_ENABLE_PDF)) {
+				if (!getDolGlobalString('FCKEDITOR_ENABLE_PDF')) {
 					$pluginstodisable .= ',exportpdf';
 				}
-				if (!empty($conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS)) {
+				if (getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS')) {
 					$this->uselocalbrowser = 0;	// Can't use browser to navigate into files. Only links with "<img src=data:..." are allowed.
 				}
 				$scaytautostartup = '';
-				if (!empty($conf->global->FCKEDITOR_ENABLE_SCAYT_AUTOSTARTUP)) {
+				if (getDolGlobalString('FCKEDITOR_ENABLE_SCAYT_AUTOSTARTUP')) {
 					$scaytautostartup = 'scayt_autoStartup: true,';
 					$scaytautostartup .= 'scayt_sLang: \''.dol_escape_js($langs->getDefaultLang()).'\',';
 				} else {
@@ -222,7 +222,7 @@ class DolEditor
                                                     });
                                                 }
                                           },
-									disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER) ? 'true' : 'false');
+									disableNativeSpellChecker: '.(!getDolGlobalString('CKEDITOR_NATIVE_SPELLCHECKER') ? 'true' : 'false');
 
 				if ($this->uselocalbrowser) {
 					$out .= ','."\n";

+ 4 - 4
htdocs/core/class/dolgeoip.class.php

@@ -52,7 +52,7 @@ class DolGeoIP
 		global $conf;
 
 		$geoipversion = '2'; // 'php', or geoip version '2'
-		if (!empty($conf->global->GEOIP_VERSION)) {
+		if (getDolGlobalString('GEOIP_VERSION')) {
 			$geoipversion = $conf->global->GEOIP_VERSION;
 		}
 
@@ -121,7 +121,7 @@ class DolGeoIP
 		global $conf;
 
 		$geoipversion = '2'; // 'php', or '2'
-		if (!empty($conf->global->GEOIP_VERSION)) {
+		if (getDolGlobalString('GEOIP_VERSION')) {
 			$geoipversion = $conf->global->GEOIP_VERSION;
 		}
 
@@ -179,7 +179,7 @@ class DolGeoIP
 		global $conf;
 
 		$geoipversion = '2'; // 'php', or '2'
-		if (!empty($conf->global->GEOIP_VERSION)) {
+		if (getDolGlobalString('GEOIP_VERSION')) {
 			$geoipversion = $conf->global->GEOIP_VERSION;
 		}
 
@@ -210,7 +210,7 @@ class DolGeoIP
 		global $conf;
 
 		$geoipversion = '2'; // 'php', or '2'
-		if (!empty($conf->global->GEOIP_VERSION)) {
+		if (getDolGlobalString('GEOIP_VERSION')) {
 			$geoipversion = $conf->global->GEOIP_VERSION;
 		}
 

+ 1 - 1
htdocs/core/class/dolgraph.class.php

@@ -136,7 +136,7 @@ class DolGraph
 
 		$this->_library = $library;
 		if ($this->_library == 'auto') {
-			$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'chart' : $conf->global->MAIN_JS_GRAPH);
+			$this->_library = (!getDolGlobalString('MAIN_JS_GRAPH') ? 'chart' : $conf->global->MAIN_JS_GRAPH);
 		}
 	}
 

+ 1 - 1
htdocs/core/class/dolreceiptprinter.class.php

@@ -694,7 +694,7 @@ class dolReceiptPrinter extends Printer
 		//print '<pre>'.print_r($vals, true).'</pre>';
 		// print ticket
 		$level = 0;
-		$nbcharactbyline = (!empty($conf->global->RECEIPT_PRINTER_NB_CHARACT_BY_LINE) ? $conf->global->RECEIPT_PRINTER_NB_CHARACT_BY_LINE : 48);
+		$nbcharactbyline = (getDolGlobalString('RECEIPT_PRINTER_NB_CHARACT_BY_LINE') ? $conf->global->RECEIPT_PRINTER_NB_CHARACT_BY_LINE : 48);
 		$ret = $this->initPrinter($printerid);
 		if ($ret > 0) {
 			setEventMessages($this->error, $this->errors, 'errors');

+ 1 - 1
htdocs/core/class/emailsenderprofile.class.php

@@ -146,7 +146,7 @@ class EmailSenderProfile extends CommonObject
 
 		$this->db = $db;
 
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
+		if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) {
 			$this->fields['rowid']['visible'] = 0;
 		}
 		if (!isModEnabled('multicompany')) {

+ 5 - 5
htdocs/core/class/extrafields.class.php

@@ -1167,9 +1167,9 @@ class ExtraFields
 					$selected = explode(',', $value);
 				}
 
-				$out .= $form->multiselectarray($keyprefix.$key.$keysuffix, $options, $selected, 0, 0, $morecss, 0, 0, '', '', '', !empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2));
+				$out .= $form->multiselectarray($keyprefix.$key.$keysuffix, $options, $selected, 0, 0, $morecss, 0, 0, '', '', '', !empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2'));
 			} else {
-				if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
+				if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) {
 					include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
 					$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
 				}
@@ -1201,7 +1201,7 @@ class ExtraFields
 			}
 		} elseif ($type == 'sellist') {
 			$out = '';
-			if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) {
+			if (!empty($conf->use_javascript_ajax) && !getDolGlobalString('MAIN_EXTRAFIELDS_DISABLE_SELECT2')) {
 				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
 				$out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
 			}
@@ -2211,10 +2211,10 @@ class ExtraFields
 				} elseif (in_array($key_type, array('text'))) {
 					$label_security_check = 'alphanohtml';
 					// by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html
-					if (!empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS)) {
+					if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) {
 						$label_security_check = 'nohtml';
 					} else {
-						$label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml';
+						$label_security_check = !getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ? 'alphanohtml' : 'restricthtml';
 					}
 					$value_key = GETPOST("options_".$key, $label_security_check);
 				} else {

+ 1 - 1
htdocs/core/class/extralanguages.class.php

@@ -99,7 +99,7 @@ class ExtraLanguages
 
 
 		$array_name_label = array();
-		if (!empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) {
+		if (getDolGlobalString('MAIN_USE_ALTERNATE_TRANSLATION_FOR')) {
 			$tmpelement = explode(';', $conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR);
 			foreach ($tmpelement as $elementstring) {
 				$reg = array();

+ 1 - 1
htdocs/core/class/fiscalyear.class.php

@@ -358,7 +358,7 @@ class Fiscalyear extends CommonObject
 
 		$linkclose = '';
 		if (empty($notooltip) && $user->hasRight('accounting', 'fiscalyear', 'write')) {
-			if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 				$label = $langs->trans("FiscalYear");
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
 			}

+ 116 - 116
htdocs/core/class/html.form.class.php

@@ -116,7 +116,7 @@ class Form
 		$ret = '';
 
 		// TODO change for compatibility
-		if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;/', $typeofdata)) {
+		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
 			if (!empty($perm)) {
 				$tmp = explode(':', $typeofdata);
 				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
@@ -242,7 +242,7 @@ class Form
 		}
 
 		// When option to edit inline is activated
-		if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
+		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;|day|datepicker|dayhour|datehourpicker/', $typeofdata)) { // TODO add jquery timepicker and support select
 			$ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg);
 		} else {
 			if ($editaction == '') {
@@ -378,7 +378,7 @@ class Form
 					}
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
 					$tmpcontent = dol_htmlentitiesbr($value);
-					if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
+					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
 						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
@@ -422,7 +422,7 @@ class Form
 
 		// List of extra languages
 		$arrayoflangcode = array();
-		if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
+		if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
 			$arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
 		}
 
@@ -1324,7 +1324,7 @@ class Form
 
 		$out = '';
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && !$forcecombo) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT') && !$forcecombo) {
 			if (is_null($ajaxoptions)) {
 				$ajaxoptions = array();
 			}
@@ -1353,7 +1353,7 @@ class Form
 					$out .= img_picto($langs->trans("Search"), 'search');
 				}
 			}
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
+			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
 			if ($hidelabel == 3) {
 				$out .= img_picto($langs->trans("Search"), 'search');
 			}
@@ -1440,12 +1440,12 @@ class Form
 
 		// We search companies
 		$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.tva_intra, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
-		if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
+		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
 			$sql .= ", s.address, s.zip, s.town";
 			$sql .= ", dictp.code as country_code";
 		}
 		$sql .= " FROM " . $this->db->prefix() . "societe as s";
-		if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
+		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
 			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
 		}
 		if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
@@ -1463,7 +1463,7 @@ class Form
 		if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
 			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
 		}
-		if (!empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) {
+		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
 			$sql .= " AND s.status <> 0";
 		}
 		if (!empty($excludeids)) {
@@ -1476,7 +1476,7 @@ class Form
 		// Add criteria
 		if ($filterkey && $filterkey != '') {
 			$sql .= " AND (";
-			$prefix = empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if COMPANY_DONOTSEARCH_ANYWHERE is on
+			$prefix = !getDolGlobalString('COMPANY_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if COMPANY_DONOTSEARCH_ANYWHERE is on
 			// For natural search
 			$scrit = explode(' ', $filterkey);
 			$i = 0;
@@ -1516,7 +1516,7 @@ class Form
 			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
 
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
-			if (!empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
+			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
 				// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
 				//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
 				if ($showempty && !is_numeric($showempty)) {
@@ -1537,7 +1537,7 @@ class Form
 				while ($i < $num) {
 					$obj = $this->db->fetch_object($resql);
 					$label = '';
-					if ($showcode || !empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
+					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
 						if (($obj->client) && (!empty($obj->code_client))) {
 							$label = $obj->code_client . ' - ';
 						}
@@ -1553,7 +1553,7 @@ class Form
 						$label .= ' (' . $obj->name_alias . ')';
 					}
 
-					if (!empty($conf->global->SOCIETE_SHOW_VAT_IN_LIST) && !empty($obj->tva_intra)) {
+					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
 						$label .= ' - '.$obj->tva_intra;
 					}
 
@@ -1585,7 +1585,7 @@ class Form
 						}
 					}
 
-					if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
+					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
 						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
 						if (!empty($obj->country_code)) {
 							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
@@ -1690,7 +1690,7 @@ class Form
 						$disabled = ' disabled';
 					}
 
-					if (!empty($conf->global->MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST) && !empty($obj->fk_facture_source)) {
+					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
 						$tmpfac = new Facture($this->db);
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
 							$desc = $desc . ' - ' . $tmpfac->ref;
@@ -1789,18 +1789,18 @@ class Form
 
 		// We search third parties
 		$sql = "SELECT sp.rowid, sp.lastname, sp.statut, sp.firstname, sp.poste, sp.email, sp.phone, sp.phone_perso, sp.phone_mobile, sp.town AS contact_town";
-		if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
+		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
 			$sql .= ", s.nom as company, s.town AS company_town";
 		}
 		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
-		if ($showsoc > 0 || !empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
+		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
 			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
 		}
 		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
 		if ($socid > 0 || $socid == -1) {
 			$sql .= " AND sp.fk_soc = " . ((int) $socid);
 		}
-		if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
+		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
 			$sql .= " AND sp.statut <> 0";
 		}
 		// Add where from hooks
@@ -1840,7 +1840,7 @@ class Form
 
 					// Set email (or phones) and town extended infos
 					$extendedInfos = '';
-					if (!empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) {
+					if (getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
 						$extendedInfos = array();
 						$email = trim($obj->email);
 						if (!empty($email)) {
@@ -2018,7 +2018,7 @@ class Form
 		global $action;
 
 		// If no preselected user defined, we take current user
-		if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) {
+		if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) {
 			$selected = $user->id;
 		}
 
@@ -2079,7 +2079,7 @@ class Form
 		if ($includeUsers) {
 			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
 		}
-		if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $notdisabled) {
+		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
 			$sql .= " AND u.statut <> 0";
 		}
 		if (!empty($morefilter)) {
@@ -2092,7 +2092,7 @@ class Form
 			$sql .= $hookmanager->resPrint;
 		}
 
-		if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {    // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
+		if (!getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION')) {    // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
 			$sql .= " ORDER BY u.statut DESC, u.firstname ASC, u.lastname ASC";
 		} else {
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
@@ -2144,7 +2144,7 @@ class Form
 
 					// $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0)
 					$fullNameMode = 0;
-					if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {
+					if (!getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION')) {
 						$fullNameMode = 1; //Firstname+lastname
 					}
 					$labeltoshow .= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
@@ -2157,7 +2157,7 @@ class Form
 					// Complete name with a more info string like: ' (info1 - info2 - ...)'
 					$moreinfo = '';
 					$moreinfohtml = '';
-					if (!empty($conf->global->MAIN_SHOW_LOGIN)) {
+					if (getDolGlobalString('MAIN_SHOW_LOGIN')) {
 						$moreinfo .= ($moreinfo ? ' - ' : ' (');
 						$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(');
 						$moreinfo .= $obj->login;
@@ -2485,7 +2485,7 @@ class Form
 			}
 		}
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
 			$placeholder = '';
 
 			if ($selected && empty($selected_input_value)) {
@@ -2591,7 +2591,7 @@ class Form
 					$out .= img_picto($langs->trans("Search"), 'search');
 				}
 			}
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
+			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
 			if ($hidelabel == 3) {
 				$out .= img_picto($langs->trans("Search"), 'search');
 			}
@@ -2747,7 +2747,7 @@ class Form
 			$sql .= $hookmanager->resPrint;
 		}
 
-		if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
+		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
 			//Product category
 			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
 						FROM " . $this->db->prefix() . "categorie_product
@@ -2757,7 +2757,7 @@ class Form
 		}
 
 		//Price by customer
-		if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
+		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
 			$sql .= ', pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,';
 			$sql .= ' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx, pcp.default_vat_code as custdefault_vat_code, pcp.ref_customer as custref';
 			$selectFields .= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx, custdefault_vat_code, custref";
@@ -2776,15 +2776,15 @@ class Form
 			$selectFields .= ", description_translated";
 		}
 		// Price by quantity
-		if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
+		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
 			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
-			if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
+			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
 				$sql .= " AND price_level = " . ((int) $price_level);
 			}
 			$sql .= " ORDER BY date_price";
 			$sql .= " DESC LIMIT 1) as price_rowid";
 			$sql .= ", (SELECT pp.price_by_qty FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid"; // price_by_qty is 1 if some prices by qty exists in subtable
-			if ($price_level >= 1 && !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
+			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
 				$sql .= " AND price_level = " . ((int) $price_level);
 			}
 			$sql .= " ORDER BY date_price";
@@ -2805,12 +2805,12 @@ class Form
 		}
 
 		// include search in supplier ref
-		if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
+		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
 			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
 		}
 
 		//Price by customer
-		if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
+		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
 			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
 		}
 		// Units
@@ -2820,7 +2820,7 @@ class Form
 		// Multilang : we add translation
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
 			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
-			if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && !empty($socid)) {
+			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
 				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
 				$soc = new Societe($this->db);
 				$result = $soc->fetch($socid);
@@ -2834,13 +2834,13 @@ class Form
 			}
 		}
 
-		if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
+		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
 			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
 		}
 
 		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
 
-		if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
+		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
 			$sql .= " AND pac.rowid IS NULL";
 		}
 
@@ -2872,7 +2872,7 @@ class Form
 		// Add criteria on ref/label
 		if ($filterkey != '') {
 			$sql .= ' AND (';
-			$prefix = empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
+			$prefix = !getDolGlobalString('PRODUCT_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
 			// For natural search
 			$scrit = explode(' ', $filterkey);
 			$i = 0;
@@ -2887,16 +2887,16 @@ class Form
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
 					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
 				}
-				if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
+				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) {
 					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
 				}
-				if (!empty($conf->global->PRODUCT_AJAX_SEARCH_ON_DESCRIPTION)) {
+				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
 					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
 						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
 					}
 				}
-				if (!empty($conf->global->MAIN_SEARCH_PRODUCT_BY_FOURN_REF)) {
+				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
 					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
 				}
 				$sql .= ")";
@@ -2915,7 +2915,7 @@ class Form
 		}
 
 		//Sort by category
-		if (!empty($conf->global->PRODUCT_SORT_BY_CATEGORY)) {
+		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
 			$sql .= " ORDER BY categorie_product_id ";
 			//ASC OR DESC order
 			(getDolGlobalInt('PRODUCT_SORT_BY_CATEGORY') == 1) ? $sql .= "ASC" : $sql .= "DESC";
@@ -2947,7 +2947,7 @@ class Form
 			$textifempty = '';
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
-			if (!empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
+			if (getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
 				if ($showempty && !is_numeric($showempty)) {
 					$textifempty = $langs->trans($showempty);
 				} else {
@@ -2968,7 +2968,7 @@ class Form
 				$optJson = array();
 				$objp = $this->db->fetch_object($result);
 
-				if ((!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
+				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !empty($objp->price_by_qty) && $objp->price_by_qty == 1) { // Price by quantity will return many prices for the same product
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
 					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
 					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
@@ -3089,7 +3089,7 @@ class Form
 		$outqty = 1;
 		$outdiscount = 0;
 
-		$maxlengtharticle = (empty($conf->global->PRODUCT_MAX_LENGTH_COMBO) ? 48 : $conf->global->PRODUCT_MAX_LENGTH_COMBO);
+		$maxlengtharticle = (!getDolGlobalString('PRODUCT_MAX_LENGTH_COMBO') ? 48 : $conf->global->PRODUCT_MAX_LENGTH_COMBO);
 
 		$label = $objp->label;
 		if (!empty($objp->label_translated)) {
@@ -3116,7 +3116,7 @@ class Form
 		$outdurationvalue = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : '';
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
 
-		if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
+		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
 			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
 		}
 
@@ -3127,7 +3127,7 @@ class Form
 				$outvalUnits .= ' - ' . $objp->unit_short;
 			}
 		}
-		if (!empty($conf->global->PRODUCT_SHOW_DIMENSIONS_IN_COMBO)) {
+		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
 				$outvalUnits .= ' - ' . $unitToShow;
@@ -3163,7 +3163,7 @@ class Form
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
 			$opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqup="' . $objp->price_by_qty_unitprice . '" data-pbqbase="' . $objp->price_by_qty_price_base_type . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"';
 		}
-		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
+		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
 			if ($user->hasRight('stock', 'lire')) {
 				if ($objp->stock > 0) {
 					$opt .= ' class="product_line_stock_ok"';
@@ -3172,7 +3172,7 @@ class Form
 				}
 			}
 		}
-		if (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
+		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
 			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
 			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
 		}
@@ -3185,7 +3185,7 @@ class Form
 			$opt .= ' (' . $outbarcode . ')';
 		}
 		$opt .= ' - ' . dol_trunc($label, $maxlengtharticle);
-		if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
+		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
 			$opt .= ' (' . getCountry($outorigin, 1) . ')';
 		}
 
@@ -3201,7 +3201,7 @@ class Form
 			$outval .= ' (' . $outbarcode . ')';
 		}
 		$outval .= ' - ' . dol_trunc($label, $maxlengtharticle);
-		if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) {
+		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
 			$outval .= ' (' . getCountry($outorigin, 1) . ')';
 		}
 
@@ -3213,7 +3213,7 @@ class Form
 
 		// Multiprice
 		// If we need a particular price level (from 1 to n)
-		if (empty($hidepriceinlabel) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
+		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) {
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
 			$sql .= " FROM " . $this->db->prefix() . "product_price";
 			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
@@ -3238,7 +3238,7 @@ class Form
 					$outprice_ht = price($objp2->price);
 					$outprice_ttc = price($objp2->price_ttc);
 					$outpricebasetype = $objp2->price_base_type;
-					if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {  // using this option is a bug. kept for backward compatibility
+					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
 						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
 						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
 					} else {
@@ -3252,7 +3252,7 @@ class Form
 		}
 
 		// Price by quantity
-		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1 && (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) {
+		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1 && (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) {
 			$found = 1;
 			$outqty = $objp->quantity;
 			$outdiscount = $objp->remise_percent;
@@ -3284,7 +3284,7 @@ class Form
 		}
 
 		// Price by customer
-		if (empty($hidepriceinlabel) && !empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
+		if (empty($hidepriceinlabel) && getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
 			if (!empty($objp->idprodcustprice)) {
 				$found = 1;
 
@@ -3320,7 +3320,7 @@ class Form
 			$outdefault_vat_code = $objp->default_vat_code;
 		}
 
-		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
+		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
 			if ($user->hasRight('stock', 'lire')) {
 				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
 
@@ -3331,7 +3331,7 @@ class Form
 				}
 				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
 				$outval .= '</span>';
-				if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) {  // Warning, this option may slow down combo list generation
+				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
 					$langs->load("stocks");
 
 					$tmpproduct = new Product($this->db);
@@ -3417,7 +3417,7 @@ class Form
 		}
 
 		$selected_input_value = '';
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
 			if ($selected > 0) {
 				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
 				$producttmpselect = new Product($this->db);
@@ -3465,7 +3465,7 @@ class Form
 		$out = '';
 		$outarray = array();
 
-		$maxlengtharticle = (empty($conf->global->PRODUCT_MAX_LENGTH_COMBO) ? 48 : $conf->global->PRODUCT_MAX_LENGTH_COMBO);
+		$maxlengtharticle = (!getDolGlobalString('PRODUCT_MAX_LENGTH_COMBO') ? 48 : $conf->global->PRODUCT_MAX_LENGTH_COMBO);
 
 		$langs->load('stocks');
 		// Units
@@ -3478,7 +3478,7 @@ class Form
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, pfp.default_vat_code, pfp.fk_soc, s.nom as name,";
 		$sql .= " pfp.supplier_reputation";
 		// if we use supplier description of the products
-		if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
+		if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
 			$sql .= ", pfp.desc_fourn as description";
 		} else {
 			$sql .= ", p.description";
@@ -3517,7 +3517,7 @@ class Form
 		// Add criteria on ref/label
 		if ($filterkey != '') {
 			$sql .= ' AND (';
-			$prefix = empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
+			$prefix = !getDolGlobalString('PRODUCT_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
 			// For natural search
 			$scrit = explode(' ', $filterkey);
 			$i = 0;
@@ -3529,7 +3529,7 @@ class Form
 					$sql .= " AND ";
 				}
 				$sql .= "(pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
-				if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) {
+				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
 					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
 				}
 				$sql .= ")";
@@ -3699,20 +3699,20 @@ class Form
 						}
 					}
 					if ($objp->quantity == 1) {
-						$optlabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
-						$outvallabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
+						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
+						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
 						$outvallabel .= $langs->transnoentities("Unit");
 					} else {
-						$optlabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
-						$outvallabel .= ' - ' . price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
+						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
+						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
 						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
 						$outvallabel .= ' ' . $langs->transnoentities("Units");
 					}
 
 					if ($objp->quantity > 1) {
-						$optlabel .= " (" . price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
-						$outvallabel .= " (" . price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
+						$optlabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
+						$outvallabel .= " (" . price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
 					}
 					if ($objp->remise_percent >= 1) {
 						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
@@ -3744,7 +3744,7 @@ class Form
 					}
 				}
 
-				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
+				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
 					$novirtualstock = ($showstockinlist == 2);
 
 					if ($user->hasRight('stock', 'lire')) {
@@ -3757,7 +3757,7 @@ class Form
 						}
 						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
 						$optlabel .= '</span>';
-						if (empty($novirtualstock) && !empty($conf->global->STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO)) {  // Warning, this option may slow down combo list generation
+						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
 							$langs->load("stocks");
 
 							$tmpproduct = new Product($this->db);
@@ -3912,7 +3912,7 @@ class Form
 		$sql .= " AND p.tobuy = 1";
 		$sql .= " AND s.fournisseur = 1";
 		$sql .= " AND p.rowid = " . ((int) $productid);
-		if (empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED)) {
+		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
 		} else {
 			$sql .= " ORDER BY pfp.unitprice ASC";
@@ -3938,7 +3938,7 @@ class Form
 
 					$opt = '<option value="' . $objp->idprodfournprice . '"';
 					//if there is only one supplier, preselect it
-					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && !empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED))) {
+					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
 						$opt .= ' selected';
 					}
 					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
@@ -3962,7 +3962,7 @@ class Form
 						}
 					}
 					if ($objp->quantity == 1) {
-						$opt .= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
 					}
 
 					$opt .= $objp->quantity . ' ';
@@ -3974,7 +3974,7 @@ class Form
 					}
 					if ($objp->quantity > 1) {
 						$opt .= " - ";
-						$opt .= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit");
+						$opt .= price($objp->unitprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit");
 					}
 					if ($objp->duration) {
 						$opt .= " - " . $objp->duration;
@@ -4329,7 +4329,7 @@ class Form
 		$this->load_cache_conditions_paiements();
 
 		// Set default value if not already set by caller
-		if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) {
+		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
 			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
 			$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
 		}
@@ -4434,7 +4434,7 @@ class Form
 		$this->load_cache_types_paiements();
 
 		// Set default value if not already set by caller
-		if (empty($selected) && !empty($conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID)) {
+		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
 			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
 			$selected = $conf->global->MAIN_DEFAULT_PAYMENT_TYPE_ID;
 		}
@@ -6049,7 +6049,7 @@ class Form
 			print '<input type="hidden" name="token" value="' . newToken() . '">';
 			print '<div class="inline-block">';
 			if (!empty($discount_type)) {
-				if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) {
+				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
 					if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") {
 						$translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice
 					} else {
@@ -6063,7 +6063,7 @@ class Form
 					}
 				}
 			} else {
-				if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+				if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
 					if (!$filter || $filter == "fk_facture_source IS NULL") {
 						$translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice
 					} else {
@@ -6149,7 +6149,7 @@ class Form
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
 			$num = $this->num;
 			if ($num == 0) {
-				$addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
+				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
 				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
 			}
 			print '</td>';
@@ -6499,7 +6499,7 @@ class Form
 		} else {
 			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
 		}
-		if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) {    // If option to have vat for end customer for services is on
+		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
 			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
 			if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
 				// We also add the buyer country code
@@ -6542,7 +6542,7 @@ class Form
 			// If we fails to find a default vat rate, we take the last one in list
 			// Because they are sorted in ascending order, the last one will be the higher one (we suppose the higher one is the current rate)
 			if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) {
-				if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) {
+				if (!getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS')) {
 					// We take the last one found in list
 					$defaulttx = $this->cache_vatrates[$num - 1]['txtva'];
 				} else {
@@ -6564,7 +6564,7 @@ class Form
 			if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") {
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
 				// of using supplier invoices (this is a very bad idea !)
-				if (empty($conf->global->EXPENSEREPORT_OVERRIDE_VAT)) {
+				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
 					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
 					$disabled = true;
 				}
@@ -6606,7 +6606,7 @@ class Form
 				$return .= '>';
 
 				// Show label of VAT
-				if ($mysoc->country_code == 'IN' || !empty($conf->global->MAIN_VAT_LABEL_IS_POSITIVE_RATES)) {
+				if ($mysoc->country_code == 'IN' || getDolGlobalString('MAIN_VAT_LABEL_IS_POSITIVE_RATES')) {
 					// Label with all localtax and code. For example:  x.y / a.b / c.d (CODE)'
 					$return .= $rate['labelpositiverates'];
 				} else {
@@ -6812,8 +6812,8 @@ class Form
 
 		// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
 		$usecalendar = 'combo';
-		if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) {
-			$usecalendar = ((empty($conf->global->MAIN_POPUP_CALENDAR) || getDolGlobalString('MAIN_POPUP_CALENDAR') == 'eldy') ? 'jquery' : $conf->global->MAIN_POPUP_CALENDAR);
+		if (!empty($conf->use_javascript_ajax) && (!getDolGlobalString('MAIN_POPUP_CALENDAR') || $conf->global->MAIN_POPUP_CALENDAR != "none")) {
+			$usecalendar = ((!getDolGlobalString('MAIN_POPUP_CALENDAR') || getDolGlobalString('MAIN_POPUP_CALENDAR') == 'eldy') ? 'jquery' : $conf->global->MAIN_POPUP_CALENDAR);
 		}
 
 		if ($d) {
@@ -6872,7 +6872,7 @@ class Form
 								";
 						}
 						// Note: We don't need monthNames, monthNamesShort, dayNames, dayNamesShort, dayNamesMin, they are set globally on datepicker component in lib_head.js.php
-						if (empty($conf->global->MAIN_POPUP_CALENDAR_ON_FOCUS)) {
+						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
 							$retstring .= "
 								showOn: 'button',	/* both has problem with autocompletion */
 								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
@@ -7093,7 +7093,7 @@ class Form
 				}
 			}
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
-			if ($reset_scripts && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
 				$retstring .= $langs->trans("Now");
 				$retstring .= '</button> ';
@@ -7326,7 +7326,7 @@ class Form
 		// check parameters
 		if (is_null($ajaxoptions)) $ajaxoptions = array();
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) {
 			$placeholder = '';
 
 			if ($selected && empty($selected_input_value)) {
@@ -7347,7 +7347,7 @@ class Form
 					$out .= img_picto($langs->trans("Search"), 'search');
 				}
 			}
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
+			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
 			if ($hidelabel == 3) {
 				$out .= img_picto($langs->trans("Search"), 'search');
 			}
@@ -7397,7 +7397,7 @@ class Form
 		// Add criteria on ref/label
 		if ($filterkey != '') {
 			$sql .= ' AND (';
-			$prefix = empty($conf->global->TICKET_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
+			$prefix = !getDolGlobalString('TICKET_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
 			// For natural search
 			$scrit = explode(' ', $filterkey);
 			$i = 0;
@@ -7435,7 +7435,7 @@ class Form
 			$textifempty = '';
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
-			if (!empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
+			if (getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) {
 				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
 				else $textifempty .= $langs->trans("All");
 			} else {
@@ -7534,7 +7534,7 @@ class Form
 		// check parameters
 		if (is_null($ajaxoptions)) $ajaxoptions = array();
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) {
 			$placeholder = '';
 
 			if ($selected && empty($selected_input_value)) {
@@ -7555,7 +7555,7 @@ class Form
 					$out .= img_picto($langs->trans("Search"), 'search');
 				}
 			}
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
+			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
 			if ($hidelabel == 3) {
 				$out .= img_picto($langs->trans("Search"), 'search');
 			}
@@ -7604,7 +7604,7 @@ class Form
 		// Add criteria on ref/label
 		if ($filterkey != '') {
 			$sql .= ' AND (';
-			$prefix = empty($conf->global->TICKET_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
+			$prefix = !getDolGlobalString('TICKET_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
 			// For natural search
 			$scrit = explode(' ', $filterkey);
 			$i = 0;
@@ -7642,7 +7642,7 @@ class Form
 			$textifempty = '';
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
-			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
+			if (getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT')) {
 				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
 				else $textifempty .= $langs->trans("All");
 			} else {
@@ -7745,7 +7745,7 @@ class Form
 		// check parameters
 		if (is_null($ajaxoptions)) $ajaxoptions = array();
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->TICKET_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('TICKET_USE_SEARCH_TO_SELECT')) {
 			$placeholder = '';
 			$urloption = '';
 
@@ -7768,7 +7768,7 @@ class Form
 					$out .= img_picto($langs->trans("Search"), 'search');
 				}
 			}
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '') . ' />';
+			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
 			if ($hidelabel == 3) {
 				$out .= img_picto($langs->trans("Search"), 'search');
 			}
@@ -7819,7 +7819,7 @@ class Form
 		// Add criteria on ref/label
 		if ($filterkey != '') {
 			$sql .= ' AND (';
-			$prefix = empty($conf->global->MEMBER_DONOTSEARCH_ANYWHERE) ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
+			$prefix = !getDolGlobalString('MEMBER_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
 			// For natural search
 			$scrit = explode(' ', $filterkey);
 			$i = 0;
@@ -7851,7 +7851,7 @@ class Form
 
 			if (!$forcecombo) {
 				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
-				$out .= ajax_combobox($htmlname, $events, !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT) ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
+				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
 			}
 
 			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
@@ -7859,7 +7859,7 @@ class Form
 			$textifempty = '';
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
 			//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
-			if (!empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
+			if (getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT')) {
 				if ($showempty && !is_numeric($showempty)) $textifempty = $langs->trans($showempty);
 				else $textifempty .= $langs->trans("All");
 			} else {
@@ -8282,7 +8282,7 @@ class Form
 		$out = '';
 
 		if ($addjscombo < 0) {
-			if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+			if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 				$addjscombo = 1;
 			} else {
 				$addjscombo = 0;
@@ -8419,7 +8419,7 @@ class Form
 		global $delayedhtmlcontent;    // Will be used later outside of this function
 
 		// TODO Use an internal dolibarr component instead of select2
-		if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
+		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
 			return '';
 		}
 
@@ -8524,7 +8524,7 @@ class Form
 		global $delayedhtmlcontent;    // Will be used later outside of this function
 
 		// TODO Use an internal dolibarr component instead of select2
-		if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && !defined('REQUIRE_JQUERY_MULTISELECT')) {
+		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
 			return '';
 		}
 
@@ -8646,7 +8646,7 @@ class Form
 		$out = '';
 
 		if ($addjscombo < 0) {
-			if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+			if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 				$addjscombo = 1;
 			} else {
 				$addjscombo = 0;
@@ -8654,7 +8654,7 @@ class Form
 		}
 
 		$useenhancedmultiselect = 0;
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
 			$useenhancedmultiselect = 1;
 		}
 
@@ -8701,11 +8701,11 @@ class Form
 		$out .= '</select>' . "\n";
 
 		// Add code for jquery to use multiselect
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
 			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
 			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
 			if ($addjscombo == 1) {
-				$tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
+				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
 				$out .= 'function formatResult(record, container) {' . "\n";
 				// If property html set, we decode html entities and use this.
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
@@ -8781,7 +8781,7 @@ class Form
 	{
 		global $conf, $langs, $user, $extrafields;
 
-		if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+		if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 			return '';
 		}
 		if (empty($array)) {
@@ -9109,10 +9109,10 @@ class Form
 		$possiblelinks = array();
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
 			$listofidcompanytoscan = $object->thirdparty->id;
-			if (($object->thirdparty->parent > 0) && !empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) {
+			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
 				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;
 			}
-			if (($object->fk_project > 0) && !empty($conf->global->THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO)) {
+			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
 				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
 				$tmpproject = new Project($this->db);
 				$tmpproject->fetch($object->fk_project);
@@ -9220,7 +9220,7 @@ class Form
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
 				print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
 
-				if (!empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
+				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
 					print '<br>'."\n";
 					print '<!-- form to add a link from anywhere -->'."\n";
 					print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
@@ -9299,7 +9299,7 @@ class Form
 				print '</div>';
 
 				//$linktoelem.=($linktoelem?' &nbsp; ':'');
-				if ($num > 0 || !empty($conf->global->MAIN_LINK_BY_REF_IN_LINKTO)) {
+				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) {
 					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
 				} else {
@@ -9576,7 +9576,7 @@ class Form
 
 			// List of extra languages
 			$arrayoflangcode = array();
-			if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
+			if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
 				$arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
 			}
 
@@ -9751,7 +9751,7 @@ class Form
 					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
 				}
 			}
-			if (!empty($conf->global->MAIN_OLD_IMAGE_LINKS)) {
+			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
 				$altfile = $object->id . ".jpg"; // For backward compatibility
 			}
 			$email = $object->email;
@@ -9770,7 +9770,7 @@ class Form
 					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
 				}
 			}
-			if (!empty($conf->global->MAIN_OLD_IMAGE_LINKS)) {
+			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
 				$altfile = $object->id . ".jpg"; // For backward compatibility
 			}
 			$email = $object->email;
@@ -9790,7 +9790,7 @@ class Form
 					$originalfile = get_exdir($id, 2, 0, 0, $object, $modulepart) . 'photos/' . $object->photo;
 				}
 			}
-			if (!empty($conf->global->MAIN_OLD_IMAGE_LINKS)) {
+			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
 				$altfile = $object->id . ".jpg"; // For backward compatibility
 			}
 			$email = $object->email;
@@ -10290,7 +10290,7 @@ class Form
 		$out = '';
 
 		$hideunselectables = false;
-		if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) {
+		if (getDolGlobalString('PROJECT_HIDE_UNSELECTABLES')) {
 			$hideunselectables = true;
 		}
 

+ 3 - 3
htdocs/core/class/html.formactions.class.php

@@ -186,7 +186,7 @@ class FormActions
 
 		require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
 		$caction = new CActionComm($this->db);
-		$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1);
+		$arraylist = $caction->liste_array(1, 'code', '', (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : 0), '', 1);
 
 		$num = count($listofactions);
 		if ($num || $forceshowtitle) {
@@ -277,7 +277,7 @@ class FormActions
 
 					// Type
 					$labeltype = $actionstatic->type_code;
-					if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
+					if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labeltype])) {
 						$labeltype = 'AC_OTH';
 					}
 					if (preg_match('/^TICKET_MSG/', $actionstatic->code)) {
@@ -377,7 +377,7 @@ class FormActions
 			$selected = 'AC_OTH_AUTO';
 		}
 
-		if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) {
+		if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO')) {
 			unset($arraylist['AC_OTH_AUTO']);
 		}
 

+ 1 - 1
htdocs/core/class/html.formadmin.class.php

@@ -67,7 +67,7 @@ class FormAdmin
 		// phpcs:enable
 		global $conf, $langs;
 
-		if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) {
+		if (getDolGlobalString('MAIN_DEFAULT_LANGUAGE_FILTER')) {
 			if (!is_array($filter)) {
 				$filter = array();
 			}

+ 15 - 15
htdocs/core/class/html.formcompany.class.php

@@ -328,7 +328,7 @@ class FormCompany extends Form
 
 						// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
 						if (
-							!empty($conf->global->MAIN_SHOW_STATE_CODE) &&
+							getDolGlobalString('MAIN_SHOW_STATE_CODE') &&
 							(getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || $conf->global->MAIN_SHOW_STATE_CODE === 'all')
 						) {
 							if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) {
@@ -648,7 +648,7 @@ class FormCompany extends Form
 	{
 		global $conf, $hookmanager;
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
 			// Use Ajax search
 			$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2);
 
@@ -730,15 +730,15 @@ class FormCompany extends Form
 		} else {
 			// Search to list thirdparties
 			$sql = "SELECT s.rowid, s.nom as name ";
-			if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) {
+			if (getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
 				$sql .= ", s.code_client, s.code_fournisseur";
 			}
-			if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
+			if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
 				$sql .= ", s.address, s.zip, s.town";
 				$sql .= ", dictp.code as country_code";
 			}
 			$sql .= " FROM " . $this->db->prefix() . "societe as s";
-			if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
+			if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
 				$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
 			}
 			$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
@@ -942,7 +942,7 @@ class FormCompany extends Form
 		global $conf, $langs, $hookmanager;
 
 		$formlength = 0;
-		if (empty($conf->global->MAIN_DISABLEPROFIDRULES)) {
+		if (!getDolGlobalString('MAIN_DISABLEPROFIDRULES')) {
 			if ($country_code == 'FR') {
 				if (isset($idprof)) {
 					if ($idprof == 1) {
@@ -1054,7 +1054,7 @@ class FormCompany extends Form
 	public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '', $allowempty = '')
 	{
 		global $conf, $langs;
-		if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && !isModEnabled('fournisseur')) {
+		if (getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !isModEnabled('fournisseur')) {
 			return '';
 		}
 
@@ -1069,22 +1069,22 @@ class FormCompany extends Form
 				}
 				$out .= '</option>';
 			}
-			if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
 				$out .= '<option value="2"' . ($selected == 2 ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
 			}
-			if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
 				$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
 			}
-			if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
 				$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
 			}
 			$out .= '<option value="0"' . ((string) $selected == '0' ? ' selected' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
 		} elseif ($typeinput == 'list') {
 			$out .= '<option value="-1"' . (($selected == '' || $selected == '-1') ? ' selected' : '') . '>&nbsp;</option>';
-			if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
 				$out .= '<option value="2,3"' . ($selected == '2,3' ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
 			}
-			if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
 				$out .= '<option value="1,3"' . ($selected == '1,3' ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
 			}
 			if (isModEnabled("fournisseur")) {
@@ -1092,10 +1092,10 @@ class FormCompany extends Form
 			}
 			$out .= '<option value="0"' . ($selected == '0' ? ' selected' : '') . '>' . $langs->trans('Other') . '</option>';
 		} elseif ($typeinput == 'admin') {
-			if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
 				$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
 			}
-			if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
+			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
 				$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
 			}
 		}
@@ -1125,7 +1125,7 @@ class FormCompany extends Form
 			$out .= '<form method="post" action="' . $page . '">';
 			$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
 			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
-			$sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
+			$sortparam = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
 			$out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
 			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
 			$out .= '</form>';

+ 3 - 3
htdocs/core/class/html.formcontract.class.php

@@ -69,7 +69,7 @@ class FormContract
 		global $user, $conf, $langs;
 
 		$hideunselectables = false;
-		if (!empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) {
+		if (getDolGlobalString('CONTRACT_HIDE_UNSELECTABLES')) {
 			$hideunselectables = true;
 		}
 
@@ -83,7 +83,7 @@ class FormContract
 		//if ($contratListId) $sql.= " AND c.rowid IN (".$this->db->sanitize($contratListId).")";
 		if ($socid > 0) {
 			// CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
-			if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
+			if (!getDolGlobalString('CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) {
 				$sql .= " AND (c.fk_soc=".((int) $socid)." OR c.fk_soc IS NULL)";
 			} elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') {
 				$sql .= " AND (c.fk_soc IN (".$this->db->sanitize(((int) $socid).",".((int) $conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)).")";
@@ -132,7 +132,7 @@ class FormContract
 								$disabled = 1;
 								$labeltoshow .= ' ('.$langs->trans("Draft").')';
 							}
-							if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
+							if (!getDolGlobalString('CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
 								$disabled = 1;
 								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
 							}

+ 13 - 13
htdocs/core/class/html.formfile.class.php

@@ -98,7 +98,7 @@ class FormFile
 			$useajax = 0;
 		}
 
-		if ((!empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax == 2)) {
+		if ((getDolGlobalString('MAIN_USE_JQUERY_FILEUPLOAD') && $useajax) || ($useajax == 2)) {
 			// TODO: Check this works with 2 forms on same page
 			// TODO: Check this works with GED module, otherwise, force useajax to 0
 			// TODO: This does not support option savingdocmask
@@ -108,7 +108,7 @@ class FormFile
 			return 'Feature too bugged so removed';
 		} else {
 			//If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed
-			if (!$perm && !empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
+			if (!$perm && getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED')) {
 				if ($nooutput) {
 					return '';
 				} else {
@@ -158,8 +158,8 @@ class FormFile
 				$out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
 			}
 			$out .= '<input class="flat minwidth400 maxwidth200onsmartphone" type="file"';
-			$out .= ((!empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple');
-			$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
+			$out .= ((getDolGlobalString('MAIN_DISABLE_MULTIPLE_FILEUPLOAD') || $disablemulti) ? ' name="userfile"' : ' name="userfile[]" multiple');
+			$out .= (!getDolGlobalString('MAIN_UPLOAD_DOC') || empty($perm) ? ' disabled' : '');
 			$out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""');
 			$out .= (!empty($capture) ? ' capture="capture"' : '');
 			$out .= '>';
@@ -169,7 +169,7 @@ class FormFile
 				$out .= '<span class="nowraponsmartphone"><input style="margin-right: 2px;" type="checkbox" id="overwritefile" name="overwritefile" value="1"><label for="overwritefile">'.$langs->trans("OverwriteIfExists").'</label></span>';
 			}
 			$out .= '<input type="submit" class="button small reposition" name="sendit" value="'.$langs->trans("Upload").'"';
-			$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
+			$out .= (!getDolGlobalString('MAIN_UPLOAD_DOC') || empty($perm) ? ' disabled' : '');
 			$out .= '>';
 
 			if ($addcancel) {
@@ -177,7 +177,7 @@ class FormFile
 				$out .= '<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
 			}
 
-			if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
+			if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
 				if ($perm) {
 					$menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Security");
 					$langs->load('other');
@@ -191,7 +191,7 @@ class FormFile
 
 			if ($savingdocmask) {
 				//add a global variable for disable the auto renaming on upload
-				$rename = (empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT) ? 'checked' : '');
+				$rename = (!getDolGlobalString('MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT') ? 'checked' : '');
 
 				$out .= '<tr>';
 				if (!empty($options)) {
@@ -233,13 +233,13 @@ class FormFile
 
 				$out .= '<div class="valignmiddle">';
 				$out .= '<div class="inline-block" style="padding-right: 10px;">';
-				if (!empty($conf->global->OPTIMIZEFORTEXTBROWSER)) {
+				if (getDolGlobalString('OPTIMIZEFORTEXTBROWSER')) {
 					$out .= '<label for="link">'.$langs->trans("URLToLink").':</label> ';
 				}
 				$out .= '<input type="text" name="link" class="flat minwidth400imp" id="link" placeholder="'.dol_escape_htmltag($langs->trans("URLToLink")).'">';
 				$out .= '</div>';
 				$out .= '<div class="inline-block" style="padding-right: 10px;">';
-				if (!empty($conf->global->OPTIMIZEFORTEXTBROWSER)) {
+				if (getDolGlobalString('OPTIMIZEFORTEXTBROWSER')) {
 					$out .= '<label for="label">'.$langs->trans("Label").':</label> ';
 				}
 				$out .= '<input type="text" class="flat" name="label" id="label" placeholder="'.dol_escape_htmltag($langs->trans("Label")).'">';
@@ -248,7 +248,7 @@ class FormFile
 				$out .= '</div>';
 				$out .= '<div class="inline-block" style="padding-right: 10px;">';
 				$out .= '<input type="submit" class="button small reposition" name="linkit" value="'.$langs->trans("ToLink").'"';
-				$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : '');
+				$out .= (!getDolGlobalString('MAIN_UPLOAD_DOC') || empty($perm) ? ' disabled' : '');
 				$out .= '>';
 				$out .= '</div>';
 				$out .= '</div>';
@@ -1068,7 +1068,7 @@ class FormFile
 		}
 
 		// Get list of files starting with name of ref (Note: files with '^ref\.extension' are generated files, files with '^ref-...' are uploaded files)
-		if ($allfiles || !empty($conf->global->MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP)) {
+		if ($allfiles || getDolGlobalString('MAIN_SHOW_ALL_FILES_ON_DOCUMENT_TOOLTIP')) {
 			$filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/');
 		} else {
 			$filterforfilesearch = '^'.preg_quote(basename($modulesubdir), '/').'\.';
@@ -1271,7 +1271,7 @@ class FormFile
 					}
 				}
 			}
-			if (empty($conf->global->MAIN_UPLOAD_DOC)) {
+			if (!getDolGlobalString('MAIN_UPLOAD_DOC')) {
 				$permtoeditline = 0;
 				$permonobject = 0;
 			}
@@ -1555,7 +1555,7 @@ class FormFile
 							if (empty($conf->use_javascript_ajax)) {
 								$useajax = 0;
 							}
-							if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) {
+							if (getDolGlobalString('MAIN_ECM_DISABLE_JS')) {
 								$useajax = 0;
 							}
 							print '<a href="'.((($useinecm && $useinecm != 6) && $useajax) ? '#' : ($url.'?action=deletefile&token='.newToken().'&urlfile='.urlencode($filepath).$param)).'" class="reposition deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';

+ 24 - 24
htdocs/core/class/html.formmail.class.php

@@ -612,8 +612,8 @@ class FormMail extends Form
 						$liste['user'] = array('label' => $s, 'data-html' => $s);
 
 						// Add also company main email
-						if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
-							$s = (empty($conf->global->MAIN_INFO_SOCIETE_NOM)?$conf->global->MAIN_INFO_SOCIETE_EMAIL:$conf->global->MAIN_INFO_SOCIETE_NOM).' &lt;' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'&gt;';
+						if (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) {
+							$s = (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM')?$conf->global->MAIN_INFO_SOCIETE_EMAIL:$conf->global->MAIN_INFO_SOCIETE_NOM).' &lt;' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'&gt;';
 							$liste['company'] = array('label' => $s, 'data-html' => $s);
 						}
 
@@ -630,7 +630,7 @@ class FormMail extends Form
 
 						// Also add robot email
 						if (!empty($this->fromalsorobot)) {
-							if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && getDolGlobalString('MAIN_MAIL_EMAIL_FROM') != getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) {
+							if (getDolGlobalString('MAIN_MAIL_EMAIL_FROM') && getDolGlobalString('MAIN_MAIL_EMAIL_FROM') != getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) {
 								$s = $conf->global->MAIN_MAIL_EMAIL_FROM;
 								if ($this->frommail) {
 									$s .= ' &lt;' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'&gt;';
@@ -703,7 +703,7 @@ class FormMail extends Form
 			}
 
 			// To User
-			if (!empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
+			if (!empty($this->withtouser) && is_array($this->withtouser) && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
 				$out .= '<tr><td>';
 				$out .= $langs->trans("MailToUsers");
 				$out .= '</td><td>';
@@ -752,7 +752,7 @@ class FormMail extends Form
 			}
 
 			// To User cc
-			if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
+			if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
 				$out .= '<tr><td>';
 				$out .= $langs->trans("MailToCCUsers");
 				$out .= '</td><td>';
@@ -823,7 +823,7 @@ class FormMail extends Form
 					} elseif ($this->withmaindocfile == -1) {
 						$out .= '<input type="checkbox" id="addmaindocfile" name="addmaindocfile" value="1" checked="checked" />';
 					}
-					if (!empty($conf->global->MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND)) {
+					if (getDolGlobalString('MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND')) {
 						$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDocOrLastGenerated").'.</label><br>';
 					} else {
 						$out .= ' <label for="addmaindocfile">'.$langs->trans("JoinMainDoc").'.</label><br>';
@@ -872,7 +872,7 @@ class FormMail extends Form
 							$out .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
 						}
 						// Can add other files
-						if (empty($conf->global->FROM_MAIL_DONT_USE_INPUT_FILE_MULTIPLE)) {
+						if (!getDolGlobalString('FROM_MAIL_DONT_USE_INPUT_FILE_MULTIPLE')) {
 							$out .= '<input type="file" class="flat" id="addedfile" name="addedfile[]" value="'.$langs->trans("Upload").'" multiple />';
 						} else {
 							$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
@@ -1006,7 +1006,7 @@ class FormMail extends Form
 					// Editor wysiwyg
 					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
 					if ($this->withfckeditor == -1) {
-						if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
+						if (getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
 							$this->withfckeditor = 1;
 						} else {
 							$this->withfckeditor = 0;
@@ -1040,7 +1040,7 @@ class FormMail extends Form
 			}
 
 			// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
-			if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
+			if (getDolGlobalString('MAIN_MAILFORM_DISABLE_ENTERKEY')) {
 				$out .= '<script nonce="'.getNonce().'" type="text/javascript">';
 				$out .= 'jQuery(document).ready(function () {';
 				$out .= '	$(document).on("keypress", \'#mailform\', function (e) {		/* Note this is called at every key pressed ! */
@@ -1238,25 +1238,25 @@ class FormMail extends Form
 		}
 
 		$showinfobcc = '';
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && !empty($this->param['models']) && $this->param['models'] == 'propal_send') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO') && !empty($this->param['models']) && $this->param['models'] == 'propal_send') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO;
 		}
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && !empty($this->param['models']) && $this->param['models'] == 'order_send') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO') && !empty($this->param['models']) && $this->param['models'] == 'order_send') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO;
 		}
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO') && !empty($this->param['models']) && $this->param['models'] == 'facture_send') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
 		}
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO') && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO;
 		}
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO') && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO;
 		}
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) && !empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO') && !empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO;
 		}
-		if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) && !empty($this->param['models']) && $this->param['models'] == 'project') {
+		if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') && !empty($this->param['models']) && $this->param['models'] == 'project') {
 			$showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO;
 		}
 		if ($showinfobcc) {
@@ -1303,19 +1303,19 @@ class FormMail extends Form
 			$out .= yn($this->withdeliveryreceipt);
 		} else {
 			$defaultvaluefordeliveryreceipt = 0;
-			if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && !empty($this->param['models']) && $this->param['models'] == 'propal_send') {
+			if (getDolGlobalString('MAIL_FORCE_DELIVERY_RECEIPT_PROPAL') && !empty($this->param['models']) && $this->param['models'] == 'propal_send') {
 				$defaultvaluefordeliveryreceipt = 1;
 			}
-			if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_PROPOSAL) && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') {
+			if (getDolGlobalString('MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_PROPOSAL') && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') {
 				$defaultvaluefordeliveryreceipt = 1;
 			}
-			if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_send') {
+			if (getDolGlobalString('MAIL_FORCE_DELIVERY_RECEIPT_ORDER') && !empty($this->param['models']) && $this->param['models'] == 'order_send') {
 				$defaultvaluefordeliveryreceipt = 1;
 			}
-			if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && !empty($this->param['models']) && $this->param['models'] == 'facture_send') {
+			if (getDolGlobalString('MAIL_FORCE_DELIVERY_RECEIPT_INVOICE') && !empty($this->param['models']) && $this->param['models'] == 'facture_send') {
 				$defaultvaluefordeliveryreceipt = 1;
 			}
-			if (!empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_ORDER) && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') {
+			if (getDolGlobalString('MAIL_FORCE_DELIVERY_RECEIPT_SUPPLIER_ORDER') && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') {
 				$defaultvaluefordeliveryreceipt = 1;
 			}
 			//$out .= $form->selectyesno('deliveryreceipt', (GETPOSTISSET("deliveryreceipt") ? GETPOST("deliveryreceipt") : $defaultvaluefordeliveryreceipt), 1);
@@ -1720,9 +1720,9 @@ class FormMail extends Form
 			if (isModEnabled('stripe')) {
 				$onlinepaymentenabled++;
 			}
-			if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
+			if ($onlinepaymentenabled && getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
 				$tmparray['__SECUREKEYPAYMENT__'] = $conf->global->PAYMENT_SECURITY_TOKEN;
-				if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
+				if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
 					if (isModEnabled('adherent')) {
 						$tmparray['__SECUREKEYPAYMENT_MEMBER__'] = 'SecureKeyPAYMENTUniquePerMember';
 					}
@@ -1765,7 +1765,7 @@ class FormMail extends Form
 				$vars['__SECUREKEYPAYMENT_CONTRACTLINE__']='';
 				*/
 			}
-			if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
+			if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
 				$substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = 'BlankSubscriptionForm';
 			}
 		}

+ 9 - 9
htdocs/core/class/html.formmargin.class.php

@@ -225,7 +225,7 @@ class FormMargin
 		if ($reshook < 0) {
 			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
 		} elseif (empty($reshook)) {
-			if (!empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) {
+			if (getDolGlobalString('MARGIN_ADD_SHOWHIDE_BUTTON')) {
 				print $langs->trans('ShowMarginInfos') . ' ';
 				$hidemargininfos = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE['DOLUSER_MARGININFO_HIDE_SHOW']); // Clean cookie
 				print '<span id="showMarginInfos" class="linkobject valignmiddle ' . (!empty($hidemargininfos) ? '' : 'hideobject') . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</span>';
@@ -253,10 +253,10 @@ class FormMargin
 				print '<td class="liste_titre right">' . $langs->trans('CostPrice') . '</td>';
 			}
 			print '<td class="liste_titre right">' . $langs->trans('Margin') . '</td>';
-			if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
+			if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
 				print '<td class="liste_titre right">' . $langs->trans('MarginRate') . '</td>';
 			}
-			if (!empty($conf->global->DISPLAY_MARK_RATES)) {
+			if (getDolGlobalString('DISPLAY_MARK_RATES')) {
 				print '<td class="liste_titre right">' . $langs->trans('MarkRate') . '</td>';
 			}
 			print '</tr>';
@@ -268,10 +268,10 @@ class FormMargin
 				print '<td class="right">' . price($marginInfo['pv_products']) . '</td>';
 				print '<td class="right">' . price($marginInfo['pa_products']) . '</td>';
 				print '<td class="right">' . price($marginInfo['margin_on_products']) . '</td>';
-				if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
+				if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
 					print '<td class="right">' . (($marginInfo['margin_rate_products'] == '') ? '' : price($marginInfo['margin_rate_products'], null, null, null, null, 2) . '%') . '</td>';
 				}
-				if (!empty($conf->global->DISPLAY_MARK_RATES)) {
+				if (getDolGlobalString('DISPLAY_MARK_RATES')) {
 					print '<td class="right">' . (($marginInfo['mark_rate_products'] == '') ? '' : price($marginInfo['mark_rate_products'], null, null, null, null, 2) . '%') . '</td>';
 				}
 				print '</tr>';
@@ -283,10 +283,10 @@ class FormMargin
 				print '<td class="right">' . price($marginInfo['pv_services']) . '</td>';
 				print '<td class="right">' . price($marginInfo['pa_services']) . '</td>';
 				print '<td class="right">' . price($marginInfo['margin_on_services']) . '</td>';
-				if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
+				if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
 					print '<td class="right">' . (($marginInfo['margin_rate_services'] == '') ? '' : price($marginInfo['margin_rate_services'], null, null, null, null, 2) . '%') . '</td>';
 				}
-				if (!empty($conf->global->DISPLAY_MARK_RATES)) {
+				if (getDolGlobalString('DISPLAY_MARK_RATES')) {
 					print '<td class="right">' . (($marginInfo['mark_rate_services'] == '') ? '' : price($marginInfo['mark_rate_services'], null, null, null, null, 2) . '%') . '</td>';
 				}
 				print '</tr>';
@@ -298,10 +298,10 @@ class FormMargin
 				print '<td class="right">' . price($marginInfo['pv_total']) . '</td>';
 				print '<td class="right">' . price($marginInfo['pa_total']) . '</td>';
 				print '<td class="right">' . price($marginInfo['total_margin']) . '</td>';
-				if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
+				if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
 					print '<td class="right">' . (($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2) . '%') . '</td>';
 				}
-				if (!empty($conf->global->DISPLAY_MARK_RATES)) {
+				if (getDolGlobalString('DISPLAY_MARK_RATES')) {
 					print '<td class="right">' . (($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2) . '%') . '</td>';
 				}
 				print '</tr>';

+ 5 - 5
htdocs/core/class/html.formother.class.php

@@ -150,7 +150,7 @@ class FormOther
 		$sql = "SELECT rowid, label, fk_user";
 		$sql .= " FROM ".$this->db->prefix()."export_model";
 		$sql .= " WHERE type = '".$this->db->escape($type)."'";
-		if (empty($conf->global->EXPORTS_SHARE_MODELS)) {	// EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner.
+		if (!getDolGlobalString('EXPORTS_SHARE_MODELS')) {	// EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner.
 			$sql .= " AND fk_user IN (0, ".((int) $fk_user).")";
 		}
 		$sql .= " ORDER BY label";
@@ -212,7 +212,7 @@ class FormOther
 		$sql = "SELECT rowid, label, fk_user";
 		$sql .= " FROM ".$this->db->prefix()."import_model";
 		$sql .= " WHERE type = '".$this->db->escape($type)."'";
-		if (empty($conf->global->EXPORTS_SHARE_MODELS)) {	// EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner.
+		if (!getDolGlobalString('EXPORTS_SHARE_MODELS')) {	// EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner.
 			$sql .= " AND fk_user IN (0, ".((int) $fk_user).")";
 		}
 		$sql .= " ORDER BY label";
@@ -552,7 +552,7 @@ class FormOther
 			}
 		}
 
-		if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {	// MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
+		if (!getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION')) {	// MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
 			$sql_usr .= " ORDER BY status DESC, firstname ASC, lastname ASC";
 		} else {
 			$sql_usr .= " ORDER BY status DESC, lastname ASC, firstname ASC";
@@ -596,7 +596,7 @@ class FormOther
 				$out .= $labeltoshow;
 				// Complete name with more info
 				$moreinfo = 0;
-				if (!empty($conf->global->MAIN_SHOW_LOGIN)) {
+				if (getDolGlobalString('MAIN_SHOW_LOGIN')) {
 					$out .= ($moreinfo ? ' - ' : ' (').$obj_usr->login;
 					$moreinfo++;
 				}
@@ -1363,7 +1363,7 @@ class FormOther
 
 			// Define $box_max_lines
 			$box_max_lines = 5;
-			if (!empty($conf->global->MAIN_BOXES_MAXLINES)) {
+			if (getDolGlobalString('MAIN_BOXES_MAXLINES')) {
 				$box_max_lines = $conf->global->MAIN_BOXES_MAXLINES;
 			}
 

+ 5 - 5
htdocs/core/class/html.formprojet.class.php

@@ -92,7 +92,7 @@ class FormProjets extends Form
 
 		$out = '';
 
-		if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_SEARCH_TO_SELECT)) {
+		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT')) {
 			$placeholder = '';
 
 			if ($selected && empty($selected_input_value)) {
@@ -163,7 +163,7 @@ class FormProjets extends Form
 		$outarray = array();
 
 		$hideunselectables = false;
-		if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) {
+		if (getDolGlobalString('PROJECT_HIDE_UNSELECTABLES')) {
 			$hideunselectables = true;
 		}
 
@@ -184,7 +184,7 @@ class FormProjets extends Form
 			$sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
 		}
 		if ($socid > 0) {
-			if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) {
+			if (!getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) {
 				$sql .= " AND (p.fk_soc=" . ((int) $socid) . " OR p.fk_soc IS NULL)";
 			} elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') {    // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
 				$sql .= " AND (p.fk_soc IN (" . $this->db->sanitize(((int) $socid) . ", " . getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY')) . ") OR p.fk_soc IS NULL)";
@@ -247,7 +247,7 @@ class FormProjets extends Form
 								$disabled = 1;
 							}
 							$labeltoshow .= ' - ' . $langs->trans("Closed");
-						} elseif (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
+						} elseif (!getDolGlobalString('PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY') && $socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
 							$disabled = 1;
 							$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
 						}
@@ -347,7 +347,7 @@ class FormProjets extends Form
 		$out = '';
 
 		$hideunselectables = false;
-		if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) {
+		if (getDolGlobalString('PROJECT_HIDE_UNSELECTABLES')) {
 			$hideunselectables = true;
 		}
 

+ 5 - 5
htdocs/core/class/html.formticket.class.php

@@ -446,7 +446,7 @@ class FormTicket
 		$doleditor->Create();
 		print '</td></tr>';
 
-		if ($public && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) {
+		if ($public && getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_TICKET')) {
 			require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
 			print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
 			print '<span class="span-icon-security inline-block">';
@@ -555,7 +555,7 @@ class FormTicket
 				print img_picto('', 'company', 'class="paddingright"');
 				print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200');
 				print '</td></tr>';
-				if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) {
+				if (!empty($conf->use_javascript_ajax) && getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
 					$htmlname = 'socid';
 					print '<script nonce="'.getNonce().'" type="text/javascript">
                     $(document).ready(function () {
@@ -1386,7 +1386,7 @@ class FormTicket
 		';
 
 		// If constant set, allow to send private messages as email
-		if (empty($conf->global->TICKET_SEND_PRIVATE_EMAIL)) {
+		if (!getDolGlobalString('TICKET_SEND_PRIVATE_EMAIL')) {
 			print 'jQuery("#send_msg_email").click(function() {
 					console.log("Click send_msg_email");
 					if(jQuery(this).is(":checked")) {
@@ -1458,7 +1458,7 @@ class FormTicket
 			print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
 			print '<label for="send_msg_email">'.$langs->trans('SendMessageByEmail').'</label>';
 			$texttooltip = $langs->trans("TicketMessageSendEmailHelp");
-			if (empty($conf->global->TICKET_SEND_PRIVATE_EMAIL)) {
+			if (!getDolGlobalString('TICKET_SEND_PRIVATE_EMAIL')) {
 				$texttooltip .= ' '.$langs->trans("TicketMessageSendEmailHelp2b");
 			} else {
 				$texttooltip .= ' '.$langs->trans("TicketMessageSendEmailHelp2a", '{s1}');
@@ -1700,7 +1700,7 @@ class FormTicket
 		print "</form><br>\n";
 
 		// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
-		if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
+		if (getDolGlobalString('MAIN_MAILFORM_DISABLE_ENTERKEY')) {
 			print '<script type="text/javascript">';
 			print 'jQuery(document).ready(function () {';
 			print '		$(document).on("keypress", \'#ticket\', function (e) {		/* Note this is called at every key pressed ! */

+ 3 - 3
htdocs/core/class/ldap.class.php

@@ -220,10 +220,10 @@ class Ldap
 		global $conf;
 
 		// Server
-		if (!empty($conf->global->LDAP_SERVER_HOST)) {
+		if (getDolGlobalString('LDAP_SERVER_HOST')) {
 			$this->server[] = $conf->global->LDAP_SERVER_HOST;
 		}
-		if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) {
+		if (getDolGlobalString('LDAP_SERVER_HOST_SLAVE')) {
 			$this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
 		}
 		$this->serverPort          = getDolGlobalInt('LDAP_SERVER_PORT', 389);
@@ -327,7 +327,7 @@ class Ldap
 					}
 
 					// Upgrade connexion to TLS, if requested by the configuration
-					if (!empty($conf->global->LDAP_SERVER_USE_TLS)) {
+					if (getDolGlobalString('LDAP_SERVER_USE_TLS')) {
 						// For test/debug
 						//ldap_set_option($this->connection, LDAP_OPT_DEBUG_LEVEL, 7);
 						//ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3);

+ 4 - 4
htdocs/core/class/notify.class.php

@@ -117,7 +117,7 @@ class Notify
 		// Get full list of all notifications subscribed for $action, $socid and $object
 		$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
 
-		if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) {
+		if (getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER')) {
 			foreach ($listofnotiftodo as $val) {
 				if ($val['type'] == 'touser') {
 					unset($listofnotiftodo[$val['email']]);
@@ -125,7 +125,7 @@ class Notify
 				}
 			}
 		}
-		if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT)) {
+		if (getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT')) {
 			foreach ($listofnotiftodo as $val) {
 				if ($val['type'] == 'tocontact') {
 					unset($listofnotiftodo[$val['email']]);
@@ -133,7 +133,7 @@ class Notify
 				}
 			}
 		}
-		if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) {
+		if (getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX')) {
 			foreach ($listofnotiftodo as $val) {
 				if ($val['type'] == 'tofixedemail') {
 					unset($listofnotiftodo[$val['email']]);
@@ -394,7 +394,7 @@ class Notify
 
 		// Define some vars
 		$application = 'Dolibarr';
-		if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
+		if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
 			$application = $conf->global->MAIN_APPLICATION_TITLE;
 		}
 		$replyto = $conf->notification->email_from;

+ 7 - 7
htdocs/core/class/rssparser.class.php

@@ -257,7 +257,7 @@ class RssParser
 
 		if ($str !== false) {
 			// Convert $str into xml
-			if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+			if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 				//print 'xx'.LIBXML_NOCDATA;
 				libxml_use_internal_errors(false);
 				$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA);
@@ -324,7 +324,7 @@ class RssParser
 			// Save description entries
 			if ($rss->_format == 'rss') {
 				//var_dump($rss);
-				if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+				if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 					if (!empty($rss->channel->language)) {
 						$this->_language = sanitizeVal((string) $rss->channel->language);
 					}
@@ -377,7 +377,7 @@ class RssParser
 					}
 				}
 
-				if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+				if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 					$items = $rss->channel->item; // With simplexml
 				} else {
 					$items = $rss->items; // With xmlparse
@@ -385,7 +385,7 @@ class RssParser
 				//var_dump($items);exit;
 			} elseif ($rss->_format == 'atom') {
 				//var_dump($rss);
-				if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+				if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 					if (!empty($rss->generator)) {
 						$this->_generator = sanitizeVal((string) $rss->generator);
 					}
@@ -423,7 +423,7 @@ class RssParser
 						$this->_imageurl = sanitizeVal($this->getAtomImageUrl($rss->channel));
 					}
 				}
-				if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+				if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 					$tmprss = xml2php($rss);
 					$items = $tmprss['entry'];
 				} else {
@@ -440,7 +440,7 @@ class RssParser
 				foreach ($items as $item) {
 					//var_dump($item);exit;
 					if ($rss->_format == 'rss') {
-						if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+						if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 							$itemLink = sanitizeVal((string) $item->link);
 							$itemTitle = sanitizeVal((string) $item->title);
 							$itemDescription = sanitizeVal((string) $item->description);
@@ -464,7 +464,7 @@ class RssParser
 							}
 						}
 					} elseif ($rss->_format == 'atom') {
-						if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
+						if (getDolGlobalString('EXTERNALRSS_USE_SIMPLEXML')) {
 							$itemLink = (isset($item['link']) ? sanitizeVal((string) $item['link']) : '');
 							$itemTitle = sanitizeVal((string) $item['title']);
 							$itemDescription = sanitizeVal($this->getAtomItemDescription($item));

+ 9 - 9
htdocs/core/class/smtps.class.php

@@ -485,13 +485,13 @@ class SMTPs
 		$host = preg_replace('@ssl://@i', '', $host); // Remove prefix
 		$host = preg_replace('@tls://@i', '', $host); // Remove prefix
 
-		if ($usetls && !empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) {
+		if ($usetls && getDolGlobalString('MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO')) {
 			$host = 'tls://'.$host;
 		}
 
 		$hosth = $host;	// so for example 'localhost' or 'smtp-relay.gmail.com'
 
-		if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
+		if (getDolGlobalString('MAIL_SMTP_USE_FROM_FOR_HELO')) {
 			if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
 				// If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
 				$hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
@@ -594,7 +594,7 @@ class SMTPs
 			}
 
 			// Default authentication method is LOGIN
-			if (empty($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE)) {
+			if (!getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE')) {
 				$conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE = 'LOGIN';
 			}
 
@@ -675,13 +675,13 @@ class SMTPs
 				$host = preg_replace('@ssl://@i', '', $host); // Remove prefix
 				$host = preg_replace('@tls://@i', '', $host); // Remove prefix
 
-				if ($usetls && !empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) {
+				if ($usetls && getDolGlobalString('MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO')) {
 					$host = 'tls://'.$host;
 				}
 
 				$hosth = $host;
 
-				if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
+				if (getDolGlobalString('MAIL_SMTP_USE_FROM_FOR_HELO')) {
 					if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
 						// If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
 						$hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
@@ -1562,7 +1562,7 @@ class SMTPs
 		// If we have ZERO, we have a problem
 		if ($keyCount === 0) {
 			die("Sorry, no content");
-		} elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+		} elseif ($keyCount === 1 && !getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) {
 			// If we have ONE, we can use the simple format
 			$_msgData = $this->_msgContent;
 			$_msgData = $_msgData[$_types[0]];
@@ -1578,7 +1578,7 @@ class SMTPs
 
 			$content .= "\r\n"
 			.  $_msgData['data']."\r\n";
-		} elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+		} elseif ($keyCount >= 1 || getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) {
 			// If we have more than ONE, we use the multi-part format
 			// Since this is an actual multi-part message
 			// We need to define a content message Boundary
@@ -1657,7 +1657,7 @@ class SMTPs
 						$content .= "--".$this->_getBoundary('related')."\r\n";
 					}
 
-					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) {
 						// Add plain text message part before html part
 						$content .= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"'."\r\n";
 						$content .= "\r\n";
@@ -1678,7 +1678,7 @@ class SMTPs
 
 					$content .= "\r\n".$_content['data']."\r\n";
 
-					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) {
+					if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && getDolGlobalString('MAIN_MAIL_USE_MULTI_PART')) {
 						// Add plain text message part after html part
 						$content .= "--".$this->_getBoundary('alternative')."--\r\n";
 					}

+ 6 - 6
htdocs/core/class/timespent.class.php

@@ -164,7 +164,7 @@ class TimeSpent extends CommonObject
 
 		$this->db = $db;
 
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
+		if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
 			$this->fields['rowid']['visible'] = 0;
 		}
 		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
@@ -658,7 +658,7 @@ class TimeSpent extends CommonObject
 
 		$datas = [];
 
-		if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+		if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 			return ['optimize' => $langs->trans("ShowTimeSpent")];
 		}
 		$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans("TimeSpent").'</u>';
@@ -719,7 +719,7 @@ class TimeSpent extends CommonObject
 
 		$linkclose = '';
 		if (empty($notooltip)) {
-			if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
 				$label = $langs->trans("ShowTimeSpent");
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
 			}
@@ -943,11 +943,11 @@ class TimeSpent extends CommonObject
 		global $langs, $conf;
 		$langs->load("timespent@timespent");
 
-		if (empty($conf->global->TIMESPENT_timespent_ADDON)) {
+		if (!getDolGlobalString('TIMESPENT_timespent_ADDON')) {
 			$conf->global->TIMESPENT_timespent_ADDON = 'mod_timespent_standard';
 		}
 
-		if (!empty($conf->global->TIMESPENT_timespent_ADDON)) {
+		if (getDolGlobalString('TIMESPENT_timespent_ADDON')) {
 			$mybool = false;
 
 			$file = getDolGlobalString('TIMESPENT_timespent_ADDON') . ".php";
@@ -1013,7 +1013,7 @@ class TimeSpent extends CommonObject
 
 			if (!empty($this->model_pdf)) {
 				$modele = $this->model_pdf;
-			} elseif (!empty($conf->global->timespent_ADDON_PDF)) {
+			} elseif (getDolGlobalString('timespent_ADDON_PDF')) {
 				$modele = $conf->global->timespent_ADDON_PDF;
 			}
 		}

+ 7 - 7
htdocs/core/class/translate.class.php

@@ -78,7 +78,7 @@ class Translate
 		//dol_syslog(get_class($this)."::setDefaultLang srclang=".$srclang,LOG_DEBUG);
 
 		// If a module ask to force a priority on langs directories (to use its own lang files)
-		if (!empty($conf->global->MAIN_FORCELANGDIR)) {
+		if (getDolGlobalString('MAIN_FORCELANGDIR')) {
 			$more = array();
 			$i = 0;
 			foreach ($conf->file->dol_document_root as $dir) {
@@ -279,7 +279,7 @@ class Translate
 				// Enable caching of lang file in memory (not by default)
 				$usecachekey = '';
 				// Using a memcached server
-				if (isModEnabled('memcached') && !empty($conf->global->MEMCACHED_SERVER)) {
+				if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) {
 					$usecachekey = $newdomain . '_' . $langofdir . '_' . md5($file_lang); // Should not contains special chars
 				} elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
 					// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
@@ -354,7 +354,7 @@ class Translate
 							}
 						}
 
-						if (empty($conf->global->MAIN_FORCELANGDIR)) {
+						if (!getDolGlobalString('MAIN_FORCELANGDIR')) {
 							break; // Break loop on each root dir. If a module has forced dir, we do not stop loop.
 						}
 					}
@@ -471,7 +471,7 @@ class Translate
 		// Enable caching of lang file in memory (not by default)
 		$usecachekey = '';
 		// Using a memcached server
-		if (isModEnabled('memcached') && !empty($conf->global->MEMCACHED_SERVER)) {
+		if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) {
 			$usecachekey = $newdomain . '_' . $langofdir; // Should not contains special chars
 		} elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) {
 			// Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file)
@@ -493,7 +493,7 @@ class Translate
 			}
 		}
 
-		if (!$found && !empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
+		if (!$found && getDolGlobalString('MAIN_ENABLE_OVERWRITE_TRANSLATION')) {
 			// Overwrite translation with database read
 			$sql = "SELECT transkey, transvalue FROM ".$db->prefix()."overwrite_trans where (lang='".$db->escape($this->defaultlang)."' OR lang IS NULL)";
 			$sql .= " AND entity IN (0, ".getEntity('overwrite_trans').")";
@@ -872,7 +872,7 @@ class Translate
 					}
 				}
 				// We must keep only languages into MAIN_LANGUAGES_ALLOWED
-				if (!empty($conf->global->MAIN_LANGUAGES_ALLOWED) && !in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED))) {
+				if (getDolGlobalString('MAIN_LANGUAGES_ALLOWED') && !in_array($dir, explode(',', $conf->global->MAIN_LANGUAGES_ALLOWED))) {
 					continue;
 				}
 
@@ -880,7 +880,7 @@ class Translate
 					$langs_available[$dir] = $dir;
 				}
 
-				if ($usecode == 1 || !empty($conf->global->MAIN_SHOW_LANGUAGE_CODE)) {
+				if ($usecode == 1 || getDolGlobalString('MAIN_SHOW_LANGUAGE_CODE')) {
 					$langs_available[$dir] = $dir . ': ' . dol_trunc($this->trans('Language_' . $dir), $maxlength);
 				} else {
 					$langs_available[$dir] = $this->trans('Language_' . $dir);

+ 7 - 7
htdocs/core/class/utils.class.php

@@ -271,7 +271,7 @@ class Utils
 
 		// MYSQL
 		if ($type == 'mysql' || $type == 'mysqli') {
-			if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) {
+			if (!getDolGlobalString('SYSTEMTOOLS_MYSQLDUMP')) {
 				$cmddump = $db->getPathOfDump();
 			} else {
 				$cmddump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
@@ -409,7 +409,7 @@ class Utils
 
 			$ok = 0;
 			if ($handle) {
-				if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
+				if (getDolGlobalString('MAIN_EXEC_USE_POPEN')) {
 					$execmethod = $conf->global->MAIN_EXEC_USE_POPEN;
 				}
 				if (empty($execmethod)) {
@@ -713,7 +713,7 @@ class Utils
 			$command .= " 2>&1";
 		}
 
-		if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
+		if (getDolGlobalString('MAIN_EXEC_USE_POPEN')) {
 			$execmethod = $conf->global->MAIN_EXEC_USE_POPEN;
 		}
 		if (empty($execmethod)) {
@@ -822,7 +822,7 @@ class Utils
 					return -1;
 				}
 
-				if (empty($conf->global->MODULEBUILDER_ASCIIDOCTOR) && empty($conf->global->MODULEBUILDER_ASCIIDOCTORPDF)) {
+				if (!getDolGlobalString('MODULEBUILDER_ASCIIDOCTOR') && !getDolGlobalString('MODULEBUILDER_ASCIIDOCTORPDF')) {
 					$this->error = 'Setup of module ModuleBuilder not complete';
 					return -1;
 				}
@@ -985,7 +985,7 @@ class Utils
 
 		$nbSaves = intval(getDolGlobalString('SYSLOG_FILE_SAVES', 10));
 
-		if (empty($conf->global->SYSLOG_FILE)) {
+		if (!getDolGlobalString('SYSLOG_FILE')) {
 			$mainlogdir = DOL_DATA_ROOT;
 			$mainlog = 'dolibarr.log';
 		} else {
@@ -1282,7 +1282,7 @@ class Utils
 
 		if (!empty($from)) {
 			$from = dol_escape_htmltag($from);
-		} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
+		} elseif (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) {
 			$from = dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL);
 		} else {
 			$error++;
@@ -1290,7 +1290,7 @@ class Utils
 
 		if (!empty($sendto)) {
 			$sendto = dol_escape_htmltag($sendto);
-		} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL)) {
+		} elseif (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL')) {
 			$from = dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL);
 		} else {
 			$error++;