diff --git a/dev/tools/rector/src/Renaming/GlobalToFunction.php b/dev/tools/rector/src/Renaming/GlobalToFunction.php index c5b1c7bfbc9..fd1a3d7dd66 100644 --- a/dev/tools/rector/src/Renaming/GlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/GlobalToFunction.php @@ -140,7 +140,7 @@ class GlobalToFunction extends AbstractRector if ($node instanceof FuncCall) { $tmpfunctionname = $this->getName($node); // If function is ok. We must avoid a lot of cases like isset(), empty() - if (in_array($tmpfunctionname, array('dol_escape_htmltag', 'dol_hash', 'explode', 'length_accountg', 'length_accounta', 'make_substitutions', 'min', 'max', 'trunc', 'urlencode', 'yn'))) { + if (in_array($tmpfunctionname, array('dol_escape_htmltag', 'dol_hash', 'explode', 'is_numeric', 'length_accountg', 'length_accounta', 'make_substitutions', 'min', 'max', 'trunc', 'urlencode', 'yn'))) { //print "tmpfunctionname=".$tmpfunctionname."\n"; $args = $node->getArgs(); $nbofparam = count($args); @@ -170,7 +170,7 @@ class GlobalToFunction extends AbstractRector if ($node instanceof MethodCall) { $tmpmethodname = $this->getName($node->name); // If function is ok. We must avoid a lot of cases - if (in_array($tmpmethodname, array('idate', 'sanitize', 'select_language'))) { + if (in_array($tmpmethodname, array('fetch', 'idate', 'sanitize', 'select_language', 'trans'))) { //print "tmpmethodname=".$tmpmethodname."\n"; $expr = $node->var; $args = $node->getArgs(); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index aaba332d2ef..1e35eebbed1 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -206,7 +206,7 @@ if (empty($reshook)) { } if ($action == 'export_csv') { - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $filename = 'balance'; $type_export = 'balance'; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index e372ab9c206..06ab11b4f49 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -47,7 +47,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; */ class AccountancyExport { - // Type of export. Used into $conf->global->ACCOUNTING_EXPORT_MODELCSV + // Types of export. public static $EXPORT_TYPE_CONFIGURABLE = 1; // CSV public static $EXPORT_TYPE_AGIRIS = 10; public static $EXPORT_TYPE_EBP = 15; @@ -102,7 +102,7 @@ class AccountancyExport global $conf, $hookmanager; $this->db = $db; - $this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $this->separator = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $this->end_line = getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? (getDolGlobalInt('ACCOUNTING_EXPORT_ENDLINE') == 1 ? "\n" : "\r\n") : "\n"; $hookmanager->initHooks(array('accountancyexport')); @@ -869,11 +869,11 @@ class AccountancyExport if ($line->doc_type == 'customer_invoice') { $tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc(dol_string_unaccent($line->subledger_label), 6), 7)); $tab['filler'] = str_repeat(' ', 52); - $tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8); + $tab['coll_compte'] = str_pad(self::trunc(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), 8), 8); } elseif ($line->doc_type == 'supplier_invoice') { $tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc(dol_string_unaccent($line->subledger_label), 6), 7)); $tab['filler'] = str_repeat(' ', 52); - $tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8); + $tab['coll_compte'] = str_pad(self::trunc(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), 8), 8); } else { $tab['filler'] = str_repeat(' ', 59); $tab['coll_compte'] = str_pad(' ', 8); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 637e2bc8f68..423ca2b4ddf 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -878,9 +878,9 @@ class AccountingAccount extends CommonObject if ($factureDet->desc == "(DEPOSIT)" || $facture->type == $facture::TYPE_DEPOSIT) { $accountdeposittoventilated = new self($this->db); if ($type == 'customer') { - $result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1); + $result = $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1); } elseif ($type == 'supplier') { - $result = $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1); + $result = $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1); } if (isset($result) && $result < 0) { return -1; @@ -901,9 +901,9 @@ class AccountingAccount extends CommonObject if ($facture->type == $facture::TYPE_CREDIT_NOTE && $invoiceSource->type == $facture::TYPE_DEPOSIT) { $accountdeposittoventilated = new self($this->db); if ($type == 'customer') { - $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1); + $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT'), 1); } elseif ($type == 'supplier') { - $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT, 1); + $accountdeposittoventilated->fetch('', getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT'), 1); } $code_l = $accountdeposittoventilated->ref; $code_p = ''; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index dd8dd36e2c9..c8bc40560fe 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -930,7 +930,7 @@ class AccountingJournal extends CommonObject global $conf, $langs, $hookmanager; if (empty($sep)) { - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); } $out = ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 11c00917743..4bd365acfa3 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -607,16 +607,16 @@ if (!$error && $action == 'writebookkeeping') { $now = dol_now(); $accountingaccountcustomer = new AccountingAccount($db); - $accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); + $accountingaccountcustomer->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), true); $accountingaccountsupplier = new AccountingAccount($db); - $accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); + $accountingaccountsupplier->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), true); $accountingaccountpayment = new AccountingAccount($db); - $accountingaccountpayment->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + $accountingaccountpayment->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true); $accountingaccountsuspense = new AccountingAccount($db); - $accountingaccountsuspense->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true); + $accountingaccountsuspense->fetch(null, getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'), true); $error = 0; foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank @@ -736,23 +736,23 @@ if (!$error && $action == 'writebookkeeping') { $lettering = true; $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'); $bookkeeping->label_compte = $accountingaccountcustomer->label; } elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $lettering = true; $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'); $bookkeeping->label_compte = $accountingaccountsupplier->label; } elseif ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; - $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); $bookkeeping->label_compte = $accountingaccountpayment->label; } elseif ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; - $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); $bookkeeping->label_compte = $accountingaccountpayment->label; } elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution $bookkeeping->subledger_account = ''; @@ -801,7 +801,7 @@ if (!$error && $action == 'writebookkeeping') { // Temporary account $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; + $bookkeeping->numero_compte = getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'); $bookkeeping->label_compte = $accountingaccountsuspense->label; } } @@ -1397,16 +1397,10 @@ if (empty($action) || $action == 'view') { print ''.$langs->trans("WaitAccountNotDefined").''; } else */ - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE); + print length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')); print ""; // Subledger account print ""; - /*if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') - { - print ''.$langs->trans("WaitAccountNotDefined").''; - } - else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE); - */ print ""; print "".dol_escape_htmltag($reflabel).""; print ''.$val["type_payment"].""; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index a1bf3006328..19d003d34e0 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -488,7 +488,7 @@ $userstatic = new User($db); // Export if ($action == 'exportcsv' && !$error) { // ISO and not UTF8 ! - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $filename = 'journal'; $type_export = 'journal'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a3bc6ce2ade..8a79ea6f106 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1817,7 +1817,7 @@ class Adherent extends CommonObject // Add line to draft invoice $idprodsubscription = 0; if (getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && (isModEnabled("product") || isModEnabled("service"))) { - $idprodsubscription = $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS; + $idprodsubscription = getDolGlobalString('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); } $vattouse = 0; @@ -2598,7 +2598,7 @@ class Adherent extends CommonObject if ($this->model_pdf) { $modele = $this->model_pdf; } elseif (getDolGlobalString('ADHERENT_ADDON_PDF')) { - $modele = $conf->global->ADHERENT_ADDON_PDF; + $modele = getDolGlobalString('ADHERENT_ADDON_PDF'); } } @@ -2697,7 +2697,7 @@ class Adherent extends CommonObject $dn = getDolGlobalString('LDAP_KEY_MEMBERS') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')]."," . getDolGlobalString('LDAP_MEMBER_DN'); } if ($mode == 1) { - $dn = $conf->global->LDAP_MEMBER_DN; + $dn = getDolGlobalString('LDAP_MEMBER_DN'); } if ($mode == 2) { $dn = getDolGlobalString('LDAP_KEY_MEMBERS') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')]; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 511553b9e88..ff95d3c12c6 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -373,7 +373,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'subscripti // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; + $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); @@ -869,7 +869,7 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h print "\n\n\n"; if ($conf->use_javascript_ajax) { - //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE)); + //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly); print "\n".'