From ea42fc7605fcc7d2b29d7124fbe597dcf6d9b688 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Dec 2022 18:43:43 +0100 Subject: [PATCH] Clean code, fix warnings --- htdocs/accountancy/admin/accountmodel.php | 3 +- htdocs/accountancy/admin/categories_list.php | 3 +- htdocs/accountancy/admin/journals_list.php | 3 +- htdocs/admin/delais.php | 2 +- htdocs/admin/dict.php | 42 +++++++++---------- htdocs/admin/hrm.php | 16 +++---- htdocs/admin/knowledgemanagement.php | 22 +++++----- htdocs/admin/mails_templates.php | 11 ++--- htdocs/admin/modules.php | 4 +- htdocs/admin/system/database.php | 3 +- htdocs/admin/webhook.php | 26 ++++++------ htdocs/asset/admin/setup.php | 40 +++++++++--------- htdocs/comm/action/card.php | 4 +- htdocs/commande/card.php | 2 +- htdocs/compta/bank/treso.php | 4 +- htdocs/compta/facture/card.php | 4 +- htdocs/compta/tva/card.php | 2 +- .../core/class/commondocgenerator.class.php | 2 +- htdocs/core/class/html.form.class.php | 6 +-- htdocs/core/class/html.formactions.class.php | 2 +- htdocs/core/class/html.formcompany.class.php | 2 +- htdocs/core/class/html.formsetup.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 4 +- .../modules/import/import_csv.modules.php | 2 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/hrm/compare.php | 4 +- htdocs/imports/import.php | 4 +- htdocs/index.php | 18 +++----- ..._99_modMyModule_MyModuleTriggers.class.php | 2 +- .../class/multicurrency.class.php | 4 +- htdocs/product/price.php | 2 +- htdocs/product/stock/replenish.php | 4 +- htdocs/projet/card.php | 8 ++-- htdocs/projet/class/task.class.php | 6 ++- htdocs/projet/jsgantt_language.js.php | 2 +- htdocs/public/members/new.php | 2 +- htdocs/public/payment/newpayment.php | 6 +-- htdocs/societe/card.php | 6 +-- htdocs/takepos/admin/terminal.php | 2 +- htdocs/takepos/index.php | 2 +- htdocs/takepos/invoice.php | 13 ++---- htdocs/takepos/smpcb.php | 2 +- htdocs/user/class/user.class.php | 40 +++++++++++------- htdocs/webservices/server_thirdparty.php | 2 +- htdocs/website/index.php | 2 +- 46 files changed, 175 insertions(+), 171 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 02921a78cb2..c5b8fd20045 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -640,7 +640,8 @@ if ($id) { foreach ($fieldlist as $field => $value) { $showfield = 1; $class = "left"; - $valuetoshow = $obj->{$fieldlist[$field]}; + $tmpvar = $fieldlist[$field]; + $valuetoshow = $obj->$tmpvar; if ($value == 'type_template') { $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 755a5a88aed..0fd7b9012eb 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -751,7 +751,8 @@ if ($resql) { foreach ($fieldlist as $field => $value) { $showfield = 1; $class = "left"; - $valuetoshow = $obj->{$fieldlist[$field]}; + $tmpvar = $fieldlist[$field]; + $valuetoshow = $obj->$tmpvar; if ($value == 'category_type') { $valuetoshow = yn($valuetoshow); } elseif ($valuetoshow == 'all') { diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index e1a07fef5fc..ba2d867ebd6 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -587,7 +587,8 @@ if ($id) { foreach ($fieldlist as $field => $value) { $showfield = 1; $class = "left"; - $valuetoshow = $obj->{$fieldlist[$field]}; + $tmpvar = $fieldlist[$field]; + $valuetoshow = $obj->$tmpvar; if ($valuetoshow == 'all') { $valuetoshow = $langs->trans('All'); } elseif ($fieldlist[$field] == 'nature' && $tabname[$id] == MAIN_DB_PREFIX.'accounting_journal') { diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 59c826413aa..a3b790525ef 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -459,7 +459,7 @@ if ($action == 'edit') { print ''; } else { print '

'; - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; print '
'; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d928931c9ab..abf62b51fa7 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1944,7 +1944,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->{$value}) ? '' : $obj->{$value}; + $valuetoshow = empty($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { @@ -1985,76 +1985,76 @@ if ($id > 0) { } elseif ($value == 'libelle_facture') { $langs->load("bills"); $key = $langs->trans("PaymentCondition".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->$value); $valuetoshow = nl2br($valuetoshow); } elseif ($value == 'label' && $tabname[$id] == 'c_country') { $key = $langs->trans("Country".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'label' && $tabname[$id] == 'c_availability') { $langs->load("propal"); $key = $langs->trans("AvailabilityType".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_actioncomm') { $key = $langs->trans("Action".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->$value); } elseif (!empty($obj->code_iso) && $value == 'label' && $tabname[$id] == 'c_currencies') { $key = $langs->trans("Currency".strtoupper($obj->code_iso)); - $valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_typent') { $key = $langs->trans(strtoupper($obj->code)); - $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_prospectlevel') { $key = $langs->trans(strtoupper($obj->code)); - $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'label' && $tabname[$id] == 'c_civility') { $key = $langs->trans("Civility".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_type_contact') { $langs->load('agenda'); $key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_payment_term') { $langs->load("bills"); $key = $langs->trans("PaymentConditionShort".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_paiement') { $langs->load("bills"); $key = $langs->trans("PaymentType".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'type' && $tabname[$id] == 'c_paiement') { $payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth')); $valuetoshow = $payment_type_list[$valuetoshow]; } elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') { $key = $langs->trans("DemandReasonType".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_input_method') { $langs->load("orders"); $key = $langs->trans($obj->code); - $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$value}; + $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->$value; } elseif ($value == 'libelle' && $tabname[$id] == 'c_shipment_mode') { $langs->load("sendings"); $key = $langs->trans("SendingMethod".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'libelle' && $tabname[$id] == 'c_paper_format') { $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'label' && $tabname[$id] == 'c_type_fees') { $langs->load('trips'); $key = $langs->trans(strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->$value); } elseif ($value == 'region_id' || $value == 'country_id') { $showfield = 0; } elseif ($value == 'unicode') { $valuetoshow = $langs->getCurrencySymbol($obj->code, 1); } elseif ($value == 'label' && $tabname[GETPOST("id", 'int')] == 'c_units') { $langs->load("products"); - $valuetoshow = $langs->trans($obj->{$value}); + $valuetoshow = $langs->trans($obj->$value); } elseif ($value == 'short_label' && $tabname[GETPOST("id", 'int')] == 'c_units') { $langs->load("products"); - $valuetoshow = $langs->trans($obj->{$value}); + $valuetoshow = $langs->trans($obj->$value); } elseif (($value == 'unit') && ($tabname[$id] == 'c_paper_format')) { $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); - $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$value}); + $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$value); } elseif ($value == 'localtax1' || $value == 'localtax2') { $class = "center"; } elseif ($value == 'localtax1_type') { @@ -2357,7 +2357,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') foreach ($fieldlist as $field => $value) { if ($value == 'entity') { - $withentity = $obj->{$value}; + $withentity = $obj->$value; continue; } diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 73931ebf83d..22e56e98ba3 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -491,16 +491,16 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type'] == 'integer') { - print '' . "\n"; + print '' . "\n"; } elseif ($val['type'] == 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -575,9 +575,9 @@ if ($action == 'edit') { print ''; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { @@ -586,14 +586,14 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template<0) { setEventMessages(null, $formmail->errors, 'errors'); } print $langs->trans($template->label); } elseif (preg_match('/category:/', $val['type'])) { $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); + $result = $c->fetch(getDolGlobalString($constname)); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); } diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index b1710a53839..77b7c819142 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -209,14 +209,14 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type'] == 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -275,9 +275,9 @@ if ($action == 'edit') { print ''; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { @@ -286,7 +286,7 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template<0) { setEventMessages(null, $formmail->errors, 'errors'); } @@ -304,17 +304,17 @@ if ($action == 'edit') { } print '
'; } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { + if (getDolGlobalString($constname)==2) { print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { + } elseif (getDolGlobalString($constname)==3) { print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { + } elseif (getDolGlobalInt($constname)==1) { print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { + } elseif (getDolGlobalInt($constname)==0) { print $langs->trans("NorProspectNorCustomer"); } } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } print ''; } diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index a42c2283d13..16929336565 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1134,7 +1134,8 @@ if ($num) { $align = ""; $class = "tddict"; $title = ''; - $valuetoshow = $obj->{$fieldlist[$field]}; + $tmpvar = $fieldlist[$field]; + $valuetoshow = $obj->$tmpvar; if ($value == 'label' || $value == 'topic') { if ($langs->trans($valuetoshow) != $valuetoshow) { $valuetoshow = $langs->trans($valuetoshow); @@ -1282,19 +1283,19 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') if ($value == 'fk_user') { print ''; if ($user->admin) { - print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth200'); + print $form->select_dolusers(empty($obj->$value) ? '' : $obj->$value, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth150 maxwidth200'); } else { if ($context == 'add') { // I am not admin and we show the add form print $user->getNomUrl(1); // Me $forcedvalue = $user->id; } else { - if ($obj && !empty($obj->{$value}) && $obj->{$value} > 0) { + if ($obj && !empty($obj->$value) && $obj->$value > 0) { $fuser = new User($db); - $fuser->fetch($obj->{$value}); + $fuser->fetch($obj->$value); print $fuser->getNomUrl(1); $forcedvalue = $fuser->id; } else { - $forcedvalue = $obj->{$value}; + $forcedvalue = $obj->$value; } } $keyname = $value; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 45534aa66f5..b39576a8d44 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1216,10 +1216,10 @@ if ($mode == 'deploy') { print ''."\n"; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index 8cd1ad3d597..fd983a10924 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -113,7 +113,8 @@ if (!count($listofvars) && !count($listofstatus)) { if ($key != $param) { continue; } - $val2 = ${$val['var']}; + $tmpvar = $val['var']; + $val2 = ${$tmpvar}; $text = 'Should be in line with value of param '.$val['var'].' thas is '.($val2 ? $val2 : "'' (=".$val['valifempty'].")").''; $show = 1; } diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index b589eac4079..6ba932c007b 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -293,14 +293,14 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type']== 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -382,9 +382,9 @@ if ($action == 'edit') { print ''; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { @@ -393,14 +393,14 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template<0) { setEventMessages(null, $formmail->errors, 'errors'); } print $langs->trans($template->label); } elseif (preg_match('/category:/', $val['type'])) { $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); + $result = $c->fetch(getDolGlobalString($constname)); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); } elseif ($result > 0 ) { @@ -412,25 +412,25 @@ if ($action == 'edit') { print '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { + if (getDolGlobalInt($constname)==2) { print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { + } elseif (getDolGlobalInt($constname)==3) { print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { + } elseif (getDolGlobalInt($constname)==1) { print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { + } elseif (getDolGlobalInt($constname)==0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); + $resprod = $product->fetch(getDolGlobalInt($constname)); if ($resprod > 0) { print $product->ref; } elseif ($resprod < 0) { setEventMessages(null, $object->errors, "errors"); } } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } print ''; } diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 965566c3a74..deb4b0da346 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -473,14 +473,14 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type']== 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -500,7 +500,7 @@ if ($action == 'edit') { $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; } } - print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1); } elseif (preg_match('/category:/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -508,11 +508,11 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); } elseif (preg_match('/thirdparty_type/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $formcompany = new FormCompany($db); - print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); + print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname); } elseif ($val['type'] == 'securekey') { print ''; if (!empty($conf->use_javascript_ajax)) { @@ -524,11 +524,11 @@ if ($action == 'edit') { print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); } elseif ($val['type'] == 'product') { if (isModEnabled("product") || isModEnabled("service")) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); $form->select_produits($selected, $constname, '', 0); } } elseif ($val['type'] == 'accountancy_code') { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $formaccounting = new FormAccounting($db); @@ -537,7 +537,7 @@ if ($action == 'edit') { print ''; } } elseif ($val['type'] == 'accountancy_category') { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); if (isModEnabled('accounting')) { print ''; // autosuggest from existing account types if found @@ -587,9 +587,9 @@ if ($action == 'edit') { print ''; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { @@ -598,14 +598,14 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template<0) { setEventMessages(null, $formmail->errors, 'errors'); } print $langs->trans($template->label); } elseif (preg_match('/category:/', $val['type'])) { $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); + $result = $c->fetch(getDolGlobalInt($constname)); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); } elseif ($result > 0 ) { @@ -617,18 +617,18 @@ if ($action == 'edit') { print '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { + if (getDolGlobalInt($constname)==2) { print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { + } elseif (getDolGlobalInt($constname)==3) { print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { + } elseif (getDolGlobalInt($constname)==1) { print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { + } elseif (getDolGlobalInt($constname)==0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); + $resprod = $product->fetch(getDolGlobalInt($constname)); if ($resprod > 0) { print $product->ref; } elseif ($resprod < 0) { @@ -638,11 +638,11 @@ if ($action == 'edit') { if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $conf->global->{$constname}, 1); + $accountingaccount->fetch('', getDolGlobalString($constname), 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } } else { print $conf->global->{$constname}; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f0399fa6350..d1329e40454 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1602,7 +1602,7 @@ if ($action == 'create') { $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { $("#select_actioncommsendmodel_mail").closest("tr").hide(); - }; + } }); })'; print ''."\n"; @@ -2104,7 +2104,7 @@ if ($id > 0) { $("#select_actioncommsendmodel_mail").closest("tr").show(); } else { $("#select_actioncommsendmodel_mail").closest("tr").hide(); - }; + } }); })'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 383cf7581e9..a644880282b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1898,7 +1898,7 @@ if ($action == 'create' && $usercancreate) { if ($soc->fetch_optionals() > 0) { $object->array_options = array_merge($object->array_options, $soc->array_options); } - }; + } print $object->showOptionals($extrafields, 'create', $parameters); } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index d3e573f21bf..e75402ba429 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -353,10 +353,10 @@ if (GETPOST("account") || GETPOST("ref")) { print "".$refcomp.""; if ($tmpobj->total_ttc < 0) { print ''.price(abs($total_ttc))." "; - }; + } if ($tmpobj->total_ttc >= 0) { print ' '.price($total_ttc).""; - }; + } print ''.price($solde).''; print ""; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e28e5427c0b..14f82abe1a4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3357,7 +3357,7 @@ if ($action == 'create') { jQuery(".checkforselect").prop("disabled", false); jQuery(".checkforselect").prop("checked", true); } - }; + } }); '; @@ -3780,7 +3780,7 @@ if ($action == 'create') { if ($soc->fetch_optionals() > 0) { $object->array_options = array_merge($object->array_options, $soc->array_options); } - }; + } print $object->showOptionals($extrafields, 'create', $parameters); } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index e7c7678b818..1cd655603bc 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -405,7 +405,7 @@ if ($action == 'create') { $("#label_type_payment").removeClass("fieldrequired"); $(".hide_if_no_auto_create_payment").hide(); } - }; + } $("#radiopayment").click(function() { $("#label").val($(this).data("label")); }); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 82012400f68..88ee43fd713 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -687,7 +687,7 @@ abstract class CommonDocGenerator $resql = $this->db->fetch_object($resql); foreach ($extralabels as $key => $label) { - $resarray['line_product_supplier_'.$key] = $resql->{$key}; + $resarray['line_product_supplier_'.$key] = $resql->$key; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 686d500875a..a6eac03cadc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8228,7 +8228,7 @@ class Form return { q: params.term, // search term page: params.page - }; + } }, processResults: function (data) { // parse the results into the format expected by Select2. @@ -8480,14 +8480,14 @@ class Form $out .= 'function formatResult(record, container) {'."\n"; $out .= ' if ($(record.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(record.element).attr("data-html")); // If property html set, we decode html entities and use this'."\n"; $out .= ' return record.text;'; - $out .= '};'."\n"; + $out .= '}'."\n"; $out .= 'function formatSelection(record) {'."\n"; if ($elemtype == 'category') { $out .= 'return \' \'+record.text+\'\';'; } else { $out .= 'return record.text;'; } - $out .= '};'."\n"; + $out .= '}'."\n"; $out .= '$(document).ready(function () { $(\'#'.$htmlname.'\').'.$tmpplugin.'({'; if ($placeholder) { diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 364a638e13f..90c9857992a 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -115,7 +115,7 @@ class FormActions $('.hideifna').show(); } else { - if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) }; + if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50); } percentage.removeAttr('disabled'); $('.hideifna').show(); } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 5f27cbf3477..82ab8031155 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -690,7 +690,7 @@ class FormCompany extends Form } } ); - }; + } }); '; } diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index c57ee0c5106..eb389454f82 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -662,7 +662,7 @@ class FormSetupItem { global $conf; if (isset($conf->global->{$this->confKey})) { - $this->fieldValue = $conf->global->{$this->confKey}; + $this->fieldValue = getDolGlobalString($this->confKey); return true; } else { $this->fieldValue = null; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index eb0c7668d8c..0aa2c39de91 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -362,7 +362,7 @@ class FormTicket print ' '; } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index e1699660acc..f204acd4747 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -1039,4 +1039,4 @@ class ImportCsv extends ModeleImports function cleansep($value) { return str_replace(array(',', ';'), '/', $value); -}; +} diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f008aacc10e..69e5795a881 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -511,7 +511,7 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); print ' '.$langs->trans('to').' '; print $form->selectDate($date_end, 'date_end', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); - }; + } if ($prefillDates) { echo ' '.$langs->trans('FillWithLastServiceDates').''; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b193048047a..43262e4f3e3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2212,7 +2212,7 @@ if ($action == 'create') { jQuery(".checkforselect").prop("disabled", false); jQuery(".checkforselect").prop("checked", true); } - }; + } }); '; diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index 686d5820695..d1dde23a63c 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -319,11 +319,11 @@ function rate(&$TMergedSkills, $field) foreach ($TMergedSkills as $id => &$sk) { $class = "note"; $how_many = 0; - if (empty($sk->{$field})) { + if (empty($sk->$field)) { $note = 'x'; $class .= ' none'; } else { - $note = $sk->{$field}; + $note = $sk->$field; $how_many = ($field === 'rate1') ? $sk->how_many_max1 : $sk->how_many_max2; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 9a33bd25c05..579fdb74c4a 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1354,7 +1354,7 @@ if ($step == 4 && $datatoimport) { print ' $("select.targetselectchange").find(\'option[value="\'+value+\'"]:not(:selected)\').prop("disabled", true);'."\n"; // Set to disabled except if currently selected print ' }'."\n"; print ' });'."\n"; - print '};'."\n"; + print '}'."\n"; // Function to save the selection in database print 'function saveSelection() {'."\n"; @@ -1402,7 +1402,7 @@ if ($step == 4 && $datatoimport) { } "; - print '};'."\n"; + print '}'."\n"; // If we make a change on a selectbox print '$(".targetselectchange").change(function(){'."\n"; diff --git a/htdocs/index.php b/htdocs/index.php index 06a829ea4b5..e0001adba5e 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -806,23 +806,15 @@ function getWeatherStatus($totallate) $used_conf = empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_LEVEL' : 'MAIN_METEO_PERCENTAGE_LEVEL'; - $level0 = $offset; $weather->level = 0; - if (!empty($conf->global->{$used_conf.'0'})) { - $level0 = $conf->global->{$used_conf.'0'}; - } + $level0 = $offset; + $level0 = getDolGlobalString($used_conf.'0', $level0); $level1 = $offset + 1 * $factor; - if (!empty($conf->global->{$used_conf.'1'})) { - $level1 = $conf->global->{$used_conf.'1'}; - } + $level1 = getDolGlobalString($used_conf.'1', $level1); $level2 = $offset + 2 * $factor; - if (!empty($conf->global->{$used_conf.'2'})) { - $level2 = $conf->global->{$used_conf.'2'}; - } + $level2 = getDolGlobalString($used_conf.'2', $level2); $level3 = $offset + 3 * $factor; - if (!empty($conf->global->{$used_conf.'3'})) { - $level3 = $conf->global->{$used_conf.'3'}; - } + $level3 = getDolGlobalString($used_conf.'3', $level3); if ($totallate <= $level0) { $weather->picto = 'weather-clear.png'; diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 8f7764ad100..c51bc01376c 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -107,7 +107,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers ); return call_user_func($callback, $action, $object, $user, $langs, $conf); - }; + } // Or you can execute some code here switch ($action) { diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 8b42f7cb25b..4305aed6f3b 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -615,8 +615,8 @@ class MultiCurrency extends CommonObject if ($conf->currency != $conf->global->MULTICURRENCY_APP_SOURCE) { $alternate_source = 'USD'.$conf->currency; - if (!empty($TRate->{$alternate_source})) { - $coef = $TRate->USDUSD / $TRate->{$alternate_source}; + if (!empty($TRate->$alternate_source)) { + $coef = $TRate->USDUSD / $TRate->$alternate_source; foreach ($TRate as $attr => &$rate) { $rate *= $coef; } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 0424ddaf830..788857dfd47 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1529,7 +1529,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { otherPrices.show(); minPrice1.show(); } - }; + } jQuery(document).ready(function () { showHidePriceRules(); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index d1644623ce1..2520eb8f559 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -78,12 +78,12 @@ while ($tmpobj = $db->fetch_object($resWar)) { $listofqualifiedwarehousesid .= $tmpobj->rowid; $lastWarehouseID = $tmpobj->rowid; $count++; -}; +} //MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { $fk_entrepot = $lastWarehouseID; -}; +} $texte = ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index e7467176c10..96b4aa0b03b 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -968,7 +968,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide opportunities fields "+jQuery("#usage_opportunity").prop("checked")); jQuery(".classuseopportunity").hide(); } - }; + } });'; print ''; print '
'; @@ -994,7 +994,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide task fields "+jQuery("#usage_task").prop("checked")); jQuery(".classusetask").hide(); } - }; + } });'; print ''; print '
'; @@ -1020,7 +1020,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide bill time fields "+jQuery("#usage_bill_time").prop("checked")); jQuery(".classusebilltime").hide(); } - }; + } });'; print ''; print '
'; @@ -1046,7 +1046,7 @@ if ($action == 'create' && $user->rights->projet->creer) { console.log("Hide organize event fields "+jQuery("#usage_organize_event").prop("checked")); jQuery(".classuseorganizeevent").hide(); } - }; + } });'; print ''; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 91333c153f8..458921adfc6 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1025,7 +1025,8 @@ class Task extends CommonObjectLine if (!empty($extrafields->attributes['projet']['label'])) { foreach ($extrafields->attributes['projet']['label'] as $key => $val) { if ($extrafields->attributes['projet']['type'][$key] != 'separate') { - $tasks[$i]->{'options_'.$key} = $obj->{'options_'.$key}; + $tmpvar = 'options_'.$key; + $tasks[$i]->{'options_'.$key} = $obj->$tmpvar; } } } @@ -1033,7 +1034,8 @@ class Task extends CommonObjectLine if (!empty($extrafields->attributes['projet_task']['label'])) { foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) { if ($extrafields->attributes['projet_task']['type'][$key] != 'separate') { - $tasks[$i]->{'options_'.$key} = $obj->{'options_'.$key}; + $tmpvar = 'options_'.$key; + $tasks[$i]->{'options_'.$key} = $obj->$tmpvar; } } } diff --git a/htdocs/projet/jsgantt_language.js.php b/htdocs/projet/jsgantt_language.js.php index 35ab1132ae7..93b9ee5505f 100644 --- a/htdocs/projet/jsgantt_language.js.php +++ b/htdocs/projet/jsgantt_language.js.php @@ -67,7 +67,7 @@ var vLangs={'getDefaultLang(1); ?>': 'sunday':'transnoentities('Sunday'); ?>','monday':'transnoentities('Monday'); ?>','tuesday':'transnoentities('Tuesday'); ?>','wednesday':'transnoentities('Wednesday'); ?>','thursday':'transnoentities('Thursday'); ?>','friday':'transnoentities('Friday'); ?>','saturday':'transnoentities('Saturday'); ?>', 'sun':'transnoentities('SundayMin'); ?>','mon':'transnoentities('MondayMin'); ?>','tue':'transnoentities('TuesdayMin'); ?>','wed':'transnoentities('WednesdayMin'); ?>','thu':'transnoentities('ThursdayMin'); ?>','fri':'transnoentities('FridayMin'); ?>','sat':'transnoentities('SaturdayMin'); ?>' } -}; +} var vLang='getDefaultLang(1); ?>'; global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW if (jQuery("#morphy").val() == \'mor\') { jQuery("#trcompany").show(); } - }; + } initmorphy(); jQuery("#morphy").change(function() { initmorphy(); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 79104817e77..e9823f2d0f7 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2395,7 +2395,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme color: '#fa755a', iconColor: '#fa755a' } - }; + } var cardElement = elements.create('card', {style: style}); @@ -2435,7 +2435,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme ?> var cardButton = document.getElementById('buttontopay'); var clientSecret = cardButton.dataset.secret; - var options = { clientSecret: clientSecret,}; + var options = { clientSecret: clientSecret }; // Create an instance of Elements var elements = stripe.elements(options); @@ -2465,7 +2465,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme color: '#fa755a', iconColor: '#fa755a' } - }; + } displayCanvasExists($action)) { data: function (params) { return { newcompany: params.term // search term - }; + } }, processResults: function (data, params) { return { results: data - }; + } }, cache: true }, @@ -2150,7 +2150,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { { jQuery(".visibleifsupplier").show(); } - }; + } $("#selectcountry_id").change(function() { document.formsoc.action.value="edit"; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index fe03139c8a3..f93608d20b8 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -268,7 +268,7 @@ if (isModEnabled('stock')) { } print ''; - $disabled = $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}; + $disabled = getDolGlobalString('CASHDESK_NO_DECREASE_STOCK'.$terminal); print ''.$langs->trans("CashDeskIdWareHouse").''; // Force warehouse (this is not a default value) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dc2bd8b684a..fb3049715cf 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -956,7 +956,7 @@ $( document ).ready(function() { return { vertical:container.scrollHeight > container.clientHeight, horizontal:container.scrollWidth > container.clientWidth - }; + } } $(window).resize(function(){ diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ccc1fde97eb..ea262a1562f 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -174,12 +174,12 @@ if (empty($reshook)) { $bankaccount = GETPOST('accountid', 'int'); } else { if ($pay == 'LIQ') { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility } elseif ($pay == "CHQ") { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility + $bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility } else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; - $bankaccount = $conf->global->$accountname; + $bankaccount = getDolGlobalString($accountname); } } @@ -217,13 +217,6 @@ if (empty($reshook)) { $invoice->update($user); } - //$sav_FACTURE_ADDON = ''; - //if (!empty($conf->global->TAKEPOS_ADDON)) { - // $sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON; - // if ($conf->global->TAKEPOS_ADDON == "terminal") $conf->global->FACTURE_ADDON = $conf->global->{'TAKEPOS_ADDON'.$_SESSION["takeposterminal"]}; - // else $conf->global->FACTURE_ADDON = $conf->global->TAKEPOS_ADDON; - //} - $constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"]; if ($error) { dol_htmloutput_errors($errormsg, null, 1); diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php index 505ec27c1b0..6ce39d39bf0 100644 --- a/htdocs/takepos/smpcb.php +++ b/htdocs/takepos/smpcb.php @@ -71,7 +71,7 @@ if (GETPOST('smp-status')) { print ''; print "Transaction status registered, you can close this"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 52a9f941cfe..4e90bbb1bd9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3371,24 +3371,36 @@ class User extends CommonObject $socialnetworks = getArrayOfSocialNetworks(); - $this->firstname = $ldapuser->{$conf->global->LDAP_FIELD_FIRSTNAME}; - $this->lastname = $ldapuser->{$conf->global->LDAP_FIELD_NAME}; - $this->login = $ldapuser->{$conf->global->LDAP_FIELD_LOGIN}; - $this->pass = $ldapuser->{$conf->global->LDAP_FIELD_PASSWORD}; - $this->pass_indatabase_crypted = $ldapuser->{$conf->global->LDAP_FIELD_PASSWORD_CRYPTED}; + $tmpvar = getDolGlobalString('LDAP_FIELD_FIRSTNAME'); + $this->firstname = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_NAME'); + $this->lastname = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_LOGIN'); + $this->login = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_PASSWORD'); + $this->pass = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED'); + $this->pass_indatabase_crypted = $ldapuser->$tmpvar; - $this->office_phone = $ldapuser->{$conf->global->LDAP_FIELD_PHONE}; - $this->user_mobile = $ldapuser->{$conf->global->LDAP_FIELD_MOBILE}; - $this->office_fax = $ldapuser->{$conf->global->LDAP_FIELD_FAX}; - $this->email = $ldapuser->{$conf->global->LDAP_FIELD_MAIL}; + $tmpvar = getDolGlobalString('LDAP_FIELD_PHONE'); + $this->office_phone = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_MOBILE'); + $this->user_mobile = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_FAX'); + $this->office_fax = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_MAIL'); + $this->email = $ldapuser->$tmpvar; foreach ($socialnetworks as $key => $value) { - $tmpkey = 'LDAP_FIELD_'.strtoupper($value['label']); - $this->socialnetworks[$value['label']] = $ldapuser->{$conf->global->$tmpkey}; + $tmpvar = getDolGlobalString('LDAP_FIELD_'.strtoupper($value['label'])); + $this->socialnetworks[$value['label']] = $ldapuser->$tmpvar; } - $this->ldap_sid = $ldapuser->{$conf->global->LDAP_FIELD_SID}; + $tmpvar = getDolGlobalString('LDAP_FIELD_SID'); + $this->ldap_sid = $ldapuser->$tmpvar; - $this->job = $ldapuser->{$conf->global->LDAP_FIELD_TITLE}; - $this->note_public = $ldapuser->{$conf->global->LDAP_FIELD_DESCRIPTION}; + $tmpvar = getDolGlobalString('LDAP_FIELD_TITLE'); + $this->job = $ldapuser->$tmpvar; + $tmpvar = getDolGlobalString('LDAP_FIELD_DESCRIPTION'); + $this->note_public = $ldapuser->$tmpvar; $result = $this->update($user); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 800c2e0e2a2..1fe15576860 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -736,7 +736,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { if (isset($obj->{$key})) { - $extrafieldsOptions['options_'.$key] = $obj->{$key}; + $extrafieldsOptions['options_'.$key] = $obj->$key; } } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ae3362ab9d6..2cb775019e6 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3294,7 +3294,7 @@ if (!GETPOST('hide_websitemenu')) { } isEditingEnabled = false; } - }; + } }); '; print $langs->trans("EditInLine");