fix php8 warnings

This commit is contained in:
Frédéric FRANCE 2021-07-20 20:54:27 +02:00 committed by GitHub
parent c0d54fe608
commit 71b95f3511
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4464,7 +4464,7 @@ class Form
$sql .= " WHERE 1=1"; $sql .= " WHERE 1=1";
if ($status != 2) { if ($status != 2) {
$sql .= " AND status = ".(int) $status; $sql .= " AND status = ".(int) $status;
} }isset($objecttmp->ismultientitymanaged) &&
if ($filtre) { if ($filtre) {
$sql .= " AND ".$filtre; $sql .= " AND ".$filtre;
} }
@ -6974,7 +6974,8 @@ class Form
// Search data // Search data
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t"; $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { if (isset($objecttmp->ismultientitymanaged)) {
if (!is_numeric($objecttmp->ismultientitymanaged)) {
$tmparray = explode('@', $objecttmp->ismultientitymanaged); $tmparray = explode('@', $objecttmp->ismultientitymanaged);
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0]; $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
} }
@ -6983,6 +6984,7 @@ class Form
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
} }
}
// Add where from hooks // Add where from hooks
$parameters = array(); $parameters = array();
@ -6991,10 +6993,11 @@ class Form
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
} else { } else {
$sql .= " WHERE 1=1"; $sql .= " WHERE 1=1";
if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) { if (isset($objecttmp->ismultientitymanaged)) {
if ($objecttmp->ismultientitymanaged == 1) {
$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
} }
if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) { if (!is_numeric($objecttmp->ismultientitymanaged)) {
$sql .= ' AND parenttable.entity = t.'.$tmparray[0]; $sql .= ' AND parenttable.entity = t.'.$tmparray[0];
} }
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
@ -7004,14 +7007,15 @@ class Form
$sql .= " AND t.fk_soc = ".$user->socid; $sql .= " AND t.fk_soc = ".$user->socid;
} }
} }
if ($searchkey != '') {
$sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
}
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') { if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) { if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
} }
} }
}
if ($searchkey != '') {
$sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
}
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
/*if (! DolibarrApi::_checkFilters($objecttmp->filter)) /*if (! DolibarrApi::_checkFilters($objecttmp->filter))
{ {