A free open source IT asset/license management system
Fixes to history importer
snipe8b4a9aa3824c
diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.phpindex d237420328..20f3a22854 100755--- a/app/Http/Controllers/AssetsController.php+++ b/app/Http/Controllers/AssetsController.php@@ -597,7 +597,9 @@ class AssetsController extends Controller}$batch_counter = count($item[$asset_tag]);- $item[$asset_tag][$batch_counter]['checkout_date'] = Carbon::parse(Helper::array_smart_fetch($row, "date"))->format('Y-m-d H:i:s');+ $item[$asset_tag][$batch_counter]['checkout_date'] = Carbon::parse(Helper::array_smart_fetch($row, "checkout date"))->format('Y-m-d H:i:s');+ $item[$asset_tag][$batch_counter]['checkin_date'] = Carbon::parse(Helper::array_smart_fetch($row, "checkin date"))->format('Y-m-d H:i:s');+ \Log::debug($item[$asset_tag][$batch_counter]['checkin_date']);$item[$asset_tag][$batch_counter]['asset_tag'] = Helper::array_smart_fetch($row, "asset tag");$item[$asset_tag][$batch_counter]['name'] = Helper::array_smart_fetch($row, "name");@@ -680,9 +682,11 @@ class AssetsController extends Controller// Only do this if a matching user was foundif ((array_key_exists('checkedout_to', $asset_batch[$x])) && ($asset_batch[$x]['checkedout_to']!='')) {if (($total_in_batch > 1) && ($x < $total_in_batch) && (array_key_exists($next, $asset_batch))) {- $checkin_date = Carbon::parse($asset_batch[$next]['checkout_date'])->subDay(1)->format('Y-m-d H:i:s');+ $checkin_date = Carbon::parse($asset_batch[$next]['checkin_date'])->format('Y-m-d H:i:s');$asset_batch[$x]['real_checkin'] = $checkin_date;+ \Log::debug($asset_batch[$next]['checkin_date']);+ \Log::debug($checkin_date);Actionlog::firstOrCreate(array('item_id' => $asset_batch[$x]['asset_id'],'item_type' => Asset::class,diff --git a/resources/views/hardware/history.blade.php b/resources/views/hardware/history.blade.phpindex 92f38a269c..5204823566 100644--- a/resources/views/hardware/history.blade.php+++ b/resources/views/hardware/history.blade.php@@ -64,9 +64,8 @@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 > General Settings.</p>- <p>Fields included in the CSV must match the headers: <strong>Date, Tag, Name</strong>. Any additional fields will be ignored. </p>+ <p>Fields included in the CSV must match the headers: <strong>Asset Tag, Checkout Date, Checkin Date, Name</strong>. Any additional fields will be ignored. </p>- <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><p><strong>History should be ordered by date in ascending order.</strong></p>