[FIX] sellist / chkboxlist extrafields error when table is _extrafields

This patch fixes error when an sellist /chkboxlist extrafield directly use an *_extrafields table (as main table)
This commit is contained in:
jyhere 2023-02-03 13:11:17 +01:00 committed by GitHub
parent af61006b8b
commit 201a94b550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1233,7 +1233,7 @@ class ExtraFields
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
}
//We have to join on extrafield table
if (strpos($InfoFieldList[4], 'extra') !== false) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
} else {
@ -1690,7 +1690,7 @@ class ExtraFields
$sql = "SELECT ".$keyList;
$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra') !== false) {
if (!empty($InfoFieldList[4]) && strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main';
}
if ($selectkey == 'rowid' && empty($value)) {
@ -1806,7 +1806,7 @@ class ExtraFields
$sql = "SELECT ".$keyList;
$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
if (strpos($InfoFieldList[4], 'extra') !== false) {
if (strpos($InfoFieldList[4], 'extra.') !== false) {
$sql .= ' as main';
}
// $sql.= " WHERE ".$selectkey."='".$this->db->escape($value)."'";