mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-26 05:01:06 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
c78dbfc21f
|
@ -624,7 +624,12 @@ class AssetsController extends Controller
|
|||
// Was the asset updated?
|
||||
if ($asset->save()) {
|
||||
|
||||
$checkout_at = e(Input::get('checkin_at'));
|
||||
if ($request->input('checkout_at')== Carbon::now()->format('Y-m-d')) {
|
||||
$checkout_at = Carbon::now();
|
||||
} else {
|
||||
$checkout_at = Carbon::now()->format('Y-m-d h:i:s');
|
||||
}
|
||||
//$checkout_at = e(Input::get('checkin_at'));
|
||||
$logaction = $asset->createLogRecord('checkin', $asset, $admin, $user, null, e(Input::get('note')), $checkout_at);
|
||||
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ class ComponentsController extends Controller
|
|||
|
||||
foreach ($component->assets as $component_assignment) {
|
||||
$rows[] = array(
|
||||
'name' => (string)link_to('/hardware/'.$component_assignment->id.'/view', e($component_assignment->name)),
|
||||
'name' => (string)link_to('/hardware/'.$component_assignment->id.'/view', e($component_assignment->showAssetName())),
|
||||
'qty' => e($component_assignment->pivot->assigned_qty),
|
||||
'created_at' => ($component_assignment->created_at->format('Y-m-d H:i:s')=='-0001-11-30 00:00:00') ? '' : $component_assignment->created_at->format('Y-m-d H:i:s'),
|
||||
);
|
||||
|
|
|
@ -147,6 +147,25 @@ class CustomFieldsController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detach a custom field from a fieldset.
|
||||
*
|
||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||
* @since [v3.0]
|
||||
* @return Redirect
|
||||
*/
|
||||
public function deleteFieldFromFieldset($field_id, $fieldset_id)
|
||||
{
|
||||
$field = CustomField::find($field_id);
|
||||
|
||||
if ($field->fieldset()->detach($fieldset_id)) {
|
||||
return redirect()->route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.delete.success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a custom field.
|
||||
*
|
||||
|
@ -158,6 +177,8 @@ class CustomFieldsController extends Controller
|
|||
{
|
||||
$field=CustomField::find($field_id);
|
||||
|
||||
|
||||
|
||||
if ($field->fieldset->count()>0) {
|
||||
return redirect()->back()->withErrors(['message' => "Field is in-use"]);
|
||||
} else {
|
||||
|
|
|
@ -33,6 +33,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
|||
use URL;
|
||||
use View;
|
||||
use Illuminate\Http\Request;
|
||||
use Gate;
|
||||
|
||||
/**
|
||||
* This controller handles all actions related to Users for
|
||||
|
@ -853,7 +854,7 @@ class UsersController extends Controller
|
|||
* @see UsersController::getIndex() method that consumed this JSON response
|
||||
* @return string JSON
|
||||
*/
|
||||
public function getDatatable($status = null)
|
||||
public function getDatatable(Request $request, $status = null)
|
||||
{
|
||||
|
||||
if (Input::has('offset')) {
|
||||
|
@ -922,24 +923,30 @@ class UsersController extends Controller
|
|||
$group_names .= '<a href="' . config('app.url') . '/admin/groups/' . $group->id . '/edit" class="label label-default">' . $group->name . '</a> ';
|
||||
}
|
||||
|
||||
if (Gate::allows('users:edit')) {
|
||||
if (!is_null($user->deleted_at)) {
|
||||
|
||||
if (!is_null($user->deleted_at)) {
|
||||
|
||||
$actions .= '<a href="' . route('restore/user', $user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
|
||||
} else {
|
||||
|
||||
if ($user->accountStatus() == 'suspended') {
|
||||
$actions .= '<a href="' . route('unsuspend/user', $user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
|
||||
}
|
||||
|
||||
$actions .= '<a href="' . route('update/user', $user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
|
||||
$actions .= '<a href="' . route('clone/user', $user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
|
||||
|
||||
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user', $user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
$actions .= '<a href="' . route('restore/user',
|
||||
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-share icon-white"></i></a> ';
|
||||
} else {
|
||||
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
|
||||
if ($user->accountStatus() == 'suspended') {
|
||||
$actions .= '<a href="' . route('unsuspend/user',
|
||||
$user->id) . '" class="btn btn-default btn-sm"><span class="fa fa-clock-o"></span></a> ';
|
||||
}
|
||||
|
||||
$actions .= '<a href="' . route('update/user',
|
||||
$user->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
|
||||
|
||||
$actions .= '<a href="' . route('clone/user',
|
||||
$user->id) . '" class="btn btn-info btn-sm"><i class="fa fa-clone"></i></a>';
|
||||
|
||||
if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords'))) {
|
||||
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/user',
|
||||
$user->id) . '" data-content="Are you sure you wish to delete this user?" data-title="Delete ' . htmlspecialchars($user->first_name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
|
||||
} else {
|
||||
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$actions .= '</nobr>';
|
||||
|
|
|
@ -638,27 +638,28 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
|
|||
Route::get('custom_fields/create-field', ['uses' =>'CustomFieldsController@createField','as' => 'admin.custom_fields.create-field']);
|
||||
Route::post('custom_fields/create-field', ['uses' => 'CustomFieldsController@storeField','as' => 'admin.custom_fields.store-field']);
|
||||
Route::post('custom_fields/{id}/associate', ['uses' => 'CustomFieldsController@associate','as' => 'admin.custom_fields.associate']);
|
||||
Route::get('custom_fields/{field_id}/{fieldset_id}/disassociate', ['uses' => 'CustomFieldsController@deleteFieldFromFieldset','as' => 'admin.custom_fields.disassociate']);
|
||||
Route::match(['DELETE'], 'custom_fields/delete-field/{id}', ['uses' => 'CustomFieldsController@deleteField','as' => 'admin.custom_fields.delete-field']);
|
||||
Route::resource('custom_fields', 'CustomFieldsController');
|
||||
|
||||
# User Management
|
||||
Route::group([ 'prefix' => 'users', 'middleware' => ['web','auth','authorize:users.view']], function () {
|
||||
|
||||
Route::get('ldap', ['as' => 'ldap/user', 'uses' => 'UsersController@getLDAP' ]);
|
||||
Route::get('ldap', ['as' => 'ldap/user', 'uses' => 'UsersController@getLDAP', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('ldap', 'UsersController@postLDAP');
|
||||
|
||||
Route::get('create', [ 'as' => 'create/user', 'uses' => 'UsersController@getCreate' ]);
|
||||
Route::post('create', 'UsersController@postCreate');
|
||||
Route::get('import', [ 'as' => 'import/user', 'uses' => 'UsersController@getImport' ]);
|
||||
Route::post('import', 'UsersController@postImport');
|
||||
Route::get('{userId}/edit', [ 'as' => 'update/user', 'uses' => 'UsersController@getEdit' ]);
|
||||
Route::post('{userId}/edit', 'UsersController@postEdit');
|
||||
Route::get('{userId}/clone', [ 'as' => 'clone/user', 'uses' => 'UsersController@getClone' ]);
|
||||
Route::post('{userId}/clone', 'UsersController@postCreate');
|
||||
Route::get('{userId}/delete', [ 'as' => 'delete/user', 'uses' => 'UsersController@getDelete' ]);
|
||||
Route::get('{userId}/restore', [ 'as' => 'restore/user', 'uses' => 'UsersController@getRestore' ]);
|
||||
Route::get('{userId}/view', [ 'as' => 'view/user', 'uses' => 'UsersController@getView' ]);
|
||||
Route::get('{userId}/unsuspend', [ 'as' => 'unsuspend/user', 'uses' => 'UsersController@getUnsuspend' ]);
|
||||
Route::get('create', [ 'as' => 'create/user', 'uses' => 'UsersController@getCreate', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('create', [ 'uses' => 'UsersController@postCreate', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('import', [ 'as' => 'import/user', 'uses' => 'UsersController@getImport', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('import', [ 'uses' => 'UsersController@postImport', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('{userId}/edit', [ 'as' => 'update/user', 'uses' => 'UsersController@getEdit', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('{userId}/edit', [ 'uses' => 'UsersController@postEdit', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('{userId}/clone', [ 'as' => 'clone/user', 'uses' => 'UsersController@getClone', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::post('{userId}/clone', [ 'uses' => 'UsersController@postCreate', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('{userId}/delete', [ 'as' => 'delete/user', 'uses' => 'UsersController@getDelete', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('{userId}/restore', [ 'as' => 'restore/user', 'uses' => 'UsersController@getRestore', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get('{userId}/view', [ 'as' => 'view/user', 'uses' => 'UsersController@getView' , 'middleware' => ['authorize:users.view'] ]);
|
||||
Route::get('{userId}/unsuspend', [ 'as' => 'unsuspend/user', 'uses' => 'UsersController@getUnsuspend', 'middleware' => ['authorize:users.edit'] ]);
|
||||
Route::get(
|
||||
'{userId}/deletefile/{fileId}',
|
||||
[ 'as' => 'delete/userfile', 'uses' => 'UsersController@getDeleteFile' ]
|
||||
|
@ -672,14 +673,16 @@ Route::group([ 'prefix' => 'admin','middleware' => ['web','auth']], function ()
|
|||
'bulkedit',
|
||||
[
|
||||
'as' => 'users/bulkedit',
|
||||
'uses' => 'UsersController@postBulkEdit'
|
||||
'uses' => 'UsersController@postBulkEdit',
|
||||
'middleware' => ['authorize:users.edit'],
|
||||
]
|
||||
);
|
||||
Route::post(
|
||||
'bulksave',
|
||||
[
|
||||
'as' => 'users/bulksave',
|
||||
'uses' => 'UsersController@postBulkSave'
|
||||
'uses' => 'UsersController@postBulkSave',
|
||||
'middleware' => ['authorize:users.edit'],
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
@ -376,7 +376,7 @@ class Asset extends Depreciable
|
|||
{
|
||||
|
||||
if ($this->name == '') {
|
||||
return $this->model->name;
|
||||
return $this->model->name.' ('.$this->asset_tag.')';
|
||||
} else {
|
||||
return $this->name;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
return array (
|
||||
'app_version' => 'v3.0',
|
||||
'hash_version' => 'v3.0-55-g3fd5fb8',
|
||||
'hash_version' => 'v3.0-62-g0ee5dea',
|
||||
);
|
|
@ -6,6 +6,11 @@
|
|||
@parent
|
||||
@stop
|
||||
|
||||
@section('header_right')
|
||||
<a href="{{ route('admin.custom_fields.index') }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
|
||||
|
||||
@section('content')
|
||||
|
@ -32,10 +37,11 @@
|
|||
<tr>
|
||||
<th class="col-md-1"></th>
|
||||
<th class="col-md-1">{{ trans('admin/custom_fields/general.order') }}</th>
|
||||
<th class="col-md-5">{{ trans('admin/custom_fields/general.field_name') }}</th>
|
||||
<th class="col-md-4">{{ trans('admin/custom_fields/general.field_name') }}</th>
|
||||
<th class="col-md-2">{{ trans('admin/custom_fields/general.field_format') }}</th>
|
||||
<th class="col-md-2">{{ trans('admin/custom_fields/general.field_element') }}</th>
|
||||
<th class="col-md-1">{{ trans('admin/custom_fields/general.required') }}</th>
|
||||
<th class="col-md-1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
|
@ -66,6 +72,7 @@
|
|||
<td>{{$field->format}}</td>
|
||||
<td>{{$field->element}}</td>
|
||||
<td>{{$field->pivot->required ? "REQUIRED" : "OPTIONAL"}}</td>
|
||||
<td><a href="{{ route('admin.custom_fields.disassociate', [$field,$custom_fieldset->id]) }}" class="btn btn-sm btn-danger">Remove</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
@section('header_right')
|
||||
<a href="{{ URL::previous() }}" class="btn btn-primary pull-right">
|
||||
{{ trans('general.back') }}</a>
|
||||
{{ trans('general.back') }}</a>
|
||||
@stop
|
||||
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@
|
|||
<tr><td>
|
||||
{{ trans('admin/licenses/form.notes') }}:
|
||||
</td><td>
|
||||
{{ nl2br(e($license->notes)) }}</td></tr>
|
||||
{!! nl2br(e($license->notes)) !!}</td></tr>
|
||||
@endif
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
<li><a href="#files_tab" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-paperclip"></i></span> <span class="hidden-xs hidden-sm">{{ trans('general.file_uploads') }}</span></a></li>
|
||||
<li><a href="#history_tab" data-toggle="tab"><span class="hidden-lg hidden-md"><i class="fa fa-clock-o"></i></span> <span class="hidden-xs hidden-sm">{{ trans('general.history') }}</span></a></li>
|
||||
|
||||
@can('users.edit')
|
||||
<li class="dropdown pull-right">
|
||||
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="fa fa-gear"></i> {{ trans('button.actions') }}
|
||||
<span class="caret"></span>
|
||||
|
@ -36,6 +38,7 @@
|
|||
@endif
|
||||
</ul>
|
||||
</li>
|
||||
@endcan
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="info_tab">
|
||||
|
@ -44,7 +47,10 @@
|
|||
<div class="col-md-12">
|
||||
<div class="callout callout-warning">
|
||||
<i class="icon fa fa-warning"></i>
|
||||
This user has been marked as deleted. <a href="{{ route('restore/user', $user->id) }}">Click here</a> to restore them.
|
||||
This user has been marked as deleted.
|
||||
@can('users.edit')
|
||||
<a href="{{ route('restore/user', $user->id) }}">Click here</a> to restore them.
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
@ -126,13 +132,16 @@
|
|||
|
||||
<!-- Start button column -->
|
||||
<div class="col-md-2">
|
||||
@can('users.edit')
|
||||
<div class="col-md-12">
|
||||
|
||||
<a href="{{ route('update/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default">{{ trans('admin/users/general.edit') }}</a>
|
||||
</div>
|
||||
<div class="col-md-12" style="padding-top: 5px;">
|
||||
<a href="{{ route('clone/user', $user->id) }}" style="width: 100%;" class="btn btn-sm btn-default">{{ trans('admin/users/general.clone') }}</a>
|
||||
</div>
|
||||
|
||||
|
||||
@if ((Auth::user()->id !== $user->id) && (!config('app.lock_passwords')))
|
||||
|
||||
@if ($user->deleted_at=='')
|
||||
|
@ -154,7 +163,7 @@
|
|||
@endif
|
||||
|
||||
@endif
|
||||
|
||||
@endcan
|
||||
</div>
|
||||
<!-- End button column -->
|
||||
|
||||
|
@ -182,10 +191,18 @@
|
|||
@if ($asset->physical=='1') {{ $asset->model->name }}
|
||||
@endif
|
||||
</td>
|
||||
<td><a href="{{ route('view/hardware', $asset->id) }}">{{ $asset->asset_tag }}</a></td>
|
||||
<td>
|
||||
@can('assets.view')
|
||||
<a href="{{ route('view/hardware', $asset->id) }}">{{ $asset->asset_tag }}</a>
|
||||
@endcan
|
||||
</td>
|
||||
<td><a href="{{ route('view/hardware', $asset->id) }}">{{ $asset->name }}</a></td>
|
||||
|
||||
<td class="hidden-print"> <a href="{{ route('checkin/hardware', array('assetId'=> $asset->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a></td>
|
||||
<td class="hidden-print">
|
||||
@can('assets.edit')
|
||||
<a href="{{ route('checkin/hardware', array('assetId'=> $asset->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
@ -205,9 +222,15 @@
|
|||
<tbody>
|
||||
@foreach ($user->licenses as $license)
|
||||
<tr>
|
||||
<td><a href="{{ route('view/license', $license->id) }}">{{ $license->name }}</a></td>
|
||||
<td>
|
||||
<a href="{{ route('view/license', $license->id) }}">{{ $license->name }}</a>
|
||||
|
||||
</td>
|
||||
<td><a href="{{ route('view/license', $license->id) }}">{{ mb_strimwidth($license->serial, 0, 50, "...") }}</a></td>
|
||||
<td class="hidden-print"> <a href="{{ route('checkin/license', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
|
||||
<td class="hidden-print">
|
||||
@can('licenses.edit')
|
||||
<a href="{{ route('checkin/license', array('licenseseat_id'=> $license->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
@ -228,7 +251,10 @@
|
|||
@foreach ($user->accessories as $accessory)
|
||||
<tr>
|
||||
<td><a href="{{ route('view/accessory', $accessory->id) }}">{{ $accessory->name }}</a></td>
|
||||
<td class="hidden-print"> <a href="{{ route('checkin/accessory', array('accessory_id'=> $accessory->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
|
||||
<td class="hidden-print">
|
||||
@can('accessories.edit')
|
||||
<a href="{{ route('checkin/accessory', array('accessory_id'=> $accessory->pivot->id, 'backto'=>'user')) }}" class="btn btn-primary btn-sm">Checkin</a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
@ -264,13 +290,15 @@
|
|||
</div>
|
||||
<div class="col-md-2">
|
||||
<!-- The fileinput-button span is used to style the file input field as button -->
|
||||
<span class="btn btn-info fileinput-button">
|
||||
@can('users.edit')
|
||||
<span class="btn btn-info fileinput-button">
|
||||
<i class="fa fa-plus icon-white"></i>
|
||||
<span>Select File...</span>
|
||||
<!-- The file input field used as target for the file upload widget -->
|
||||
<input id="fileupload" type="file" name="file[]" data-url="{{ config('app.url') }}/api/users/{{ $user->id }}/upload">
|
||||
|
||||
</span>
|
||||
@endcan
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
|
@ -325,7 +353,9 @@
|
|||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@can('users.edit')
|
||||
<a class="btn delete-asset btn-danger btn-sm" href="{{ route('delete/userfile', [$user->id, $file->id]) }}" data-content="Are you sure you wish to delete this file?" data-title="Delete {{ $file->filename }}?"><i class="fa fa-trash icon-white"></i></a>
|
||||
@endcan
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
|
Loading…
Reference in a new issue