mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
this works
This commit is contained in:
parent
c9101f4d97
commit
4a7df470f0
|
@ -135,11 +135,10 @@ class AssetImporter extends ItemImporter
|
||||||
$asset->{$custom_field} = $val;
|
$asset->{$custom_field} = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//this sets an attribute on the Loggable trait for the action log
|
||||||
|
$asset->setImported(true);
|
||||||
if ($asset->save()) {
|
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');
|
$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.
|
// If we have a target to checkout to, lets do so.
|
||||||
|
|
|
@ -8,7 +8,8 @@ use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
trait Loggable
|
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>
|
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
||||||
|
@ -25,11 +26,6 @@ trait Loggable
|
||||||
$this->imported = $bool;
|
$this->imported = $bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getImported(): bool
|
|
||||||
{
|
|
||||||
return $this->imported;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
||||||
* @since [v3.4]
|
* @since [v3.4]
|
||||||
|
|
|
@ -109,9 +109,8 @@ class AssetObserver
|
||||||
$logAction->item_id = $asset->id;
|
$logAction->item_id = $asset->id;
|
||||||
$logAction->created_at = date('Y-m-d H:i:s');
|
$logAction->created_at = date('Y-m-d H:i:s');
|
||||||
$logAction->user_id = Auth::id();
|
$logAction->user_id = Auth::id();
|
||||||
$logAction->note = 'poop';
|
if($asset->imported) {
|
||||||
if($asset->getImported()) {
|
$logAction->note = trans('general.importer.import_note');
|
||||||
$logAction->note = "this asset was imported";
|
|
||||||
}
|
}
|
||||||
$logAction->logaction('create');
|
$logAction->logaction('create');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue