mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
initial work, not working yet
This commit is contained in:
parent
b39d11cc06
commit
c9101f4d97
|
@ -599,7 +599,12 @@ class AssetsController extends Controller
|
|||
$target = Location::find(request('assigned_location'));
|
||||
}
|
||||
if (isset($target)) {
|
||||
$asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), '', 'Checked out on asset creation', e($request->get('name')));
|
||||
$asset->checkOut($target,
|
||||
Auth::user(),
|
||||
date('Y-m-d H:i:s'),
|
||||
'',
|
||||
'Checked out on asset creation',
|
||||
e($request->get('name')));
|
||||
}
|
||||
|
||||
if ($asset->image) {
|
||||
|
|
|
@ -138,7 +138,8 @@ class AssetImporter extends ItemImporter
|
|||
|
||||
if ($asset->save()) {
|
||||
|
||||
$asset->logCreate(trans('general.importer.import_note'));
|
||||
//$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.
|
||||
|
|
|
@ -8,6 +8,8 @@ use Illuminate\Support\Facades\Auth;
|
|||
|
||||
trait Loggable
|
||||
{
|
||||
public ?bool $imported = false; // Import note attribute
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
||||
* @since [v3.4]
|
||||
|
@ -18,6 +20,16 @@ trait Loggable
|
|||
return $this->morphMany(Actionlog::class, 'item');
|
||||
}
|
||||
|
||||
public function setImported(bool $bool): void
|
||||
{
|
||||
$this->imported = $bool;
|
||||
}
|
||||
|
||||
public function getImported(): bool
|
||||
{
|
||||
return $this->imported;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
||||
* @since [v3.4]
|
||||
|
|
|
@ -109,6 +109,10 @@ 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";
|
||||
}
|
||||
$logAction->logaction('create');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue