mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Added update to asset location id on checkout/checkin
This commit is contained in:
parent
3d7fd5cf04
commit
108ac79442
|
@ -524,11 +524,23 @@ class AssetsController extends Controller
|
||||||
return response()->json(Helper::formatStandardApiResponse('error', $error_payload, 'No valid checkout target specified for asset '.e($asset->asset_tag).'.'));
|
return response()->json(Helper::formatStandardApiResponse('error', $error_payload, 'No valid checkout target specified for asset '.e($asset->asset_tag).'.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$checkout_at = request('checkout_at', date("Y-m-d H:i:s"));
|
$checkout_at = request('checkout_at', date("Y-m-d H:i:s"));
|
||||||
$expected_checkin = request('expected_checkin', null);
|
$expected_checkin = request('expected_checkin', null);
|
||||||
$note = request('note', null);
|
$note = request('note', null);
|
||||||
$asset_name = request('name', null);
|
$asset_name = request('name', null);
|
||||||
|
|
||||||
|
// Set the location ID to the RTD location id if there is one
|
||||||
|
if ($asset->rtd_location_id!='') {
|
||||||
|
$asset->location_id = $target->rtd_location_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overwrite that if the target has a location ID though
|
||||||
|
if ($target->location_id!='') {
|
||||||
|
$asset->location_id = $target->location_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($asset->checkOut($target, Auth::user(), $checkout_at, $expected_checkin, $note, $asset_name)) {
|
if ($asset->checkOut($target, Auth::user(), $checkout_at, $expected_checkin, $note, $asset_name)) {
|
||||||
return response()->json(Helper::formatStandardApiResponse('success', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkout.success')));
|
return response()->json(Helper::formatStandardApiResponse('success', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkout.success')));
|
||||||
|
|
|
@ -468,6 +468,17 @@ class AssetsController extends Controller
|
||||||
} else {
|
} else {
|
||||||
$expected_checkin = '';
|
$expected_checkin = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the location ID to the RTD location id if there is one
|
||||||
|
if ($asset->rtd_location_id!='') {
|
||||||
|
$asset->location_id = $target->rtd_location_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Overwrite that if the target has a location ID though
|
||||||
|
if ($target->location_id!='') {
|
||||||
|
$asset->location_id = $target->location_id;
|
||||||
|
}
|
||||||
|
|
||||||
if ($asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), Input::get('name'))) {
|
if ($asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), Input::get('name'))) {
|
||||||
// Redirect to the new asset page
|
// Redirect to the new asset page
|
||||||
return redirect()->route("hardware.index")->with('success', trans('admin/hardware/message.checkout.success'));
|
return redirect()->route("hardware.index")->with('success', trans('admin/hardware/message.checkout.success'));
|
||||||
|
|
Loading…
Reference in a new issue