Merge pull request #18188 from frederic34/patch-11

fix php8 warnings
This commit is contained in:
Laurent Destailleur 2021-08-01 23:42:17 +02:00 committed by GitHub
commit d8a9a0cfb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6975,7 +6975,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];
} }
@ -6984,6 +6985,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();
@ -6992,10 +6994,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)) {
@ -7005,14 +7008,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))
{ {