Added option to search in internal part number (enabled by default)

This should fix issue #232
This commit is contained in:
Jan Böhmer 2023-03-04 22:53:36 +01:00
parent 0efb32c891
commit 222e76ce47
3 changed files with 25 additions and 3 deletions

View file

@ -65,6 +65,9 @@ class PartSearchFilter implements FilterInterface
/** @var bool Use footprint name for searching */
protected bool $footprint = false;
/** @var bool Use Internal Part number for searching */
protected bool $ipn = true;
public function __construct(string $query)
{
$this->keyword = $query;
@ -104,6 +107,9 @@ class PartSearchFilter implements FilterInterface
if($this->footprint) {
$fields_to_search[] = 'footprint.name';
}
if ($this->ipn) {
$fields_to_search[] = 'part.ipn';
}
return $fields_to_search;
}
@ -301,6 +307,17 @@ class PartSearchFilter implements FilterInterface
return $this;
}
public function isIPN(): bool
{
return $this->ipn;
}
public function setIPN(bool $ipn): PartSearchFilter
{
$this->ipn = $ipn;
return $this;
}
/**
* @return bool
*/