fix php8 warnings

This commit is contained in:
Frédéric France 2022-09-07 10:28:23 +02:00
parent ff2fe35592
commit fbbdcd1d4c
7 changed files with 16 additions and 16 deletions

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -106,7 +106,7 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?l='.$l.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvalue">';
print '<table>';
if ($conf->global->MAIN_MULTILANGS) {
if (!empty($conf->global->MAIN_MULTILANGS)) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print '</tr>';

View File

@ -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;

View File

@ -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 '<table class="noborder">';
// Get language
if ($conf->global->MAIN_MULTILANGS) {
if (!empty($conf->global->MAIN_MULTILANGS)) {
$langs->load("languages");
print '<tr class="liste_titre"><td>';
@ -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 '<input type="submit" class="button" name="refresh" value="'.$langs->trans('Refresh').'">';
}
@ -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 ';

View File

@ -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();