Replace "! empty($conf->global->$" with "getDolGlobalString($"

This commit is contained in:
Laurent Destailleur
2024-07-03 20:05:29 +02:00
parent fa4247a812
commit 9af159cdd8
34 changed files with 50 additions and 50 deletions

View File

@@ -3224,7 +3224,7 @@ class Facture extends CommonInvoice
// Check for mandatory prof id (but only if country is other than ours)
if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) {
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
if (!$vallabel && getDolGlobalString($idprof_mandatory)) {
$langs->load("errors");
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);

View File

@@ -1035,10 +1035,10 @@ class CMailFile
// If we use SSL/TLS
$server = getDolGlobalString($keyforsmtpserver);
$secure = '';
if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) {
if (getDolGlobalString($keyfortls) && function_exists('openssl_open')) {
$secure = 'ssl';
}
if (!empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) {
if (getDolGlobalString($keyforstarttls) && function_exists('openssl_open')) {
$secure = 'tls';
}
$server = ($secure ? $secure.'://' : '').$server;
@@ -1050,11 +1050,11 @@ class CMailFile
$loginid = '';
$loginpass = '';
if (!empty($conf->global->$keyforsmtpid)) {
if (getDolGlobalString($keyforsmtpid)) {
$loginid = getDolGlobalString($keyforsmtpid);
$this->smtps->setID($loginid);
}
if (!empty($conf->global->$keyforsmtppw)) {
if (getDolGlobalString($keyforsmtppw)) {
$loginpass = getDolGlobalString($keyforsmtppw);
$this->smtps->setPW($loginpass);
}
@@ -1199,19 +1199,19 @@ class CMailFile
// If we use SSL/TLS
$server = getDolGlobalString($keyforsmtpserver);
$secure = '';
if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) {
if (getDolGlobalString($keyfortls) && function_exists('openssl_open')) {
$secure = 'ssl';
}
if (!empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) {
if (getDolGlobalString($keyforstarttls) && function_exists('openssl_open')) {
$secure = 'tls';
}
$this->transport = new Swift_SmtpTransport($server, getDolGlobalString($keyforsmtpport), $secure);
if (!empty($conf->global->$keyforsmtpid)) {
if (getDolGlobalString($keyforsmtpid)) {
$this->transport->setUsername($conf->global->$keyforsmtpid);
}
if (!empty($conf->global->$keyforsmtppw) && getDolGlobalString($keyforsmtpauthtype) != "XOAUTH2") {
if (getDolGlobalString($keyforsmtppw) && getDolGlobalString($keyforsmtpauthtype) != "XOAUTH2") {
$this->transport->setPassword($conf->global->$keyforsmtppw);
}
if (getDolGlobalString($keyforsmtpauthtype) === "XOAUTH2") {
@@ -1864,7 +1864,7 @@ class CMailFile
}
// If we use SSL/TLS
if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) {
if (getDolGlobalString($keyfortls) && function_exists('openssl_open')) {
$host = 'ssl://'.$host;
}
// tls smtp start with no encryption

View File

@@ -437,7 +437,7 @@ class Translate
// Kept for backward compatibility.
if (empty($loadfromfileonly)) {
$overwritekey = 'MAIN_OVERWRITE_TRANS_' . $this->defaultlang;
if (!empty($conf->global->$overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2
if (getDolGlobalString($overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2
// Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX
$tmparray = explode(',', getDolGlobalString($overwritekey));
foreach ($tmparray as $tmp) {
@@ -683,7 +683,7 @@ class Translate
// Make some string replacement after translation
$replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang;
if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2
if (getDolGlobalString($replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2
$tmparray = explode(';', getDolGlobalString($replacekey));
foreach ($tmparray as $tmp) {
$tmparray2 = explode(':', $tmp);
@@ -777,7 +777,7 @@ class Translate
// Make some string replacement after translation
$replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang;
if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2
if (getDolGlobalString($replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2
$tmparray = explode(';', getDolGlobalString($replacekey));
foreach ($tmparray as $tmp) {
$tmparray2 = explode(':', $tmp);

View File

@@ -697,8 +697,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
</script>'."\n";
$out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
$out .= '<span id="set_'.$code.'" class="valignmiddle inline-block linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="del_'.$code.'" class="valignmiddle inline-block linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="set_'.$code.'" class="valignmiddle inline-block linkobject '.(getDolGlobalString($code) ? 'hideobject' : '').'">'.($revertonoff ? img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= '<span id="del_'.$code.'" class="valignmiddle inline-block linkobject '.(getDolGlobalString($code) ? '' : 'hideobject').'">'.($revertonoff ? img_picto($langs->trans("Disabled"), 'switch_off'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on'.$suffix, '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
$out .= "\n";
}

View File

@@ -1029,7 +1029,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$dims = $pdf->getPageDimensions();
// Line of free text
if (empty($hidefreetext) && !empty($conf->global->$paramfreetext)) {
if (empty($hidefreetext) && getDolGlobalString($paramfreetext)) {
$substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object);
// More substitution keys
$substitutionarray['__FROM_NAME__'] = $fromcompany->name;
@@ -1633,7 +1633,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
// Check if description must be output
if (!empty($object->element)) {
$tmpkey = 'MAIN_DOCUMENTS_HIDE_DESCRIPTION_FOR_'.strtoupper($object->element);
if (!empty($conf->global->$tmpkey)) {
if (getDolGlobalString($tmpkey)) {
$hidedesc = 1;
}
}

View File

@@ -467,7 +467,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
while ($i <= $MAXFTP) {
$paramkey = 'FTP_NAME_'.$i;
//print $paramkey;
if (!empty($conf->global->$paramkey)) {
if (getDolGlobalString($paramkey)) {
$link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
$newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));

View File

@@ -873,7 +873,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
while ($i <= $MAXFTP) {
$paramkey = 'FTP_NAME_'.$i;
//print $paramkey;
if (!empty($conf->global->$paramkey)) {
if (getDolGlobalString($paramkey)) {
$link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
$newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));
}

View File

@@ -322,7 +322,7 @@ class doc_generic_asset_odt extends ModelePDFAsset
// Line of free text
$newfreetext = '';
$paramfreetext = 'ORDER_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -323,7 +323,7 @@ class doc_generic_bom_odt extends ModelePDFBom
// Line of free text
$newfreetext = '';
$paramfreetext = 'BOM_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -445,7 +445,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$newfreetext = '';
$paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -333,7 +333,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
// Line of free text
$newfreetext = '';
$paramfreetext = 'ORDER_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -344,7 +344,7 @@ class doc_generic_contract_odt extends ModelePDFContract
// Line of free text
$newfreetext = '';
$paramfreetext = 'CONTRACT_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $tmparray);
}

View File

@@ -331,7 +331,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Line of free text
$newfreetext = '';
$paramfreetext = 'EXPEDITION_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -373,7 +373,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Line of free text
$newfreetext = '';
$paramfreetext = 'INVOICE_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -316,7 +316,7 @@ class doc_generic_mo_odt extends ModelePDFMo
// Line of free text
$newfreetext = '';
$paramfreetext = 'MRP_MO_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -328,7 +328,7 @@ class doc_generic_product_odt extends ModelePDFProduct
// Line of free text
$newfreetext = '';
$paramfreetext = 'PRODUCT_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -365,7 +365,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
// Line of free text
$newfreetext = '';
$paramfreetext = 'PROPOSAL_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -326,7 +326,7 @@ class doc_generic_reception_odt extends ModelePdfReception
// Line of free text
$newfreetext = '';
$paramfreetext = 'RECEPTION_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -327,7 +327,7 @@ class doc_generic_stock_odt extends ModelePDFStock
// Line of free text
$newfreetext = '';
$paramfreetext = 'stock_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -329,7 +329,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
// Line of free text
$newfreetext = '';
$paramfreetext = 'INVOICE_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -324,7 +324,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
// Line of free text
$newfreetext = '';
$paramfreetext = 'ORDER_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -353,7 +353,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
// Line of free text
$newfreetext = '';
$paramfreetext = 'SUPPLIER_PROPOSAL_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -352,7 +352,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
// Line of free text
$newfreetext = '';
$paramfreetext = 'user_FREE_TEXT';
if (!empty($conf->global->$paramfreetext)) {
if (getDolGlobalString($paramfreetext)) {
$newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray);
}

View File

@@ -61,11 +61,11 @@ $select_pricing_rules = array(
'PRODUIT_CUSTOMER_PRICES' => $langs->trans('PriceByCustomer'), // Different price for each customer
);
$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || !empty($conf->global->$keyforparam)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || getDolGlobalString($keyforparam)) {
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice
}
$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->$keyforparam)) {
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || getDolGlobalString($keyforparam)) {
$select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility').'+'.$langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')';
}

View File

@@ -178,7 +178,7 @@ print '<div id="dolpaymentdiv" class="center">'."\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');

View File

@@ -268,7 +268,7 @@ print '<table id="dolpublictable" summary="Payment form" class="center">'."\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_SIGN_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_SIGN_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_SIGN_LOGO');

View File

@@ -135,7 +135,7 @@ print '<!-- Form to view jobs -->'."\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_OPENSURVEY_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_OPENSURVEY_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_OPENSURVEY_LOGO_');

View File

@@ -345,9 +345,9 @@ if (empty($validpaymentmethod)) {
$creditor = $mysoc->name;
$paramcreditor = 'ONLINE_PAYMENT_CREDITOR';
$paramcreditorlong = 'ONLINE_PAYMENT_CREDITOR_'.$suffix;
if (!empty($conf->global->$paramcreditorlong)) {
if (getDolGlobalString($paramcreditorlong)) {
$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show
} elseif (!empty($conf->global->$paramcreditor)) {
} elseif (getDolGlobalString($paramcreditor)) {
$creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show
}
@@ -897,7 +897,7 @@ print "\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');

View File

@@ -233,7 +233,7 @@ if (empty($doactionsthenredirect)) {
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');
@@ -275,7 +275,7 @@ if (empty($doactionsthenredirect)) {
print $langs->trans("YourPaymentHasNotBeenRecorded")."<br><br>";
$key = 'ONLINE_PAYMENT_MESSAGE_KO';
if (!empty($conf->global->$key)) {
if (getDolGlobalString($key)) {
print $conf->global->$key;
}

View File

@@ -220,7 +220,7 @@ if (empty($doactionsthenredirect)) {
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');

View File

@@ -236,7 +236,7 @@ print "\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_PAYMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_PAYMENT_LOGO');

View File

@@ -136,7 +136,7 @@ print '<!-- Form to view jobs -->'."\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_RECRUITMENT_LOGO_');

View File

@@ -198,7 +198,7 @@ print '<!-- Form to view job -->'."\n";
$logosmall = $mysoc->logo_small;
$logo = $mysoc->logo;
$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix;
if (!empty($conf->global->$paramlogo)) {
if (getDolGlobalString($paramlogo)) {
$logosmall = getDolGlobalString($paramlogo);
} elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) {
$logosmall = getDolGlobalString('ONLINE_RECRUITMENT_LOGO');

View File

@@ -556,7 +556,7 @@ class FormWebPortal extends Form
$textifempty = '&nbsp;';
//if (!empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
if (!empty($conf->global->$confkeyforautocompletemode)) {
if (getDolGlobalString($confkeyforautocompletemode)) {
if ($showempty && !is_numeric($showempty)) {
$textifempty = $langs->trans($showempty);
} else {