mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-13 17:14:10 -08:00
Added some comments for clarity
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
bcd0671213
commit
d0e8a4ca09
|
@ -22,24 +22,44 @@ use App\Models\LicenseSeat;
|
||||||
|
|
||||||
class LogListener
|
class LogListener
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* These onBlah methods are used by the subscribe() method further down in this file.
|
||||||
|
* This one creates an action_logs entry for the checkin
|
||||||
|
* @param CheckoutableCheckedIn $event
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function onCheckoutableCheckedIn(CheckoutableCheckedIn $event)
|
public function onCheckoutableCheckedIn(CheckoutableCheckedIn $event)
|
||||||
{
|
{
|
||||||
$event->checkoutable->logCheckin($event->checkedOutTo, $event->note, $event->action_date);
|
$event->checkoutable->logCheckin($event->checkedOutTo, $event->note, $event->action_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These onBlah methods are used by the subscribe() method further down in this file.
|
||||||
|
* This one creates an action_logs entry for the checkout
|
||||||
|
*
|
||||||
|
* @param CheckoutableCheckedOut $event
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function onCheckoutableCheckedOut(CheckoutableCheckedOut $event)
|
public function onCheckoutableCheckedOut(CheckoutableCheckedOut $event)
|
||||||
{
|
{
|
||||||
$event->checkoutable->logCheckout($event->note, $event->checkedOutTo, $event->checkoutable->last_checkout);
|
$event->checkoutable->logCheckout($event->note, $event->checkedOutTo, $event->checkoutable->last_checkout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These onBlah methods are used by the subscribe() method further down in this file.
|
||||||
|
* This creates the entry in the action_logs table for the accept/decline action
|
||||||
|
*/
|
||||||
public function onCheckoutAccepted(CheckoutAccepted $event)
|
public function onCheckoutAccepted(CheckoutAccepted $event)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
\Log::error('event passed to the onCheckoutAccepted listener:');
|
||||||
$logaction = new Actionlog();
|
$logaction = new Actionlog();
|
||||||
$logaction->item()->associate($event->acceptance->checkoutable);
|
$logaction->item()->associate($event->acceptance->checkoutable);
|
||||||
$logaction->target()->associate($event->acceptance->assignedTo);
|
$logaction->target()->associate($event->acceptance->assignedTo);
|
||||||
$logaction->accept_signature = $event->acceptance->signature_filename;
|
$logaction->accept_signature = $event->acceptance->signature_filename;
|
||||||
$logaction->stored_eula_file = $event->acceptance->stored_eula_file;
|
$logaction->filename = $event->acceptance->stored_eula_file;
|
||||||
$logaction->action_type = 'accepted';
|
$logaction->action_type = 'accepted';
|
||||||
|
|
||||||
// TODO: log the actual license seat that was checked out
|
// TODO: log the actual license seat that was checked out
|
||||||
|
@ -47,6 +67,7 @@ class LogListener
|
||||||
$logaction->item()->associate($event->acceptance->checkoutable->license);
|
$logaction->item()->associate($event->acceptance->checkoutable->license);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\Log::debug('New onCheckoutAccepted Listener fired. logaction: '.print_r($logaction, true));
|
||||||
$logaction->save();
|
$logaction->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue