diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index f69ad9bab1..f587435b60 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -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? // 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->archived = false; $asset->physical = '1'; $asset->depreciate = '0'; diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 96933855fb..6384e0f121 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -131,7 +131,6 @@ class AssetsController extends Controller $asset->order_number = $request->input('order_number'); $asset->notes = $request->input('notes'); $asset->user_id = Auth::id(); - $asset->archived = '0'; $asset->physical = '1'; $asset->depreciate = '0'; $asset->status_id = request('status_id'); diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 0073888ec4..9a696b22dd 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -70,7 +70,6 @@ class Asset extends Depreciable protected $injectUniqueIdentifier = true; protected $casts = [ - 'archived' => 'boolean', 'physical' => 'boolean', 'purchase_date' => 'date', 'eol_explicit' => 'boolean', @@ -743,7 +742,7 @@ class Asset extends Depreciable { $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('purchase_date') ->whereNull('deleted_at') diff --git a/tests/Feature/Api/Assets/AssetStoreTest.php b/tests/Feature/Api/Assets/AssetStoreTest.php index acde9414c3..88f833afb5 100644 --- a/tests/Feature/Api/Assets/AssetStoreTest.php +++ b/tests/Feature/Api/Assets/AssetStoreTest.php @@ -37,7 +37,6 @@ class AssetStoreTest extends TestCase $response = $this->actingAsForApi($user) ->postJson(route('api.assets.store'), [ - 'archived' => false, // set explicitly in controller 'asset_eol_date' => '2024-06-02', 'asset_tag' => 'random_string', '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)); - // @todo: this is explicitly set 0 in the controller but they docs say they are customizable - $this->assertFalse($asset->archived); $this->assertTrue($asset->physical); // @todo: This isn't in the docs but it's in the controller $this->assertEquals('2024-06-02', $asset->asset_eol_date);