Delete checkout acceptances when an asset is checked in without response

This commit is contained in:
Ivan Nieto Vivanco 2021-09-07 12:01:32 -05:00
parent 6bd18ebefa
commit 27ff0be9a8

View file

@ -71,8 +71,15 @@ class CheckoutableListener
/** /**
* Send the appropriate notification * Send the appropriate notification
*/ */
$acceptances = CheckoutAcceptance::where('checkoutable_id', $event->checkoutable->id)
->where('assigned_to_id', $event->checkedOutTo->id)
->get();
foreach($acceptances as $acceptance){
if($acceptance->isPending()){
$acceptance->delete();
}
}
\Log::debug('checked out to a user'); \Log::debug('checked out to a user');
if(!$event->checkedOutTo->locale){ if(!$event->checkedOutTo->locale){
\Log::debug('Use default settings locale'); \Log::debug('Use default settings locale');