From c284d8d4369aa72f3e79ece28fa38e0507a41b81 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 Feb 2023 11:41:19 -0800 Subject: [PATCH] Added strings, variables to the controllers Signed-off-by: snipe --- app/Http/Controllers/Assets/AssetsController.php | 5 ++--- app/Models/Asset.php | 1 - app/Models/Loggable.php | 3 ++- resources/lang/en/admin/hardware/general.php | 3 ++- resources/lang/en/help.php | 9 +-------- resources/views/hardware/audit.blade.php | 13 +++++++++++++ 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 1c7080bd46..8cfc89004f 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -851,11 +851,11 @@ class AssetsController extends Controller $asset->next_audit_date = $request->input('next_audit_date'); $asset->last_audit_date = date('Y-m-d H:i:s'); + $asset->audit_type = $request->input('audit_type', 'physical'); // Check to see if they checked the box to update the physical location, // not just note it in the audit notes if ($request->input('update_location') == '1') { - \Log::debug('update location in audit'); $asset->location_id = $request->input('location_id'); } @@ -874,8 +874,7 @@ class AssetsController extends Controller Storage::putFileAs($path, $upload, $file_name); } - - $asset->logAudit($request->input('note'), $request->input('location_id'), $file_name); + $asset->logAudit($request->input('note'), $request->input('location_id'), $file_name, $request->input('audit_type')); return redirect()->route('assets.audit.due')->with('success', trans('admin/hardware/message.audit.success')); } } diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 725d1eee81..0b6e32dadd 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -1148,7 +1148,6 @@ class Asset extends Depreciable return $query->whereNotNull('assets.next_audit_date') ->whereRaw('DATE_SUB('.DB::getTablePrefix()."assets.next_audit_date, INTERVAL $interval DAY) <= '".Carbon::now()."'") - ->where('assets.archived', '=', 0) ->NotArchived(); } diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index 53ff279a09..2f99e732dc 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -169,7 +169,7 @@ trait Loggable * @since [v4.0] * @return \App\Models\Actionlog */ - public function logAudit($note, $location_id, $filename = null) + public function logAudit($note, $location_id, $filename = null, $audit_type = null) { $log = new Actionlog; $location = Location::find($location_id); @@ -184,6 +184,7 @@ trait Loggable $log->note = $note; $log->user_id = Auth::user()->id; $log->filename = $filename; + $log->audit_type = $audit_type; $log->logaction('audit'); $params = [ diff --git a/resources/lang/en/admin/hardware/general.php b/resources/lang/en/admin/hardware/general.php index 7aa0db7f34..6a123fc05d 100644 --- a/resources/lang/en/admin/hardware/general.php +++ b/resources/lang/en/admin/hardware/general.php @@ -42,5 +42,6 @@ return [ 'error_messages' => 'Error messages:', 'success_messages' => 'Success messages:', 'alert_details' => 'Please see below for details.', - 'custom_export' => 'Custom Export' + 'custom_export' => 'Custom Export', + 'audit_type_physical' => 'This asset was physically audited', ]; diff --git a/resources/lang/en/help.php b/resources/lang/en/help.php index ac0df59422..302600746f 100644 --- a/resources/lang/en/help.php +++ b/resources/lang/en/help.php @@ -14,21 +14,14 @@ return [ */ 'more_info_title' => 'More Info', - 'audit_help' => 'Checking this box will edit the asset record to reflect this new location. Leaving it unchecked will simply note the location in the audit log.

Note that is this asset is checked out, it will not change the location of the person, asset or location it is checked out to.', - 'assets' => 'Assets are items tracked by serial number or asset tag. They tend to be higher value items where identifying a specific item matters.', - 'categories' => 'Categories help you organize your items. Some example categories might be "Desktops", "Laptops", "Mobile Phones", "Tablets", and so on, but you can use categories any way that makes sense for you.', - 'accessories' => 'Accessories are anything you issue to users but that do not have a serial number (or you do not care about tracking them uniquely). For example, computer mice or keyboards.', - 'companies' => 'Companies can be used as a simple identifier field, or can be used to limit visibility of assets, users, etc if full company support is enabled in your Admin settings.', - 'components' => 'Components are items that are part of an asset, for example HDD, RAM, etc.', - 'consumables' => 'Consumables are anything purchased that will be used up over time. For example, printer ink or copier paper.', - 'depreciations' => 'You can set up asset depreciations to depreciate assets based on straight-line depreciation.', + 'physical_audit_help' => 'This box should be checked if the asset was physically examined by staff (versus self-auditing for remote users)', ]; diff --git a/resources/views/hardware/audit.blade.php b/resources/views/hardware/audit.blade.php index 5b147c5492..53e61c6d46 100644 --- a/resources/views/hardware/audit.blade.php +++ b/resources/views/hardware/audit.blade.php @@ -53,6 +53,19 @@ @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id']) +
+
+ + + + @include ('partials.more-info', ['helpText' => trans('help.physical_audit_help'), 'helpPosition' => 'right']) + +
+
+