Fix error on html.for.class on ismultientitymanaged test
Conflicts: htdocs/core/class/html.form.class.php
This commit is contained in:
parent
46e8f1bebf
commit
20e8dd4c54
@ -6769,13 +6769,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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6786,17 +6788,24 @@ 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 = ".((int) $user->socid);
|
||||
} else {
|
||||
$sql .= " AND t.fk_soc = ".((int) $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 = ".((int) $user->socid);
|
||||
} else {
|
||||
$sql .= " AND t.fk_soc = ".((int) $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 = ".((int) $user->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($searchkey != '') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user