mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 12:17:05 -08:00
Tidied up some debugging code, better explanation
This commit is contained in:
parent
7a0843e954
commit
41a20d8f66
|
@ -1099,6 +1099,7 @@ class AssetsController extends Controller
|
|||
|
||||
// A matching user was found
|
||||
if ($user = $user->first()) {
|
||||
$item[$asset_tag][$batch_counter]['checkedout_to'] = $user->id;
|
||||
|
||||
$status['success'][] = 'Found user '.Helper::array_smart_fetch($row, "name").$user_query;
|
||||
|
||||
|
@ -1110,7 +1111,7 @@ class AssetsController extends Controller
|
|||
'asset_id' => $asset->id,
|
||||
'asset_type' => 'hardware',
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Imported by '.Auth::user()->fullName().' from history importer',
|
||||
'note' => 'Checkout imported by '.Auth::user()->fullName().' from history importer',
|
||||
'checkedout_to' => $item[$asset_tag][$batch_counter]['user_id'],
|
||||
'created_at' => $item[$asset_tag][$batch_counter]['date'],
|
||||
'action_type' => 'checkout'
|
||||
|
@ -1126,6 +1127,7 @@ class AssetsController extends Controller
|
|||
|
||||
|
||||
} else {
|
||||
$item[$asset_tag][$batch_counter]['checkedout_to'] = null;
|
||||
$status['error'][] = 'No matching user for '.Helper::array_smart_fetch($row, "name");
|
||||
}
|
||||
|
||||
|
@ -1136,33 +1138,32 @@ class AssetsController extends Controller
|
|||
foreach ($item as $key => $asset_batch) {
|
||||
$batch_counter = 0;
|
||||
|
||||
echo '<pre>';
|
||||
print_r($asset_batch);
|
||||
echo '</pre>';
|
||||
|
||||
for($x = 0; $x < count($asset_batch); $x++) {
|
||||
|
||||
// Only do this if a matching user was found
|
||||
if ($asset_batch[$x]['checkedout_to']!='') {
|
||||
$batch_counter++;
|
||||
|
||||
if ((count($asset_batch) != 1) && ($batch_counter < count($asset_batch))) {
|
||||
$checkin_date = date('Y-m-d H:i:s',(strtotime($asset_batch[$x]['date']) - 10));
|
||||
Actionlog::firstOrCreate(array(
|
||||
'asset_id' => $asset_batch[$x]['asset_id'],
|
||||
'asset_type' => 'hardware',
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Imported by '.Auth::user()->fullName().' from history importer',
|
||||
'checkedout_to' => null,
|
||||
'created_at' => $checkin_date,
|
||||
'action_type' => 'checkin'
|
||||
)
|
||||
);
|
||||
if ((count($asset_batch) != 1) && ($batch_counter < count($asset_batch))) {
|
||||
|
||||
$checkin_date = date('Y-m-d H:i:s',(strtotime($asset_batch[$x]['date']) + 10));
|
||||
Actionlog::firstOrCreate(array(
|
||||
'asset_id' => $asset_batch[$x]['asset_id'],
|
||||
'asset_type' => 'hardware',
|
||||
'user_id' => Auth::user()->id,
|
||||
'note' => 'Checkin imported by '.Auth::user()->fullName().' from history importer',
|
||||
'checkedout_to' => null,
|
||||
'created_at' => $checkin_date,
|
||||
'action_type' => 'checkin'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return View::make('hardware/history')->with('status',$status);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
return array (
|
||||
'app_version' => 'v3.2.0',
|
||||
'hash_version' => 'v3.2.0-53-gfff2bce',
|
||||
'app_version' => '3.3.0-beta',
|
||||
'hash_version' => '3.3.0-beta-19-g7a0843e',
|
||||
);
|
||||
|
|
|
@ -31,36 +31,23 @@
|
|||
@endif
|
||||
|
||||
<p>
|
||||
Upload a CSV that contains asset history. The assets MUST already exist in the system, or they will be skipped. Matching assets for history import happens against the asset tag.
|
||||
Upload a CSV that contains asset history. The assets and users MUST already exist in the system, or they will be skipped. Matching assets for history import happens against the asset tag. We will try to find a matching user based on the user's name you provide, and the criteria you select below. If you do not select any criteria below, it will simply try to match on the username format you configured in the Admin < Settings.
|
||||
</p>
|
||||
|
||||
<p>Fields included in the CSV must match the headers: <strong>Date, Tag, Name, Action</strong>. Any additional fields will be ignored. </p>
|
||||
<p>Fields included in the CSV must match the headers: <strong>Date, Tag, Name</strong>. Any additional fields will be ignored. </p>
|
||||
|
||||
<p><strong>Date</strong> should be the checkin/checkout date. <strong>Tag</strong> should be the asset tag. <strong>Name</strong> should be the user's name (firstname lastname). <strong>Action</strong> should be either <strong>checkin</strong> or <strong>checkout</strong>.</p>
|
||||
|
||||
@if (config('app.lock_passwords'))
|
||||
<p>Note: Email notification for users is disabled for this installation.</p>
|
||||
@endif
|
||||
<p><strong>Date</strong> should be the checkout date. <strong>Tag</strong> should be the asset tag. <strong>Name</strong> should be the user's name (firstname lastname).</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="first_name" class="col-sm-3 control-label">{{ trans('admin/users/general.usercsv') }}</label>
|
||||
<div class="col-sm-5">
|
||||
<input type="file" name="user_import_csv" id="user_import_csv">
|
||||
</div>
|
||||
</div>
|
||||
<label for="first_name" class="col-sm-3 control-label">{{ trans('admin/users/general.usercsv') }}</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="file" name="user_import_csv" id="user_import_csv">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Create Users -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('create_users', '1', Input::old('create_users')) }} Create users if they do not exist?
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Match firstname.lastname -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
|
@ -97,14 +84,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Checkin Date -->
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
{{ Form::checkbox('checkin_date', '1', Input::old('checkin_date')) }} If no checkin date info is available, should we generate a checkin right before the next checkout?
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -420,7 +420,6 @@
|
|||
|
||||
<li class="divider"> </li>
|
||||
<li{!! (Request::is('hardware/bulkcheckout') ? ' class="active>"' : '') !!}>
|
||||
<small class="label pull-right bg-orange">{{ trans('general.new') }}</small>
|
||||
<a href="{{ route('hardware/bulkcheckout') }}">
|
||||
{{ trans('general.bulk_checkout') }}</a>
|
||||
</li>
|
||||
|
@ -428,7 +427,8 @@
|
|||
<li><a href="{{ URL::to('admin/settings/categories') }}" {!! (Request::is('admin/settings/categories*') ? ' class="active"' : '') !!} >@lang('general.categories')</a></li>
|
||||
<li{!! (Request::query('Deleted') ? ' class="active"' : '') !!}><a href="{{ URL::to('hardware?status=Deleted') }}">@lang('general.deleted')</a></li>
|
||||
<li><a href="{{ URL::to('admin/asset_maintenances') }}" >@lang('general.asset_maintenances') </a></li>
|
||||
<li><a href="{{ URL::to('hardware/import') }}" >@lang('general.import') </a></li>
|
||||
<li><a href="{{ URL::to('hardware/import') }}">@lang('general.import') </a></li>
|
||||
<li><small class="label pull-right bg-orange">{{ trans('general.new') }}</small><a href="{{ URL::to('hardware/history') }}">@lang('general.import-history') </a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@endcan
|
||||
|
|
Loading…
Reference in a new issue