mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Merge branch 'develop'
This commit is contained in:
commit
1956a16d1e
|
@ -156,6 +156,10 @@ class Consumable extends SnipeModel
|
|||
return $this->belongsToMany('\App\Models\User', 'consumables_users', 'consumable_id', 'assigned_to')->count();
|
||||
}
|
||||
|
||||
public function checkin_email()
|
||||
{
|
||||
return $this->category->checkin_email;
|
||||
}
|
||||
|
||||
public function requireAcceptance()
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ class License extends Depreciable
|
|||
|
||||
public function checkin_email()
|
||||
{
|
||||
return $this->model->category->checkin_email;
|
||||
return $this->category->checkin_email;
|
||||
}
|
||||
|
||||
public function requireAcceptance()
|
||||
|
|
|
@ -53,7 +53,7 @@ trait Searchable {
|
|||
* @param string $search The search term
|
||||
* @return array An array of search terms
|
||||
*/
|
||||
private function prepeareSearchTerms(string $search) {
|
||||
private function prepeareSearchTerms($search) {
|
||||
return explode(' OR ', $search);
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,8 @@ trait Searchable {
|
|||
|
||||
$table = $this->getTable();
|
||||
|
||||
$firstConditionAdded = false;
|
||||
|
||||
foreach($this->getSearchableAttributes() as $column) {
|
||||
|
||||
foreach($terms as $term) {
|
||||
|
@ -80,6 +82,19 @@ trait Searchable {
|
|||
continue;
|
||||
}
|
||||
|
||||
/**
|
||||
* We need to form the query properly, starting with a "where",
|
||||
* otherwise the generated select is wrong.
|
||||
*
|
||||
* @todo This does the job, but is inelegant and fragile
|
||||
*/
|
||||
if (!$firstConditionAdded) {
|
||||
$query = $query->where($table . '.' . $column, 'LIKE', '%'.$term.'%');
|
||||
|
||||
$firstConditionAdded = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = $query->orWhere($table . '.' . $column, 'LIKE', '%'.$term.'%');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue