A free open source IT asset/license management system
Merge branch 'develop' into feature/remove_deleted_user_from_unaccepted_assets_report
sniped36849bd413e
diff --cc app/Http/Controllers/ReportsController.phpindex f0e4c515e0,91ff9bc2ff..1665ef3d15--- a/app/Http/Controllers/ReportsController.php+++ b/app/Http/Controllers/ReportsController.php@@@ -11,9 -12,10 +12,11 @@@ use App\Models\CustomFielduse App\Models\Depreciation;use App\Models\License;use App\Models\Setting;+ use App\Notifications\CheckoutAssetNotification;use Carbon\Carbon;+use Illuminate\Auth\Access\AuthorizationException;use Illuminate\Http\Request;+ use Illuminate\Support\Facades\Notification;use Illuminate\Support\Facades\Response;use Illuminate\Support\Facades\View;use Input;@@@ -930,7 -907,7 +908,8 @@@ class ReportsController extends Control* getAssetAcceptanceReport** @return mixed- * @throws AuthorizationException+ * @throws \Illuminate\Auth\Access\AuthorizationException++* @author Vincent Sposato <[email protected]>* @version v1.0*/@@@ -941,18 -919,23 +921,18 @@@/*** Get all assets with pending checkout acceptances*/- if($showDeleted) {- $acceptances = CheckoutAcceptance::pending()->withTrashed()->with(['assignedTo' , 'checkoutable.assignedTo', 'checkoutable.model'])->get();- } else {- $acceptances = CheckoutAcceptance::pending()->with(['assignedTo' => function ($query) {- $query->withTrashed();- }, 'checkoutable.assignedTo', 'checkoutable.model'])->get();- }++ $acceptances = CheckoutAcceptance::pending()->with('assignedTo')->get();$assetsForReport = $acceptances- ->filter(function ($acceptance) {- return $acceptance->checkoutable_type == \App\Models\Asset::class;+ ->filter(function($acceptance) {+ return $acceptance->checkoutable_type == 'App\Models\Asset' && !is_null($acceptance->assignedTo);})->map(function($acceptance) {- return $acceptance->checkoutable;+ return ['assetItem' => $acceptance->checkoutable, 'acceptance' => $acceptance];});- return view('reports/unaccepted_assets', compact('assetsForReport'));+ return view('reports/unaccepted_assets', compact('assetsForReport','showDeleted' ));}/**