Merge branch 'v3' of github.com:snipe/snipe-it into v3

This commit is contained in:
snipe 2016-06-28 12:19:19 -07:00
commit 483bf1b309
4 changed files with 22 additions and 2 deletions

View file

@ -1425,6 +1425,7 @@ class AssetsController extends Controller
'asset_tag',
'serial',
'model',
'model_number',
'last_checkout',
'category',
'manufacturer',
@ -1452,6 +1453,9 @@ class AssetsController extends Controller
case 'model':
$assets = $assets->OrderModels($order);
break;
case 'model_number':
$assets = $assets->OrderModelNumber($order);
break;
case 'category':
$assets = $assets->OrderCategory($order);
break;
@ -1507,6 +1511,7 @@ class AssetsController extends Controller
'asset_tag' => '<a title="'.e($asset->asset_tag).'" href="hardware/'.$asset->id.'/view">'.e($asset->asset_tag).'</a>',
'serial' => e($asset->serial),
'model' => ($asset->model) ? (string)link_to('/hardware/models/'.$asset->model->id.'/view', e($asset->model->name)) : 'No model',
'model_number' => ($asset->model && $asset->model->modelno) ? (string)$asset->model->modelno : '',
'status_label' => ($asset->assigneduser) ? 'Deployed' : ((e($asset->assetstatus)) ? e($asset->assetstatus->name) : ''),
'assigned_to' => ($asset->assigneduser) ? (string)link_to(config('app.url').'/admin/users/'.$asset->assigned_to.'/view', e($asset->assigneduser->fullName())) : '',
'location' => (($asset->assigneduser) && ($asset->assigneduser->userloc!='')) ? (string)link_to('admin/settings/locations/'.$asset->assigneduser->userloc->id.'/edit', e($asset->assigneduser->userloc->name)) : (($asset->defaultLoc!='') ? (string)link_to('admin/settings/locations/'.$asset->defaultLoc->id.'/edit', e($asset->defaultLoc->name)) : ''),

View file

@ -736,7 +736,8 @@ class Asset extends Depreciable
$query->whereHas('category', function ($query) use ($search) {
$query->where(function ($query) use ($search) {
$query->where('categories.name', 'LIKE', '%'.$search.'%')
->orWhere('models.name', 'LIKE', '%'.$search.'%');
->orWhere('models.name', 'LIKE', '%'.$search.'%')
->orWhere('models.modelno', 'LIKE', '%'.$search.'%');
});
});
})->orWhereHas('model', function ($query) use ($search) {
@ -794,6 +795,19 @@ class Asset extends Depreciable
return $query->join('models', 'assets.model_id', '=', 'models.id')->orderBy('models.name', $order);
}
/**
* Query builder scope to order on model number
*
* @param Illuminate\Database\Query\Builder $query Query builder instance
* @param text $order Order
*
* @return Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeOrderModelNumber($query, $order)
{
return $query->join('models', 'assets.model_id', '=', 'models.id')->orderBy('models.modelno', $order);
}
/**
* Query builder scope to order on assigned user

View file

@ -78,6 +78,7 @@
<th data-sortable="true" data-field="asset_tag">{{ trans('admin/hardware/table.asset_tag') }}</th>
<th data-sortable="true" data-field="serial">{{ trans('admin/hardware/table.serial') }}</th>
<th data-sortable="true" data-field="model">{{ trans('admin/hardware/form.model') }}</th>
<th data-sortable="true" data-field="model_number" data-visible="false">{{ trans('admin/models/table.modelnumber') }}</th>
<th data-sortable="true" data-field="status_label">{{ trans('admin/hardware/table.status') }}</th>
<th data-sortable="true" data-field="assigned_to">{{ trans('admin/hardware/form.checkedout_to') }}</th>
<th data-sortable="true" data-field="location" data-searchable="true">{{ trans('admin/hardware/table.location') }}</th>

View file

@ -31,7 +31,7 @@
<ul class="dropdown-menu">
<li><a href="{{ route('update/user', $user->id) }}">{{ trans('admin/users/general.edit') }}</a></li>
<li><a href="{{ route('clone/user', $user->id) }}">{{ trans('admin/users/general.clone') }}</a></li>
@if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords')))
@if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords')) && ($user->deleted_at==''))
<li><a href="{{ route('delete/user', $user->id) }}">{{ trans('button.delete') }}</a></li>
@endif
</ul>