forked from snipe/snipe-it
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes snipe#5859 - add file name/size to file upload UI * Reverting assetcontroller Not sure exactly what happened here… * Production assets
- Loading branch information
Showing
14 changed files
with
475 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,14 +60,14 @@ public function __construct() | |
} | ||
|
||
/** | ||
* Returns a view that invokes the ajax tables which actually contains | ||
* the content for the assets listing, which is generated in getDatatable. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @see AssetController::getDatatable() method that generates the JSON response | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
* Returns a view that invokes the ajax tables which actually contains | ||
* the content for the assets listing, which is generated in getDatatable. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @see AssetController::getDatatable() method that generates the JSON response | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
public function index(Request $request) | ||
{ | ||
$this->authorize('index', Asset::class); | ||
|
@@ -104,12 +104,12 @@ public function create(Request $request) | |
} | ||
|
||
/** | ||
* Validate and process new asset form data. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @since [v1.0] | ||
* @return Redirect | ||
*/ | ||
* Validate and process new asset form data. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @since [v1.0] | ||
* @return Redirect | ||
*/ | ||
public function store(AssetRequest $request) | ||
{ | ||
$this->authorize(Asset::class); | ||
|
@@ -195,7 +195,7 @@ public function store(AssetRequest $request) | |
} | ||
} | ||
|
||
// Was the asset created? | ||
// Was the asset created? | ||
if ($asset->save()) { | ||
|
||
|
||
|
@@ -223,13 +223,13 @@ public function store(AssetRequest $request) | |
} | ||
|
||
/** | ||
* Returns a view that presents a form to edit an existing asset. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
* Returns a view that presents a form to edit an existing asset. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
public function edit($assetId = null) | ||
{ | ||
if (!$item = Asset::find($assetId)) { | ||
|
@@ -246,13 +246,13 @@ public function edit($assetId = null) | |
|
||
|
||
/** | ||
* Returns a view that presents information about an asset for detail view. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
* Returns a view that presents information about an asset for detail view. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
public function show($assetId = null) | ||
{ | ||
$asset = Asset::withTrashed()->find($assetId); | ||
|
@@ -289,13 +289,13 @@ public function show($assetId = null) | |
|
||
|
||
/** | ||
* Validate and process asset edit form. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return Redirect | ||
*/ | ||
* Validate and process asset edit form. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return Redirect | ||
*/ | ||
|
||
public function update(AssetRequest $request, $assetId = null) | ||
{ | ||
|
@@ -404,13 +404,13 @@ public function update(AssetRequest $request, $assetId = null) | |
} | ||
|
||
/** | ||
* Delete a given asset (mark as deleted). | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return Redirect | ||
*/ | ||
* Delete a given asset (mark as deleted). | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return Redirect | ||
*/ | ||
public function destroy($assetId) | ||
{ | ||
// Check if the asset exists | ||
|
@@ -450,13 +450,13 @@ public function getAssetByTag() | |
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch); | ||
} | ||
/** | ||
* Return a QR code for the asset | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return Response | ||
*/ | ||
* Return a QR code for the asset | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return Response | ||
*/ | ||
public function getQrCode($assetId = null) | ||
{ | ||
$settings = Setting::getSettings(); | ||
|
@@ -516,13 +516,13 @@ public function getBarCode($assetId = null) | |
} | ||
|
||
/** | ||
* Returns a view that presents a form to clone an asset. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
* Returns a view that presents a form to clone an asset. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
public function getClone($assetId = null) | ||
{ | ||
// Check if the asset exists | ||
|
@@ -540,9 +540,9 @@ public function getClone($assetId = null) | |
$asset->assigned_to = ''; | ||
|
||
return view('hardware/edit') | ||
->with('statuslabel_list', Helper::statusLabelList()) | ||
->with('statuslabel_types', Helper::statusTypeList()) | ||
->with('item', $asset); | ||
->with('statuslabel_list', Helper::statusLabelList()) | ||
->with('statuslabel_types', Helper::statusTypeList()) | ||
->with('item', $asset); | ||
} | ||
|
||
/** | ||
|
@@ -641,15 +641,15 @@ public function postImportHistory(Request $request) | |
$item[$asset_tag][$batch_counter]['user_id'] = $user->id; | ||
|
||
Actionlog::firstOrCreate(array( | ||
'item_id' => $asset->id, | ||
'item_type' => Asset::class, | ||
'user_id' => Auth::user()->id, | ||
'note' => 'Checkout imported by '.Auth::user()->present()->fullName().' from history importer', | ||
'target_id' => $item[$asset_tag][$batch_counter]['user_id'], | ||
'target_type' => User::class, | ||
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'], | ||
'action_type' => 'checkout', | ||
)); | ||
'item_id' => $asset->id, | ||
'item_type' => Asset::class, | ||
'user_id' => Auth::user()->id, | ||
'note' => 'Checkout imported by '.Auth::user()->present()->fullName().' from history importer', | ||
'target_id' => $item[$asset_tag][$batch_counter]['user_id'], | ||
'target_type' => User::class, | ||
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'], | ||
'action_type' => 'checkout', | ||
)); | ||
|
||
$asset->assigned_to = $user->id; | ||
|
||
|
@@ -682,14 +682,14 @@ public function postImportHistory(Request $request) | |
$asset_batch[$x]['real_checkin'] = $checkin_date; | ||
|
||
Actionlog::firstOrCreate(array( | ||
'item_id' => $asset_batch[$x]['asset_id'], | ||
'item_type' => Asset::class, | ||
'user_id' => Auth::user()->id, | ||
'note' => 'Checkin imported by ' . Auth::user()->present()->fullName() . ' from history importer', | ||
'target_id' => null, | ||
'created_at' => $checkin_date, | ||
'action_type' => 'checkin' | ||
)); | ||
'item_id' => $asset_batch[$x]['asset_id'], | ||
'item_type' => Asset::class, | ||
'user_id' => Auth::user()->id, | ||
'note' => 'Checkin imported by ' . Auth::user()->present()->fullName() . ' from history importer', | ||
'target_id' => null, | ||
'created_at' => $checkin_date, | ||
'action_type' => 'checkin' | ||
)); | ||
} | ||
} | ||
} | ||
|
@@ -698,13 +698,13 @@ public function postImportHistory(Request $request) | |
} | ||
|
||
/** | ||
* Retore a deleted asset. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
* Retore a deleted asset. | ||
* | ||
* @author [A. Gianotto] [<[email protected]>] | ||
* @param int $assetId | ||
* @since [v1.0] | ||
* @return View | ||
*/ | ||
public function getRestore($assetId = null) | ||
{ | ||
// Get asset information | ||
|
@@ -775,14 +775,14 @@ public function auditStore(AssetFileRequest $request, $id) | |
|
||
if ($request->hasFile('image')) { | ||
$file = $request->file('image'); | ||
try { | ||
$destinationPath = config('app.private_uploads').'/audits'; | ||
$extension = $file->getClientOriginalExtension(); | ||
$filename = 'audit-'.$asset->id.'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension; | ||
$file->move($destinationPath, $filename); | ||
} catch (\Exception $e) { | ||
\Log::error($e); | ||
} | ||
try { | ||
$destinationPath = config('app.private_uploads').'/audits'; | ||
$extension = $file->getClientOriginalExtension(); | ||
$filename = 'audit-'.$asset->id.'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$extension; | ||
$file->move($destinationPath, $filename); | ||
} catch (\Exception $e) { | ||
\Log::error($e); | ||
} | ||
} | ||
|
||
$asset->logAudit($request->input('note'), $request->input('location_id'), $filename); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.