Merge branch 'develop'

# Conflicts:
#	config/version.php
This commit is contained in:
snipe 2017-11-22 18:33:56 -08:00
commit 8c8352ecc6
17 changed files with 78 additions and 62 deletions

View file

@ -302,7 +302,7 @@ class AssetsController extends Controller
$asset->use_text = $asset->present()->fullName;
if ($asset->checkedOutToUser()) {
if (($asset->checkedOutToUser()) && ($asset->assigned)) {
$asset->use_text .= ' → '.$asset->assigned->getFullNameAttribute();
}

View file

@ -288,9 +288,6 @@ class LicensesController extends Controller
}
$assigned_to = $request->input('assigned_to');
$asset_id = $request->input('asset_id');
$this->authorize('checkout', $licenseSeat);
// Declare the rules for the form validation
@ -309,51 +306,33 @@ class LicensesController extends Controller
}
$target = null;
// If assigned to a user
if ($assigned_to!='') {
// Check if the user exists
if (is_null($target = User::find($assigned_to))) {
// Redirect to the asset management page with error
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.user_does_not_exist'));
}
}
// If assigned to an asset
if ($asset_id!='') {
if (is_null($target = Asset::find($asset_id))) {
// Redirect to the asset management page with error
// This item is checked out to a an asset
if (request('checkout_to_type')=='asset') {
if (is_null($target = Asset::find(request('asset_id')))) {
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.asset_does_not_exist'));
}
if (($request->has('assigned_to')) && ($request->has('asset_id'))) {
return redirect()->back()->withInput()->with('error', trans('admin/licenses/message.select_asset_or_person'));
}
}
if ($request->input('asset_id') == '') {
$licenseSeat->asset_id = null;
} else {
$licenseSeat->asset_id = $request->input('asset_id');
// Override asset's assigned user if available
if ($target->assigned_to!='') {
$licenseSeat->assigned_to = $target->assigned_to;
}
// Update the asset data
if ($request->input('assigned_to') == '') {
$licenseSeat->assigned_to = null;
} else {
$licenseSeat->assigned_to = $request->input('assigned_to');
// Fetch the target and set the license user
if (is_null($target = User::find(request('assigned_to')))) {
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.user_does_not_exist'));
}
$licenseSeat->assigned_to = request('assigned_to');
}
$licenseSeat->user_id = Auth::user()->id;
// Was the asset updated?
if ($licenseSeat->save()) {
$licenseSeat->logCheckout($request->input('note'), $target);
$data['license_id'] = $licenseSeat->license_id;
$data['note'] = $request->input('note');
// Redirect to the new asset page
return redirect()->route("licenses.index")->with('success', trans('admin/licenses/message.checkout.success'));
}

View file

@ -156,6 +156,7 @@ class ReportsController extends Controller
trans('admin/hardware/form.order'),
trans('general.supplier'),
trans('admin/hardware/table.checkoutto'),
trans('general.type'),
trans('admin/hardware/table.checkout_date'),
trans('admin/hardware/table.location'),
trans('general.notes'),
@ -166,6 +167,8 @@ class ReportsController extends Controller
fputcsv($handle, $headers);
foreach ($assets as $asset) {
// Add a new row with data
$values=[
($asset->company) ? $asset->company->name : '',
@ -175,12 +178,13 @@ class ReportsController extends Controller
($asset->model->model_number) ? $asset->model->model_number : '',
($asset->name) ? $asset->name : '',
($asset->serial) ? $asset->serial : '',
($asset->assetstatus) ? e($asset->assetstatus->name) : '',
($asset->assetstatus) ? e($asset->present()->statusText) : '',
($asset->purchase_date) ? e($asset->purchase_date) : '',
($asset->purchase_cost > 0) ? Helper::formatCurrencyOutput($asset->purchase_cost) : '',
($asset->order_number) ? e($asset->order_number) : '',
($asset->supplier) ? e($asset->supplier->name) : '',
($asset->assignedTo) ? e($asset->assignedTo->present()->name()) : '',
($asset->checkedOutToUser()) ? e($asset->assigned->getFullNameAttribute()) : ($asset->assigned ? e($asset->assigned->display_name) : ''),
($asset->checkedOutToUser()) ? 'user' : e($asset->assignedType()),
($asset->last_checkout!='') ? e($asset->last_checkout) : '',
($asset->location) ? e($asset->location->name) : '',
($asset->notes) ? e($asset->notes) : '',

View file

@ -111,10 +111,23 @@ class AssetsTransformer
'checkout' => (bool) Gate::allows('checkout', Asset::class),
'checkin' => (bool) Gate::allows('checkin', Asset::class),
'clone' => Gate::allows('create', Asset::class) ? true : false,
'restore' => false,
'update' => (bool) Gate::allows('update', Asset::class),
'delete' => (bool) Gate::allows('delete', Asset::class),
];
if ($asset->deleted_at!='') {
$permissions_array['available_actions'] = [
'checkout' => true,
'checkin' => false,
'clone' => Gate::allows('create', Asset::class) ? true : false,
'restore' => Gate::allows('create', Asset::class) ? true : false,
'update' => false,
'delete' => false,
];
}
$array += $permissions_array;
return $array;
}

View file

@ -1,8 +1,8 @@
<?php
return array (
'app_version' => 'v4.1.6',
'full_app_version' => 'v4.1.6 - build 2940-g0910587',
'build_version' => '2940',
'app_version' => 'v4.1.6-pre',
'full_app_version' => 'v4.1.6-pre - build 2765-g1d6320a',
'build_version' => '2765',
'prerelease_version' => '',
'hash_version' => 'g0910587',
'full_hash' => 'v4.1.5-34-g0910587',

View file

@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Seeder;
use App\Models\CustomField;
use App\Models\CustomFieldset;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
@ -21,6 +22,8 @@ class CustomFieldSeeder extends Seeder
}
}
CustomField::truncate();
CustomFieldset::truncate();
DB::table('custom_field_custom_fieldset')->truncate();
factory(CustomField::class, 4)->create();
}

View file

@ -33,6 +33,10 @@ class DatabaseSeeder extends Seeder
$this->call(ActionlogSeeder::class);
$this->call(CustomFieldSeeder::class);
Artisan::call('snipeit:sync-asset-locations', ['--output' => 'all']);
$output = Artisan::output();
\Log::info($output);
Model::reguard();
}
}

View file

@ -8,7 +8,7 @@
"/css/app.css.map": "/css/app.css.map?id=bdbe05e6ecd70ccfac72",
"/css/overrides.css.map": "/css/overrides.css.map?id=898c91d4a425b01b589b",
"/css/dist/all.css": "/css/dist/all.css?id=7c3842d2639193ac7e88",
"/js/dist/all.js": "/js/dist/all.js?id=c25f257f81287cafe6a3",
"/js/dist/all.js": "/js/dist/all.js?id=7e993fb3b457ccc72b3f",
"/css/build/all.css": "/css/build/all.css?id=7c3842d2639193ac7e88",
"/js/build/all.js": "/js/build/all.js?id=c25f257f81287cafe6a3"
"/js/build/all.js": "/js/build/all.js?id=7e993fb3b457ccc72b3f"
}

View file

@ -42,7 +42,7 @@
<div class="box-body">
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/asset_maintenances/table.asset_name'), 'fieldname' => 'asset_id'])
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id'])
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'supplier_id', 'required' => 'true'])
@include ('partials.forms.edit.maintenance_type')
<!-- Title -->

View file

@ -44,7 +44,7 @@
{!! $errors->first('name', '<span class="alert-msg"><i class="fa fa-times"></i> :message</span>') !!}
</div>
</div>
@include ('partials.forms.checkout-selector')
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_user', 'required'=>'true'])
@if ($asset->requireAcceptance())

View file

@ -47,13 +47,13 @@
@include ('partials.forms.edit.status')
@if (!$item->id)
@include ('partials.forms.checkout-selector', ['style' => 'display:none;'])
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'true', 'style' => 'display:none;'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_user', 'style' => 'display:none;'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_user', 'style' => 'display:none;', 'required' => 'false'])
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;'])
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_asset', 'style' => 'display:none;', 'required' => 'false'])
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_location', 'style' => 'display:none;'])
@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_location', 'style' => 'display:none;', 'required' => 'false'])
@endif
@include ('partials.forms.edit.serial', ['translated_serial' => trans('admin/hardware/form.serial')])
@ -146,6 +146,7 @@
if (data == true) {
$("#assignto_selector").show();
$("#assigned_user").show();
$("#selected_status_status").removeClass('text-danger');
$("#selected_status_status").addClass('text-success');

View file

@ -41,13 +41,11 @@
</div>
</div>
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/licenses/form.asset'), 'fieldname' => 'asset_id'])
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true', 'location_select' => 'false'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/hardware/form.checkout_to'), 'fieldname' => 'assigned_to'])
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.user'), 'fieldname' => 'assigned_to', 'required'=>'true'])
<p class="col-md-offset-3 help-block">
{{ trans('admin/licenses/form.checkout_help') }}
</p>
@include ('partials.forms.edit.asset-select', ['translated_name' => trans('admin/licenses/form.asset'), 'fieldname' => 'asset_id', 'style' => 'display:none;'])
<!-- Note -->

View file

@ -276,6 +276,14 @@
}
// This just prints out the item type in the activity report
function itemTypeFormatter(value, row) {
if ((row) && (row.item) && (row.item.type)) {
return row.item.type;
}
}
function genericCheckinCheckoutFormatter(destination) {
return function (value,row) {
@ -440,7 +448,7 @@
}
function assetCompanyObjFilterFormatter(value, row) {
if (row.company) {
if ((row) && (row.company)) {
return '<a href="{{ url('/') }}/hardware/?company_id=' + row.company.id + '"> ' + row.company.name + '</a>';
}
}
@ -455,7 +463,7 @@
function employeeNumFormatter(value, row) {
if ((row.assigned_to) && ((row.assigned_to.employee_number))) {
if ((row) && (row.assigned_to) && ((row.assigned_to.employee_number))) {
return '<a href="{{ url('/') }}/users/' + row.assigned_to.id + '"> ' + row.assigned_to.employee_number + '</a>';
}
}

View file

@ -2,15 +2,21 @@
{{ Form::label('name', trans('admin/hardware/form.checkout_to'), array('class' => 'col-md-3 control-label')) }}
<div class="col-md-8">
<div class="btn-group" data-toggle="buttons">
@if ((isset($user_select)) && ($user_select!='false'))
<label class="btn btn-default active">
<input name="checkout_to_type" value="user" type="radio" selected><i class="fa fa-user"></i> {{ trans('general.user') }}
</label>
@endif
@if ((isset($asset_select)) && ($asset_select!='false'))
<label class="btn btn-default">
<input name="checkout_to_type" value="asset" type="radio"><i class="fa fa-barcode"></i> {{ trans('general.asset') }}
</label>
@endif
@if ((isset($location_select)) && ($location_select!='false'))
<label class="btn btn-default">
<input name="checkout_to_type" value="location" class="active" type="radio"><i class="fa fa-map-marker"></i> {{ trans('general.location') }}
</label>
@endif
</div>
</div>
</div>

View file

@ -1,5 +1,5 @@
<!-- Asset -->
<div id="{{ $fieldname }}" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}"{!! (isset($style)) ? ' style="'.e($style).'"' : '' !!}>
<div id="assigned_asset" class="form-group{{ $errors->has($fieldname) ? ' has-error' : '' }}"{!! (isset($style)) ? ' style="'.e($style).'"' : '' !!}>
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7{{ ((isset($required) && ($required =='true'))) ? ' required' : '' }}">
<select class="js-data-ajax select2" data-endpoint="hardware" name="{{ $fieldname }}" style="width: 100%" id="assigned_asset_select"{{ (isset($multiple)) ? ' multiple="multiple"' : '' }}>

View file

@ -2,7 +2,7 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
<div class="col-md-7 required">
<div class="col-md-7{{ ((isset($required)) && ($required=='true')) ? ' required' : '' }}">
<select class="js-data-ajax" data-endpoint="suppliers" name="{{ $fieldname }}" style="width: 100%" id="supplier_select">
@if ($supplier_id = Input::old($fieldname, (isset($item)) ? $item->{$fieldname} : ''))
<option value="{{ $supplier_id }}" selected="selected">

View file

@ -25,10 +25,10 @@
<thead>
<tr>
<th data-field="icon" style="width: 40px;" class="hidden-xs" data-formatter="iconFormatter"></th>
<th class="col-sm-3" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th class="col-sm-3" data-searchable="false" data-sortable="true" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th class="col-sm-2" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
<th class="col-sm-2" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-1" data-field="item.type">{{ trans('general.type') }}</th>
<th class="col-sm-1" data-field="type" data-formatter="itemTypeFormatter">{{ trans('general.type') }}</th>
<th class="col-sm-3" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th class="col-sm-2" data-field="target" data-formatter="polymorphicItemFormatter">To</th>
<th class="col-sm-1" data-field="note">{{ trans('general.notes') }}</th>