removed references to archived

This commit is contained in:
spencerrlongg 2023-11-30 15:59:03 -06:00
parent 133c469e36
commit 88b6a541ee
4 changed files with 1 additions and 7 deletions

View file

@ -545,7 +545,6 @@ class AssetsController extends Controller
// @todo: verify eol is working as expected - move to request? or do I want this at all? // @todo: verify eol is working as expected - move to request? or do I want this at all?
// might just remove this and then use the method from here https://github.com/snipe/snipe-it/pull/13846 // might just remove this and then use the method from here https://github.com/snipe/snipe-it/pull/13846
$asset->asset_eol_date = $request->validated()['asset_eol_date'] ?? $asset->present()->eol_date(); // so this isn't really necessary, because it's happening on the observer - but that might change? $asset->asset_eol_date = $request->validated()['asset_eol_date'] ?? $asset->present()->eol_date(); // so this isn't really necessary, because it's happening on the observer - but that might change?
$asset->archived = false;
$asset->physical = '1'; $asset->physical = '1';
$asset->depreciate = '0'; $asset->depreciate = '0';

View file

@ -131,7 +131,6 @@ class AssetsController extends Controller
$asset->order_number = $request->input('order_number'); $asset->order_number = $request->input('order_number');
$asset->notes = $request->input('notes'); $asset->notes = $request->input('notes');
$asset->user_id = Auth::id(); $asset->user_id = Auth::id();
$asset->archived = '0';
$asset->physical = '1'; $asset->physical = '1';
$asset->depreciate = '0'; $asset->depreciate = '0';
$asset->status_id = request('status_id'); $asset->status_id = request('status_id');

View file

@ -70,7 +70,6 @@ class Asset extends Depreciable
protected $injectUniqueIdentifier = true; protected $injectUniqueIdentifier = true;
protected $casts = [ protected $casts = [
'archived' => 'boolean',
'physical' => 'boolean', 'physical' => 'boolean',
'purchase_date' => 'date', 'purchase_date' => 'date',
'eol_explicit' => 'boolean', 'eol_explicit' => 'boolean',
@ -743,7 +742,7 @@ class Asset extends Depreciable
{ {
$days = (is_null($days)) ? 30 : $days; $days = (is_null($days)) ? 30 : $days;
return self::where('archived', '=', '0') return self::where('archived', '=', '0') // this can stay for right now, as `archived` defaults to 0 at the db level, but should probably be replaced with assetstatus->archived?
->whereNotNull('warranty_months') ->whereNotNull('warranty_months')
->whereNotNull('purchase_date') ->whereNotNull('purchase_date')
->whereNull('deleted_at') ->whereNull('deleted_at')

View file

@ -37,7 +37,6 @@ class AssetStoreTest extends TestCase
$response = $this->actingAsForApi($user) $response = $this->actingAsForApi($user)
->postJson(route('api.assets.store'), [ ->postJson(route('api.assets.store'), [
'archived' => false, // set explicitly in controller
'asset_eol_date' => '2024-06-02', 'asset_eol_date' => '2024-06-02',
'asset_tag' => 'random_string', 'asset_tag' => 'random_string',
'assigned_user' => $userAssigned->id, // assigned_to is set in the request, assigned_to isn't set through the api request 'assigned_user' => $userAssigned->id, // assigned_to is set in the request, assigned_to isn't set through the api request
@ -67,8 +66,6 @@ class AssetStoreTest extends TestCase
$this->assertTrue($asset->adminuser->is($user)); $this->assertTrue($asset->adminuser->is($user));
// @todo: this is explicitly set 0 in the controller but they docs say they are customizable
$this->assertFalse($asset->archived);
$this->assertTrue($asset->physical); $this->assertTrue($asset->physical);
// @todo: This isn't in the docs but it's in the controller // @todo: This isn't in the docs but it's in the controller
$this->assertEquals('2024-06-02', $asset->asset_eol_date); $this->assertEquals('2024-06-02', $asset->asset_eol_date);