mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Fixed custom fields filter for advanced search
This commit is contained in:
parent
a054cec7c9
commit
f580e20bc3
|
@ -815,6 +815,7 @@ class Asset extends Depreciable
|
||||||
{
|
{
|
||||||
return $query->where(function ($query) use ($filter) {
|
return $query->where(function ($query) use ($filter) {
|
||||||
foreach ($filter as $key => $search_val) {
|
foreach ($filter as $key => $search_val) {
|
||||||
|
|
||||||
if ($key =='asset_tag') {
|
if ($key =='asset_tag') {
|
||||||
$query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%');
|
$query->where('assets.asset_tag', 'LIKE', '%'.$search_val.'%');
|
||||||
}
|
}
|
||||||
|
@ -914,11 +915,13 @@ class Asset extends Depreciable
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (CustomField::all() as $field) {
|
foreach (CustomField::all() as $field) {
|
||||||
if (array_key_exists($field->db_column_name(), $filter)) {
|
if (array_key_exists('custom_fields.'.$field->db_column_name(), $filter)) {
|
||||||
$query->orWhere($field->db_column_name(), 'LIKE', "%$search_val%");
|
$query->orWhere($field->db_column_name(), 'LIKE', '%' . $search_val . '%');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue