Skip to content

A free open source IT asset/license management system

Implement suppliers

Marcus Moore1f19f6b0fcd3
diff --git a/app/Http/Controllers/Reports/CustomComponentReportController.php b/app/Http/Controllers/Reports/CustomComponentReportController.php
index ba08ed4be5..b4a739c96d 100644
--- a/app/Http/Controllers/Reports/CustomComponentReportController.php
+++ b/app/Http/Controllers/Reports/CustomComponentReportController.php
@@ -63,6 +63,7 @@ class CustomComponentReportController extends Controller
'category',
'company',
'manufacturer',
+ 'supplier',
]);
$localConstraints = [
@@ -79,6 +80,7 @@ class CustomComponentReportController extends Controller
'by_company_id' => 'components.company_id',
'by_category_id' => 'components.category_id',
'by_manufacturer_id' => 'components.manufacturer_id',
+ 'by_supplier_id' => 'components.supplier_id',
];
foreach ($foreignConstraints as $formKey => $column) {
@@ -122,6 +124,10 @@ class CustomComponentReportController extends Controller
$row[] = $component->model_number;
}
+ if ($request->filled('supplier')) {
+ $row[] = $component?->supplier->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 ce81538daa..45a90ea796 100644
--- a/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
+++ b/tests/Feature/Reporting/Custom/CustomComponentReportTest.php
@@ -237,8 +237,6 @@ class CustomComponentReportTest extends TestCase
public function test_limiting_by_supplier()
{
- $this->markTestIncomplete();
-
[$supplierA, $supplierB] = Supplier::factory()->count(2)->create()->all();
Component::factory()