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";
if ($status != 2) {
$sql .= " AND status = ".(int) $status;
}
}isset($objecttmp->ismultientitymanaged) &&
if ($filtre) {
$sql .= " AND ".$filtre;
}
@ -6974,13 +6974,15 @@ class Form
// Search data
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
}
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (isset($objecttmp->ismultientitymanaged)) {
if (!is_numeric($objecttmp->ismultientitymanaged)) {
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
}
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
}
}
@ -6991,27 +6993,29 @@ class Form
$sql .= $hookmanager->resPrint;
} else {
$sql .= " WHERE 1=1";
if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) {
$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
}
if (isset($objecttmp->ismultientitymanaged) && !is_numeric($objecttmp->ismultientitymanaged)) {
$sql .= ' AND parenttable.entity = t.'.$tmparray[0];
}
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
if ($objecttmp->element == 'societe') {
$sql .= " AND t.rowid = ".$user->socid;
} else {
$sql .= " AND t.fk_soc = ".$user->socid;
if (isset($objecttmp->ismultientitymanaged)) {
if ($objecttmp->ismultientitymanaged == 1) {
$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
}
if (!is_numeric($objecttmp->ismultientitymanaged)) {
$sql .= ' AND parenttable.entity = t.'.$tmparray[0];
}
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
if ($objecttmp->element == 'societe') {
$sql .= " AND t.rowid = ".$user->socid;
} else {
$sql .= " AND t.fk_soc = ".$user->socid;
}
}
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
}
}
if ($searchkey != '') {
$sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
}
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
}
}
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
/*if (! DolibarrApi::_checkFilters($objecttmp->filter))
{