mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 12:17:05 -08:00
Added some debugging and comments
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
4eab5fd075
commit
e467ce912b
|
@ -24,10 +24,14 @@ use Illuminate\Support\Facades\Notification;
|
||||||
class CheckoutableListener
|
class CheckoutableListener
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Notify the user about the checked out checkoutable
|
* Notify the user about the checked out checkoutable and add a record to the
|
||||||
|
* checkout_requests table.
|
||||||
*/
|
*/
|
||||||
public function onCheckedOut($event)
|
public function onCheckedOut($event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
\Log::debug('onCheckedOut in the Checkoutable listener fired');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the item wasn't checked out to a user, we can't send notifications
|
* When the item wasn't checked out to a user, we can't send notifications
|
||||||
*/
|
*/
|
||||||
|
@ -58,14 +62,12 @@ class CheckoutableListener
|
||||||
*/
|
*/
|
||||||
public function onCheckedIn($event)
|
public function onCheckedIn($event)
|
||||||
{
|
{
|
||||||
\Log::debug('checkin fired');
|
\Log::debug('onCheckedIn in the Checkoutable listener fired');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the item wasn't checked out to a user, we can't send notifications
|
* When the item wasn't checked out to a user, we can't send notifications
|
||||||
*/
|
*/
|
||||||
if (! $event->checkedOutTo instanceof User) {
|
if (! $event->checkedOutTo instanceof User) {
|
||||||
\Log::debug('checked out to not a user');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,16 +83,14 @@ class CheckoutableListener
|
||||||
$acceptance->delete();
|
$acceptance->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\Log::debug('checked out to a user');
|
|
||||||
|
// Use default locale
|
||||||
if (! $event->checkedOutTo->locale) {
|
if (! $event->checkedOutTo->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(print_r($this->getNotifiables($event), true));
|
|
||||||
Notification::send(
|
Notification::send(
|
||||||
$this->getNotifiables($event),
|
$this->getNotifiables($event),
|
||||||
$this->getCheckinNotification($event)
|
$this->getCheckinNotification($event)
|
||||||
|
@ -151,10 +151,6 @@ class CheckoutableListener
|
||||||
private function getCheckinNotification($event)
|
private function getCheckinNotification($event)
|
||||||
{
|
{
|
||||||
|
|
||||||
// $model = get_class($event->checkoutable);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$notificationClass = null;
|
$notificationClass = null;
|
||||||
|
|
||||||
switch (get_class($event->checkoutable)) {
|
switch (get_class($event->checkoutable)) {
|
||||||
|
|
Loading…
Reference in a new issue