Skip to content

A free open source IT asset/license management system

More fields visible

snipeea365e5645c2
diff --git a/app/Console/Commands/TestLocationsFMCS.php b/app/Console/Commands/TestLocationsFMCS.php
index d71c41f960..908057565a 100644
--- a/app/Console/Commands/TestLocationsFMCS.php
+++ b/app/Console/Commands/TestLocationsFMCS.php
@@ -41,7 +41,7 @@ class TestLocationsFMCS extends Command
$this->newLine();
$this->info('Edit your locations to associate them with the correct company.');
- $header = ['Type', 'Name', 'ID', 'Item Company', 'Company ID', 'Item Location', 'Location Company ID'];
+ $header = ['ID', 'Type', 'Name', 'Checkout Type', 'Company ID', 'Item Company','Item Location', 'Location Company', 'Location Company ID'];
sort($mismatched);
$this->table($header, $mismatched);
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php
index e5857fe4a5..75bcc6d01d 100644
--- a/app/Helpers/Helper.php
+++ b/app/Helpers/Helper.php
@@ -1556,14 +1556,14 @@ class Helper
}
foreach($locations as $location) {
- // in case of an update of a single location use the newly requested company_id
+ // in case of an update of a single location, use the newly requested company_id
if ($new_company_id) {
$location_company = $new_company_id;
} else {
$location_company = $location->company_id;
}
- // depending on the relationship, we must use different operations to retrieve the objects
+ // Depending on the relationship, we must use different operations to retrieve the objects
$keywords_relation = [
'many' => [
'accessories',
@@ -1594,14 +1594,17 @@ class Helper
}
foreach ($items as $item) {
+
if ($item && $item->company_id != $location_company) {
$mismatched[] = [
- class_basename(get_class($item)),
- $item->name,
$item->id,
- $item->company->name ?? null,
+ class_basename(get_class($item)),
+ $item->name ?? $item->asset_tag ?? $item->serial ?? $item->username,
+ str_replace('App\\Models\\', '', $item->assigned_type) ?? null,
$item->company_id ?? null,
+ $item->company->name ?? null,
$item->location->name ?? null,
+ $item->location->company->name ?? null,
$location_company ?? null,
];