mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Merge pull request #14001 from Godmartinz/feature/sc-18577
Added Status Label names to Asset history/ Action log
This commit is contained in:
commit
e1d2fdcfb7
|
@ -6,6 +6,7 @@ use App\Models\Actionlog;
|
|||
use App\Models\Asset;
|
||||
use App\Models\CustomField;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\Company;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\Location;
|
||||
|
@ -215,6 +216,7 @@ class ActionlogsTransformer
|
|||
{ $location = Location::withTrashed()->get();
|
||||
$supplier = Supplier::withTrashed()->get();
|
||||
$model = AssetModel::withTrashed()->get();
|
||||
$status = Statuslabel::withTrashed()->get();
|
||||
$company = Company::get();
|
||||
|
||||
|
||||
|
@ -288,6 +290,19 @@ class ActionlogsTransformer
|
|||
$clean_meta['Supplier'] = $clean_meta['supplier_id'];
|
||||
unset($clean_meta['supplier_id']);
|
||||
}
|
||||
if(array_key_exists('status_id', $clean_meta)) {
|
||||
|
||||
$oldStatus = $status->find($clean_meta['status_id']['old']);
|
||||
$oldStatusName = $oldStatus ? e($oldStatus->name) : trans('admin/statuslabels/message.deleted_label');
|
||||
|
||||
$newStatus = $status->find($clean_meta['status_id']['new']);
|
||||
$newStatusName = $newStatus ? e($newStatus->name) : trans('admin/statuslabels/message.deleted_label');
|
||||
|
||||
$clean_meta['status_id']['old'] = $clean_meta['status_id']['old'] ? "[id: ".$clean_meta['status_id']['old']."] ". $oldStatusName : trans('general.unassigned');
|
||||
$clean_meta['status_id']['new'] = $clean_meta['status_id']['new'] ? "[id: ".$clean_meta['status_id']['new']."] ". $newStatusName : trans('general.unassigned');
|
||||
$clean_meta['Status'] = $clean_meta['status_id'];
|
||||
unset($clean_meta['status_id']);
|
||||
}
|
||||
if(array_key_exists('asset_eol_date', $clean_meta)) {
|
||||
$clean_meta['EOL date'] = $clean_meta['asset_eol_date'];
|
||||
unset($clean_meta['asset_eol_date']);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
return [
|
||||
|
||||
'does_not_exist' => 'Status Label does not exist.',
|
||||
'deleted_label' => 'Deleted Status Label',
|
||||
'assoc_assets' => 'This Status Label is currently associated with at least one Asset and cannot be deleted. Please update your assets to no longer reference this status and try again. ',
|
||||
|
||||
'create' => [
|
||||
|
|
Loading…
Reference in a new issue