this works

This commit is contained in:
spencerrlongg 2024-01-25 19:34:41 -06:00
parent c9101f4d97
commit 4a7df470f0
3 changed files with 6 additions and 12 deletions

View file

@ -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.

View file

@ -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 <dmeltzer.devel@gmail.com>
@ -25,11 +26,6 @@ trait Loggable
$this->imported = $bool;
}
public function getImported(): bool
{
return $this->imported;
}
/**
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
* @since [v3.4]

View file

@ -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');
}