Fix undef vars 4

To remove PHP8 warnings
This commit is contained in:
GurvanKervern 2021-08-25 18:15:32 +08:00
parent d34e44e55c
commit 628bfc9963

View File

@ -390,7 +390,7 @@ foreach ($search as $key => $val) {
}
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
$mode_search = ((!empty($object->fields[$key]) && $object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ($search[$key] != '') {
$sql .= natural_search($key, $search[$key], $mode_search);
}
@ -897,7 +897,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object