A free open source IT asset/license management system
Delete checkout acceptances when an asset is checked in without response
Ivan Nieto Vivanco27ff0be9a81f
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.phpindex ce38d7253c..ba21790f94 100644--- a/app/Listeners/CheckoutableListener.php+++ b/app/Listeners/CheckoutableListener.php@@ -71,20 +71,27 @@ class CheckoutableListener/*** 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');if(!$event->checkedOutTo->locale){\Log::debug('Use default settings locale');Notification::locale(Setting::getSettings()->locale)->send(- $this->getNotifiables($event),+ $this->getNotifiables($event),$this->getCheckinNotification($event));} else {\Log::debug('Use user locale? I do not think this works as expected yet');// \Log::debug(print_r($this->getNotifiables($event), true));Notification::send(- $this->getNotifiables($event),+ $this->getNotifiables($event),$this->getCheckinNotification($event));}