Skip to content

Commit

Permalink
Merge pull request snipe#14327 from snipe/fixes/better_ui_for_history…
Browse files Browse the repository at this point in the history
…_importer

Nicer UI for history importer
  • Loading branch information
snipe authored Feb 23, 2024
2 parents 8cd0a90 + a184b4e commit 10dad8e
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 170 deletions.
8 changes: 4 additions & 4 deletions app/Http/Controllers/Assets/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,11 @@ public function postImportHistory(Request $request)

if ($isCheckinHeaderExplicit) {

//if checkin date header exists, assume that empty or future date is still checked out
//if checkin is before todays date, assume it's checked in and do not assign user ID, if checkin date is in the future or blank, this is the expected checkin date, items is checked out
// if checkin date header exists, assume that empty or future date is still checked out
// if checkin is before today's date, assume it's checked in and do not assign user ID, if checkin date is in the future or blank, this is the expected checkin date, items are checked out

if ((strtotime($checkin_date) > strtotime(Carbon::now())) || (empty($checkin_date))
) {
if ((strtotime($checkin_date) > strtotime(Carbon::now())) || (empty($checkin_date)))
{
//only do this if item is checked out
$asset->assigned_to = $user->id;
$asset->assigned_type = User::class;
Expand Down
19 changes: 6 additions & 13 deletions resources/lang/en-US/admin/hardware/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,13 @@
'undeployable_tooltip' => 'This asset has a status label that is undeployable and cannot be checked out at this time.',
'view' => 'View Asset',
'csv_error' => 'You have an error in your CSV file:',
'import_text' => '
<p>
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 &gt; General Settings.
</p>
<p>Fields included in the CSV must match the headers: <strong>Asset Tag, Name, Checkout Date, Checkin Date</strong>. Any additional fields will be ignored. </p>
<p>Checkin Date: blank or future checkin dates will checkout items to associated user. Excluding the Checkin Date column will create a checkin date with todays date.</p>
'import_text' => '<p>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 <code>Admin &gt; General Settings</code>.</p><p>Fields included in the CSV must match the headers: <strong>Asset Tag, Name, Checkout Date, Checkin Date</strong>. Any additional fields will be ignored. </p><p>Checkin Date: blank or future checkin dates will checkout items to associated user. Excluding the Checkin Date column will create a checkin date with todays date.</p>
',
'csv_import_match_f-l' => 'Try to match users by firstname.lastname (jane.smith) format',
'csv_import_match_initial_last' => 'Try to match users by first initial last name (jsmith) format',
'csv_import_match_first' => 'Try to match users by first name (jane) format',
'csv_import_match_email' => 'Try to match users by email as username',
'csv_import_match_username' => 'Try to match users by username',
'csv_import_match_f-l' => 'Try to match users by <strong>firstname.lastname</strong> (<code>jane.smith</code>) format',
'csv_import_match_initial_last' => 'Try to match users by <strong>first initial last name</strong> (<code>jsmith</code>) format',
'csv_import_match_first' => 'Try to match users by <strong>first name</strong> (<code>jane</code>) format',
'csv_import_match_email' => 'Try to match users by <strong>email</strong> as username',
'csv_import_match_username' => 'Try to match users by <strong>username</strong>',
'error_messages' => 'Error messages:',
'success_messages' => 'Success messages:',
'alert_details' => 'Please see below for details.',
Expand Down
Loading

0 comments on commit 10dad8e

Please sign in to comment.