Filter/Fixup

* only criteria should be affected by the match any/none selector
 * multi-selects are never null and shouldn't be tested as such.
This commit is contained in:
Sarjuuk 2026-01-13 21:38:53 +01:00
parent a5129b46b2
commit b4f40b4264
3 changed files with 15 additions and 8 deletions

View file

@ -229,14 +229,21 @@ abstract class Filter
$this->cndSet = $this->createSQLForValues();
// criteria
$filters = [];
foreach ($this->criteriaIterator() as $_cr)
if ($cnd = $this->createSQLForCriterium(...$_cr))
$this->cndSet[] = $cnd;
$filters[] = $cnd;
if ($this->cndSet) // Note: TYPE_SOUND does not use 'match any'
array_unshift($this->cndSet, empty($this->values['ma']) ? 'AND' : 'OR');
if ($filters) // if a filter uses criteria it must have a [ma]tch selector
{
$filters[] = empty($this->values['ma']) ? 'AND' : 'OR';
$this->cndSet[] = $filters;
}
}
if ($this->cndSet)
array_unshift($this->cndSet, 'AND');
return $this->cndSet;
}

View file

@ -2130,14 +2130,14 @@ class ItemListFilter extends Filter
}
// quality [list]
if ($_v['qu'] !== null)
if ($_v['qu'])
$parts[] = ['quality', $_v['qu']];
// type
if ($_v['ty'] !== null)
// type [list]
if ($_v['ty'])
$parts[] = ['subclass', $_v['ty']];
// slot
// slot [list]
if ($_v['sl'])
$parts[] = ['slot', $_v['sl']];

View file

@ -549,7 +549,7 @@ class QuestListFilter extends Filter
}
// questInfoId [list]
if ($_v['ty'] !== null)
if ($_v['ty'])
$parts[] = ['questInfoId', $_v['ty']];
return $parts;