mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Fix advanced search with serial and another field
The advanced search in /hardware produces incorrect results if the serial is combined with another field like category. There is a typo as the fieldname 'product_key' doesn't exist. Change this to 'serial'. Also change the last If-Statement from ->orWhere() to ->where(). Now additional fields like custom fields can be combined with other searches in an And-Clause. I think this function could be simplified further, but this is the minimal bugfix.
This commit is contained in:
parent
cdc4940338
commit
eced1ab77f
|
@ -1314,7 +1314,7 @@ class Asset extends Depreciable
|
|||
$query->where('assets.name', 'LIKE', '%'.$search_val.'%');
|
||||
}
|
||||
|
||||
if ($fieldname =='product_key') {
|
||||
if ($fieldname =='serial') {
|
||||
$query->where('assets.serial', 'LIKE', '%'.$search_val.'%');
|
||||
}
|
||||
|
||||
|
@ -1436,7 +1436,7 @@ class Asset extends Depreciable
|
|||
*/
|
||||
if (($fieldname!='category') && ($fieldname!='model_number') && ($fieldname!='rtd_location') && ($fieldname!='location') && ($fieldname!='supplier')
|
||||
&& ($fieldname!='status_label') && ($fieldname!='model') && ($fieldname!='company') && ($fieldname!='manufacturer')) {
|
||||
$query->orWhere('assets.'.$fieldname, 'LIKE', '%' . $search_val . '%');
|
||||
$query->where('assets.'.$fieldname, 'LIKE', '%' . $search_val . '%');
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue