A free open source IT asset/license management system
Tidied up some debugging code, better explanation
snipe41a20d8f6636
diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.phpindex 85321fd15e..d754692f83 100755--- a/app/Http/Controllers/AssetsController.php+++ b/app/Http/Controllers/AssetsController.php@@ -1099,6 +1099,7 @@ class AssetsController extends Controller// A matching user was foundif ($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 Controllerforeach ($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);diff --git a/config/version.php b/config/version.phpindex 4269428b40..0a2444836c 100644--- a/config/version.php+++ b/config/version.php@@ -1,5 +1,5 @@<?phpreturn 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',);diff --git a/resources/views/hardware/history.blade.php b/resources/views/hardware/history.blade.phpindex 6230853f9a..d48d0ffa40 100644--- a/resources/views/hardware/history.blade.php+++ b/resources/views/hardware/history.blade.php@@ -31,35 +31,22 @@@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">@@ -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>diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.phpindex a91470a829..9b119d9374 100644--- a/resources/views/layouts/default.blade.php+++ b/resources/views/layouts/default.blade.php@@ -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