diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index 870bf6d162..312c9b44b2 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -135,11 +135,10 @@ class AssetImporter extends ItemImporter $asset->{$custom_field} = $val; } } - + //this sets an attribute on the Loggable trait for the action log + $asset->setImported(true); if ($asset->save()) { - //$asset->logCreate(trans('general.importer.import_note')); - $asset->setImported(true); $this->log('Asset '.$this->item['name'].' with serial number '.$this->item['serial'].' was created'); // If we have a target to checkout to, lets do so. diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index 8d63d19882..9e9355ea74 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -8,7 +8,8 @@ use Illuminate\Support\Facades\Auth; trait Loggable { - public ?bool $imported = false; // Import note attribute + // an attribute for setting whether or not the item was imported + public ?bool $imported = false; /** * @author Daniel Meltzer @@ -25,11 +26,6 @@ trait Loggable $this->imported = $bool; } - public function getImported(): bool - { - return $this->imported; - } - /** * @author Daniel Meltzer * @since [v3.4] diff --git a/app/Observers/AssetObserver.php b/app/Observers/AssetObserver.php index 55cd05471d..c94a7046e0 100644 --- a/app/Observers/AssetObserver.php +++ b/app/Observers/AssetObserver.php @@ -109,9 +109,8 @@ class AssetObserver $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); - $logAction->note = 'poop'; - if($asset->getImported()) { - $logAction->note = "this asset was imported"; + if($asset->imported) { + $logAction->note = trans('general.importer.import_note'); } $logAction->logaction('create'); }