Skip to content

Commit

Permalink
fix showDeletedFunction by reverting snipe#9508
Browse files Browse the repository at this point in the history
  • Loading branch information
dampfklon committed Mar 16, 2022
1 parent 29e1d65 commit 9818d16
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/Http/Controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -933,12 +933,17 @@ public function getAssetAcceptanceReport($deleted = false)
/**
* Get all assets with pending checkout acceptances
*/

$acceptances = CheckoutAcceptance::pending()->with('assignedTo')->get();
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();
}

$assetsForReport = $acceptances
->filter(function($acceptance) {
return $acceptance->checkoutable_type == 'App\Models\Asset' && !is_null($acceptance->assignedTo);
->filter(function ($acceptance) {
return $acceptance->checkoutable_type == 'App\Models\Asset';
})
->map(function($acceptance) {
return ['assetItem' => $acceptance->checkoutable, 'acceptance' => $acceptance];
Expand Down

0 comments on commit 9818d16

Please sign in to comment.