initial work, not working yet
This commit is contained in:
parent
b39d11cc06
commit
c9101f4d97
4 changed files with 24 additions and 2 deletions
|
@ -599,7 +599,12 @@ class AssetsController extends Controller
|
||||||
$target = Location::find(request('assigned_location'));
|
$target = Location::find(request('assigned_location'));
|
||||||
}
|
}
|
||||||
if (isset($target)) {
|
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) {
|
if ($asset->image) {
|
||||||
|
|
|
@ -138,7 +138,8 @@ class AssetImporter extends ItemImporter
|
||||||
|
|
||||||
if ($asset->save()) {
|
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');
|
$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,6 +8,8 @@ use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
trait Loggable
|
trait Loggable
|
||||||
{
|
{
|
||||||
|
public ?bool $imported = false; // Import note attribute
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
||||||
* @since [v3.4]
|
* @since [v3.4]
|
||||||
|
@ -18,6 +20,16 @@ trait Loggable
|
||||||
return $this->morphMany(Actionlog::class, 'item');
|
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>
|
* @author Daniel Meltzer <dmeltzer.devel@gmail.com>
|
||||||
* @since [v3.4]
|
* @since [v3.4]
|
||||||
|
|
|
@ -109,6 +109,10 @@ 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->getImported()) {
|
||||||
|
$logAction->note = "this asset was imported";
|
||||||
|
}
|
||||||
$logAction->logaction('create');
|
$logAction->logaction('create');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue