mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
added status names to asset history
This commit is contained in:
parent
34bf6818ca
commit
49342a4542
|
@ -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;
|
||||
|
@ -212,6 +213,7 @@ class ActionlogsTransformer
|
|||
{ $location = Location::withTrashed()->get();
|
||||
$supplier = Supplier::withTrashed()->get();
|
||||
$model = AssetModel::withTrashed()->get();
|
||||
$status = Statuslabel::withTrashed()->get();
|
||||
$company = Company::get();
|
||||
|
||||
|
||||
|
@ -285,6 +287,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'] ? $oldStatusName : trans('general.unassigned');
|
||||
$clean_meta['status_id']['new'] = $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