Added update to asset location id on checkout/checkin

This commit is contained in:
snipe 2017-10-28 07:38:36 -07:00
parent 3d7fd5cf04
commit 108ac79442
2 changed files with 23 additions and 0 deletions

View file

@ -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).'.'));
}
$checkout_at = request('checkout_at', date("Y-m-d H:i:s"));
$expected_checkin = request('expected_checkin', null);
$note = request('note', 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)) {
return response()->json(Helper::formatStandardApiResponse('success', ['asset'=> e($asset->asset_tag)], trans('admin/hardware/message.checkout.success')));

View file

@ -468,6 +468,17 @@ class AssetsController extends Controller
} else {
$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'))) {
// Redirect to the new asset page
return redirect()->route("hardware.index")->with('success', trans('admin/hardware/message.checkout.success'));