mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Delete checkout acceptances when an asset is checked in without response
This commit is contained in:
parent
6bd18ebefa
commit
27ff0be9a8
|
@ -71,20 +71,27 @@ 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');
|
||||||
Notification::locale(Setting::getSettings()->locale)->send(
|
Notification::locale(Setting::getSettings()->locale)->send(
|
||||||
$this->getNotifiables($event),
|
$this->getNotifiables($event),
|
||||||
$this->getCheckinNotification($event)
|
$this->getCheckinNotification($event)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
\Log::debug('Use user locale? I do not think this works as expected yet');
|
\Log::debug('Use user locale? I do not think this works as expected yet');
|
||||||
// \Log::debug(print_r($this->getNotifiables($event), true));
|
// \Log::debug(print_r($this->getNotifiables($event), true));
|
||||||
Notification::send(
|
Notification::send(
|
||||||
$this->getNotifiables($event),
|
$this->getNotifiables($event),
|
||||||
$this->getCheckinNotification($event)
|
$this->getCheckinNotification($event)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue