mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
commit
0ac5d4d582
|
@ -156,10 +156,9 @@ class ActionlogsTransformer
|
|||
* @param array $clean_meta
|
||||
* @return array
|
||||
*/
|
||||
public function changedInfo(array $clean_meta) {
|
||||
|
||||
$location = Location::withTrashed()->get();
|
||||
$company = Company::withTrashed()->get();
|
||||
public function changedInfo(array $clean_meta)
|
||||
{ $location = Location::withTrashed()->get();
|
||||
$supplier = Supplier::withTrashed()->get();
|
||||
$model = AssetModel::withTrashed()->get();
|
||||
|
||||
|
@ -180,12 +179,19 @@ class ActionlogsTransformer
|
|||
|
||||
$clean_meta['model_id']['old'] = "[id: ".$clean_meta['model_id']['old']."] ".$model->find($clean_meta['model_id']['old'])->name;
|
||||
$clean_meta['model_id']['new'] = "[id: ".$clean_meta['model_id']['new']."] ".$model->find($clean_meta['model_id']['new'])->name; /* model is required at asset creation */
|
||||
|
||||
$clean_meta['Model'] = $clean_meta['model_id'];
|
||||
unset($clean_meta['model_id']);
|
||||
}
|
||||
if(array_key_exists('company_id', $clean_meta)) {
|
||||
$clean_meta['company_id']['old'] = $clean_meta['company_id']['old'] ? "[id: ".$clean_meta['company_id']['old']."]".$company->find($clean_meta['company_id']['old'])->name : trans('general.unassigned');
|
||||
$clean_meta['company_id']['new'] = $clean_meta['company_id']['new'] ? "[id: ".$clean_meta['company_id']['new']."] ".$company->find($clean_meta['company_id']['new'])->name : trans('general.unassigned');
|
||||
$oldCompany = Company::find($clean_meta['company_id']['old']);
|
||||
$oldCompanyName = $oldCompany->name ?? trans('admin/companies/message.deleted');
|
||||
|
||||
$newCompany = Company::find($clean_meta['company_id']['new']);
|
||||
$newCompanyName = $newCompany->name ?? trans('admin/companies/message.deleted');
|
||||
|
||||
$clean_meta['company_id']['old'] = $clean_meta['company_id']['old'] ? "[id: ".$clean_meta['company_id']['old']."] ". $oldCompanyName : trans('general.unassigned');
|
||||
$clean_meta['company_id']['new'] = $clean_meta['company_id']['new'] ? "[id: ".$clean_meta['company_id']['new']."] ". $newCompanyName : trans('general.unassigned');
|
||||
$clean_meta['Company'] = $clean_meta['company_id'];
|
||||
unset($clean_meta['company_id']);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
return [
|
||||
'does_not_exist' => 'Company does not exist.',
|
||||
'deleted' => 'Deleted company',
|
||||
'assoc_users' => 'This company is currently associated with at least one model and cannot be deleted. Please update your models to no longer reference this company and try again. ',
|
||||
'create' => [
|
||||
'error' => 'Company was not created, please try again.',
|
||||
|
|
Loading…
Reference in a new issue