From fbbdcd1d4c2b37afc5b25025212e3590041c3844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 7 Sep 2022 10:28:23 +0200 Subject: [PATCH] fix php8 warnings --- htdocs/comm/propal/card.php | 2 +- .../core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/propale/doc/pdf_cyan.modules.php | 2 +- htdocs/datapolicy/admin/setupmail.php | 2 +- .../product/class/propalmergepdfproduct.class.php | 8 ++++---- htdocs/product/document.php | 14 +++++++------- htdocs/societe/paymentmodes.php | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 53ba07ba441..388a4f97d4b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -722,7 +722,7 @@ if (empty($reshook)) { $ret = $deposit->fetch($deposit->id); // Reload to get new records $outputlangs = $langs; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($deposit->thirdparty->default_lang); $outputlangs->load('products'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 86d6306a576..c2971c9344e 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -793,7 +793,7 @@ class pdf_azur extends ModelePDFPropales // Find the desire PDF $filetomerge = new Propalmergepdfproduct($this->db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang); } else { $filetomerge->fetch_by_product($line->fk_product); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index ec04a8e8906..9d52132db56 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -918,7 +918,7 @@ class pdf_cyan extends ModelePDFPropales // Find the desire PDF $filetomerge = new Propalmergepdfproduct($this->db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang); } else { $filetomerge->fetch_by_product($line->fk_product); diff --git a/htdocs/datapolicy/admin/setupmail.php b/htdocs/datapolicy/admin/setupmail.php index e2f562ee79b..825bd13b142 100644 --- a/htdocs/datapolicy/admin/setupmail.php +++ b/htdocs/datapolicy/admin/setupmail.php @@ -106,7 +106,7 @@ print '
'; print ''; print ''; print ''; -if ($conf->global->MAIN_MULTILANGS) { +if (!empty($conf->global->MAIN_MULTILANGS)) { print ''; diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index e69c75c7336..b4b85c3852a 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -107,7 +107,7 @@ class Propalmergepdfproduct extends CommonObject $sql = "INSERT INTO ".$this->db->prefix()."propal_merge_pdf_product("; $sql .= "fk_product,"; $sql .= "file_name,"; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= "lang,"; } $sql .= "fk_user_author,"; @@ -116,7 +116,7 @@ class Propalmergepdfproduct extends CommonObject $sql .= ") VALUES ("; $sql .= " ".(!isset($this->fk_product) ? 'NULL' : ((int) $this->fk_product)).","; $sql .= " ".(!isset($this->file_name) ? 'NULL' : "'".$this->db->escape($this->file_name)."'").","; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= " ".(!isset($this->lang) ? 'NULL' : "'".$this->db->escape($this->lang)."'").","; } $sql .= " ".((int) $user->id).","; @@ -186,7 +186,7 @@ class Propalmergepdfproduct extends CommonObject $this->fk_product = $obj->fk_product; $this->file_name = $obj->file_name; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $this->lang = $obj->lang; } $this->fk_user_author = $obj->fk_user_author; @@ -311,7 +311,7 @@ class Propalmergepdfproduct extends CommonObject $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; $sql .= " file_name=".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").","; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= " lang=".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").","; } $sql .= " fk_user_mod=".$user->id; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 2aaa2356879..ee5ba79a284 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -154,14 +154,14 @@ if ($action == 'filemerge' && $permissiontoadd) { $filetomerge_file_array = GETPOST('filetoadd'); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $lang_id = GETPOST('lang_id', 'aZ09'); } // Delete all file already associated $filetomerge = new Propalmergepdfproduct($db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $result = $filetomerge->delete_by_product($user, $object->id, $lang_id); } else { $result = $filetomerge->delete_by_product($user, $object->id); @@ -176,7 +176,7 @@ if ($action == 'filemerge' && $permissiontoadd) { $filetomerge->fk_product = $object->id; $filetomerge->file_name = $filetomerge_file; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $filetomerge->lang = $lang_id; } @@ -271,7 +271,7 @@ if ($object->id) { if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { $filetomerge = new Propalmergepdfproduct($db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $lang_id = GETPOST('lang_id', 'aZ09'); $result = $filetomerge->fetch_by_product($object->id, $lang_id); } else { @@ -305,7 +305,7 @@ if ($object->id) { print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).''."\n"; print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); print '
'; // Get language - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $langs->load("languages"); print '
'; @@ -316,7 +316,7 @@ if ($object->id) { print Form::selectarray('lang_id', $langs_available, $default_lang, 0, 0, 0, '', 0, 0, 0, 'ASC'); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { print ''; } @@ -328,7 +328,7 @@ if ($object->id) { $checked = ''; $filename = $filetoadd['name']; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { if (array_key_exists($filetoadd['name'].'_'.$default_lang, $filetomerge->lines)) { $filename = $filetoadd['name'].' - '.$langs->trans('Language_'.$default_lang); $checked = ' checked '; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 20cce294586..e7899db813e 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1467,7 +1467,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $allowgenifempty = 0; // Language code (if multilang) - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); $defaultlang = $langs->getDefaultLang();