Skip to content

A free open source IT asset/license management system

Implement locations

Marcus Moorec94de0154789
diff --git a/app/Http/Controllers/Reports/CustomComponentReportController.php b/app/Http/Controllers/Reports/CustomComponentReportController.php
index b4a739c96d..7f2d4daf65 100644
--- a/app/Http/Controllers/Reports/CustomComponentReportController.php
+++ b/app/Http/Controllers/Reports/CustomComponentReportController.php
@@ -64,6 +64,7 @@ class CustomComponentReportController extends Controller
'company',
'manufacturer',
'supplier',
+ 'location',
]);
$localConstraints = [
@@ -81,6 +82,7 @@ class CustomComponentReportController extends Controller
'by_category_id' => 'components.category_id',
'by_manufacturer_id' => 'components.manufacturer_id',
'by_supplier_id' => 'components.supplier_id',
+ 'by_location_id' => 'components.location_id',
];
foreach ($foreignConstraints as $formKey => $column) {
@@ -128,6 +130,10 @@ class CustomComponentReportController extends Controller
$row[] = $component?->supplier->name;
}
+ if ($request->filled('location')) {
+ $row[] = $component?->location->name;
+ }
+
// CSV_ESCAPE_FORMULAS is set to false in the .env
if (config('app.escape_formulas') === false) {
fputcsv($handle, $row);
diff --git a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
index 45a90ea796..6621d878f3 100644
--- a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
@@ -262,8 +262,6 @@ class CustomComponentReportTest extends TestCase
public function test_limiting_by_location()
{
- $this->markTestIncomplete();
-
[$locationA, $locationB] = Location::factory()->count(2)->create()->all();
Component::factory()