Feature snipe#9378 update

This commit is contained in:
sh1hab 2021-05-21 10:19:04 +06:00
parent cd4b1d8acb
commit f43413bdc3

View file

@ -12,6 +12,7 @@ use App\Models\Depreciation;
use App\Models\License;
use App\Models\Setting;
use Carbon\Carbon;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\View;
@ -929,6 +930,7 @@ class ReportsController extends Controller
* getAssetAcceptanceReport
*
* @return mixed
* @throws AuthorizationException
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
*/
@ -940,11 +942,11 @@ class ReportsController extends Controller
* Get all assets with pending checkout acceptances
*/
$acceptances = CheckoutAcceptance::pending()->get();
$acceptances = CheckoutAcceptance::pending()->with('assignedTo')->get();
$assetsForReport = $acceptances
->filter(function($acceptance) {
return $acceptance->checkoutable_type == 'App\Models\Asset';
return $acceptance->checkoutable_type == 'App\Models\Asset' && !is_null($acceptance->assignedTo);
})
->map(function($acceptance) {
return $acceptance->checkoutable;