mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-13 06:47:46 -08:00
Merge pull request #9993 from inietov/fixes/exception_when_checkin_licenses_from_assets
Fixes Exception when Checkin Licenses from Assets
This commit is contained in:
commit
127a3e41bd
|
@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\License;
|
||||
use App\Models\LicenseSeat;
|
||||
use App\Models\User;
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
@ -80,7 +81,12 @@ class LicenseCheckinController extends Controller
|
|||
// Ooops.. something went wrong
|
||||
return redirect()->back()->withInput()->withErrors($validator);
|
||||
}
|
||||
|
||||
if($licenseSeat->assigned_to != null){
|
||||
$return_to = User::find($licenseSeat->assigned_to);
|
||||
} else {
|
||||
$return_to = Asset::find($licenseSeat->asset_id);
|
||||
}
|
||||
|
||||
// Update the asset data
|
||||
$licenseSeat->assigned_to = null;
|
||||
|
@ -88,7 +94,6 @@ class LicenseCheckinController extends Controller
|
|||
|
||||
// Was the asset updated?
|
||||
if ($licenseSeat->save()) {
|
||||
|
||||
event(new CheckoutableCheckedIn($licenseSeat, $return_to, Auth::user(), $request->input('note')));
|
||||
|
||||
if ($backTo=='user') {
|
||||
|
|
Loading…
Reference in a new issue