Merge branch 'develop'

This commit is contained in:
snipe 2017-11-07 18:21:47 -08:00
commit 7233e2dded
2 changed files with 21 additions and 12 deletions

View file

@ -454,14 +454,32 @@ class AssetsController extends Controller
}
$this->authorize('checkout', $asset);
// Fetch the target and set the asset's new location_id
if (request('assigned_user')) {
$target = User::find(request('assigned_user'));
$asset->location_id = ($target) ? $target->location_id : '';
} elseif (request('assigned_asset')) {
$target = Asset::where('id','!=',$assetId)->find(request('assigned_asset'));
$asset->location_id = $target->rtd_location_id;
// Override with the asset's location_id if it has one
if ($target->location_id!='') {
$asset->location_id = ($target) ? $target->location_id : '';
}
} elseif (request('assigned_location')) {
$target = Location::find(request('assigned_location'));
$asset->location_id = ($target) ? $target->id : '';
}
// $user = User::find(Input::get('assigned_to'));
// No valid target was found - error out
if (!$target) {
return redirect()->to("hardware/$assetId/checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($asset->getErrors());
}
$admin = Auth::user();
if ((Input::has('checkout_at')) && (Input::get('checkout_at')!= date("Y-m-d"))) {
@ -476,15 +494,6 @@ class AssetsController extends Controller
$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

View file

@ -78,7 +78,7 @@ return [
|
*/
'locale' => env('APP_LOCALE', 'en_US.UTF-8'),
'locale' => env('APP_LOCALE', 'en'),
/*
|--------------------------------------------------------------------------