A free open source IT asset/license management system
Updates asset acceptance report to show unaccepted assets
Till Deeke8c96e8fd4b16
diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.phpindex 05e0a0f13c..79d41f7b9c 100644--- a/app/Http/Controllers/ReportsController.php+++ b/app/Http/Controllers/ReportsController.php@@ -7,6 +7,7 @@ use App\Models\Actionlog;use App\Models\Asset;use App\Models\AssetMaintenance;use App\Models\CustomField;+use App\Models\CheckoutAcceptance;use App\Models\Depreciation;use App\Models\License;use App\Models\Setting;@@ -805,7 +806,20 @@ class ReportsController extends Controllerpublic function getAssetAcceptanceReport(){$this->authorize('reports.view');- $assetsForReport = Asset::notYetAccepted()->with('company')->get();++ /**+ * Get all assets with pending checkout acceptances+ */++ $acceptances = CheckoutAcceptance::pending()->get();++ $assetsForReport = $acceptances+ ->filter(function($acceptance) {+ return $acceptance->checkoutable_type == 'App\Models\Asset';+ })+ ->map(function($acceptance) {+ return $acceptance->checkoutable;+ });return view('reports/unaccepted_assets', compact('assetsForReport'));}diff --git a/app/Models/Asset.php b/app/Models/Asset.phpindex ec38931b4f..35206b41ea 100644--- a/app/Models/Asset.php+++ b/app/Models/Asset.php@@ -34,7 +34,6 @@ class Asset extends Depreciableconst ASSET = 'asset';const USER = 'user';- const ACCEPTANCE_PENDING = 'pending';use Acceptable;/**@@ -263,18 +262,6 @@ class Asset extends Depreciable$this->location_id = $target->id;}}-- /**- * Does the user have to confirm that they accept the asset?- *- * If so, set the acceptance-status to "pending".- * This value is used in the unaccepted assets reports, for example- *- * @see https://github.com/snipe/snipe-it/issues/5772- */- if ($this->requireAcceptance() && $target instanceof User) {- $this->accepted = self::ACCEPTANCE_PENDING;- }if ($this->save()) {