mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-23 12:44:12 -08:00
Updates checkout events to not depend on log
This commit is contained in:
parent
17fc59f989
commit
e24f292a1a
|
@ -22,10 +22,11 @@ class AccessoryCheckedOut
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Accessory $accessory, $checkedOutTo, Actionlog $logEntry)
|
||||
public function __construct(Accessory $accessory, $checkedOutTo, User $checkedOutBy, $note)
|
||||
{
|
||||
$this->accessory = $accessory;
|
||||
$this->checkedOutTo = $checkedOutTo;
|
||||
$this->logEntry = $logEntry;
|
||||
$this->checkedOutBy = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,11 @@ class AssetCheckedOut
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Asset $asset, $checkedOutTo, Actionlog $logEntry)
|
||||
public function __construct(Asset $asset, $checkedOutTo, User $checkedOutBy, $note)
|
||||
{
|
||||
$this->asset = $asset;
|
||||
$this->checkedOutTo = $checkedOutTo;
|
||||
$this->logEntry = $logEntry;
|
||||
$this->checkedOutBy = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Events;
|
||||
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Component;
|
||||
use App\Models\User;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
|
@ -15,17 +14,18 @@ class ComponentCheckedOut
|
|||
|
||||
public $component;
|
||||
public $checkedOutTo;
|
||||
public $logEntry;
|
||||
public $checkedOutBy;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Component $component, $checkedOutTo, Actionlog $logEntry)
|
||||
public function __construct(Component $component, $checkedOutTo, $quantity, User $checkedOutBy)
|
||||
{
|
||||
$this->component = $component;
|
||||
$this->checkedOutTo = $checkedOutTo;
|
||||
$this->logEntry = $logEntry;
|
||||
$this->quantity = $quantity;
|
||||
$this->checkedOutBy = $checkedOutBy;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,11 @@ class ConsumableCheckedOut
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Consumable $consumable, $checkedOutTo, Actionlog $logEntry)
|
||||
public function __construct(Consumable $consumable, $checkedOutTo, User $checkedOutBy, $note)
|
||||
{
|
||||
$this->consumable = $consumable;
|
||||
$this->checkedOutTo = $checkedOutTo;
|
||||
$this->logEntry = $logEntry;
|
||||
$this->checkedOutBy = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,11 @@ class LicenseCheckedOut
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(License $license, $checkedOutTo, Actionlog $logEntry)
|
||||
public function __construct(License $license, $checkedOutTo, User $checkedOutBy, $note)
|
||||
{
|
||||
$this->license = $license;
|
||||
$this->checkedOutTo = $checkedOutTo;
|
||||
$this->logEntry = $logEntry;
|
||||
$this->checkedOutBy = $checkedOutBy;
|
||||
$this->note = $note;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class AccessoryCheckoutController extends Controller
|
|||
|
||||
DB::table('accessories_users')->where('assigned_to', '=', $accessory->assigned_to)->where('accessory_id', '=', $accessory->id)->first();
|
||||
|
||||
event(new AccessoryCheckedOut($accessory, $user, $logaction));
|
||||
event(new AccessoryCheckedOut($accessory, $user, Auth::user(), $request->input('note'));
|
||||
|
||||
// Redirect to the new accessory page
|
||||
return redirect()->route('accessories.index')->with('success', trans('admin/accessories/message.checkout.success'));
|
||||
|
|
|
@ -89,7 +89,7 @@ class ComponentCheckoutController extends Controller
|
|||
|
||||
$logaction = $component->logCheckout(e(Input::get('note')), $asset);
|
||||
|
||||
event(new ComponentCheckedOut($component, $asset, $logaction));
|
||||
event(new ComponentCheckedOut($component, $asset, $request->input('assigned_qty'), Auth::user()));
|
||||
|
||||
return redirect()->route('components.index')->with('success', trans('admin/components/message.checkout.success'));
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class ConsumableCheckoutController extends Controller
|
|||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function store($consumableId)
|
||||
public function store(Request $request, $consumableId)
|
||||
{
|
||||
if (is_null($consumable = Consumable::find($consumableId))) {
|
||||
return redirect()->route('consumables.index')->with('error', trans('admin/consumables/message.not_found'));
|
||||
|
@ -70,7 +70,7 @@ class ConsumableCheckoutController extends Controller
|
|||
|
||||
$logaction = $consumable->logCheckout(e(Input::get('note')), $user);
|
||||
|
||||
event(new ConsumableCheckedOut($consumable, $user, $logaction));
|
||||
event(new ConsumableCheckedOut($consumable, $user, Auth::user(), $request->input('note')));
|
||||
|
||||
// Redirect to the new consumable page
|
||||
return redirect()->route('consumables.index')->with('success', trans('admin/consumables/message.checkout.success'));
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers\Licenses;
|
||||
|
||||
use App\Events\LicenseCheckedOut;
|
||||
use App\Http\Requests\LicenseCheckoutRequest;
|
||||
use App\Models\Asset;
|
||||
use App\Models\License;
|
||||
|
@ -104,6 +105,9 @@ class LicenseCheckoutController extends Controller
|
|||
}
|
||||
if ($licenseSeat->save()) {
|
||||
$licenseSeat->logCheckout(request('note'), $target);
|
||||
|
||||
event(new LicenseCheckedOut($licenseSeat->license, $target, Auth::user(), request('note')));
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -119,6 +123,9 @@ class LicenseCheckoutController extends Controller
|
|||
|
||||
if ($licenseSeat->save()) {
|
||||
$licenseSeat->logCheckout(request('note'), $target);
|
||||
|
||||
event(new LicenseCheckedOut($licenseSeat->license, $target, Auth::user(), request('note')));
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue