Merge pull request #16842 from hregis/fix_avoid_warning_php8

FIX avoid php8 warning in products list
This commit is contained in:
Laurent Destailleur 2021-03-20 11:48:53 +01:00 committed by GitHub
commit 2da85a9ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -1597,7 +1597,7 @@ class ExtraFields
if (!empty($extrafieldsobjectkey)) {
$label = $this->attributes[$extrafieldsobjectkey]['label'][$key];
$type = $this->attributes[$extrafieldsobjectkey]['type'][$key];
$size = $this->attributes[$extrafieldsobjectkey]['size'][$key];
$size = (int) $this->attributes[$extrafieldsobjectkey]['size'][$key];
$default = $this->attributes[$extrafieldsobjectkey]['default'][$key];
$computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key];
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
@ -1666,7 +1666,7 @@ class ExtraFields
$value = price($value, 0, $langs, 0, 0, -1);
}
} elseif ($type == 'select') {
$valstr = $param['options'][$value];
$valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : '');
if (($pos = strpos($valstr, "|")) !== false) {
$valstr = substr($valstr, 0, $pos);
}

View File

@ -6684,7 +6684,7 @@ class Form
if (!dol_eval($val['enabled'], 1, 1)) {
continue;
}
if ($val['showoncombobox']) {
if (!empty($val['showoncombobox'])) {
$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
}
}
@ -6817,7 +6817,7 @@ class Form
if (!$forcecombo) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode);
$out .= ajax_combobox($htmlname, null, (!empty($conf->global->$confkeyforautocompletemode) ? $conf->global->$confkeyforautocompletemode : 0));
}
} else {
dol_print_error($this->db);

View File

@ -35,7 +35,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
}
$value = $datenotinstring;
} else {
$value = $obj->$tmpkey;
$value = (!empty($obj->$tmpkey) ? $obj->$tmpkey : '');
}
// If field is a computed field, we make computation to get value
if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) {

View File

@ -37,17 +37,17 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
if (in_array($typeofextrafield, array('int', 'double'))) {
$searchclass = 'searchnum';
}
print '<input class="flat'.($searchclass ? ' '.$searchclass : '').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options[$search_options_pattern.$tmpkey]).'">';
print '<input class="flat'.($searchclass ? ' '.$searchclass : '').'" size="4" type="text" name="'.$search_options_pattern.$tmpkey.'" value="'.dol_escape_htmltag((empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey])).'">';
} elseif (in_array($typeofextrafield, array('datetime', 'timestamp'))) {
$morecss = '';
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
} else {
// for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid')
$morecss = '';
if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) {
$morecss = 'maxwidth200';
}
echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1);
}
print '</td>';
}