A free open source IT asset/license management system
Add "string" to serial rules for asset
Marcus Mooreb8fe3b18d4f9
diff --git a/app/Models/Asset.php b/app/Models/Asset.phpindex 72bef375f6..e983e6969a 100644--- a/app/Models/Asset.php+++ b/app/Models/Asset.php@@ -112,7 +112,7 @@ class Asset extends Depreciable'location_id' => ['nullable', 'exists:locations,id', 'fmcs_location'],'rtd_location_id' => ['nullable', 'exists:locations,id', 'fmcs_location'],'purchase_date' => ['nullable', 'date', 'date_format:Y-m-d'],- 'serial' => ['nullable', 'unique_undeleted:assets,serial'],+ 'serial' => ['nullable', 'string', 'unique_undeleted:assets,serial'],'purchase_cost' => ['nullable', 'numeric', 'gte:0', 'max:9999999999999'],'supplier_id' => ['nullable', 'exists:suppliers,id'],'asset_eol_date' => ['nullable', 'date'],diff --git a/tests/Feature/Assets/Api/StoreAssetTest.php b/tests/Feature/Assets/Api/StoreAssetTest.phpindex a5531472a0..e35a1371b6 100644--- a/tests/Feature/Assets/Api/StoreAssetTest.php+++ b/tests/Feature/Assets/Api/StoreAssetTest.php@@ -707,6 +707,22 @@ class StoreAssetTest extends TestCase});}+ public function test_serial_validation()+ {+ $this->actingAsForApi(User::factory()->superuser()->create())+ ->postJson(route('api.assets.store'), [+ 'asset_tag' => '1234',+ 'model_id' => AssetModel::factory()->create()->id,+ 'status_id' => Statuslabel::factory()->readyToDeploy()->create()->id,+ 'serial' => [+ // this should not be an array+ ],+ ])+ ->assertOk()+ ->assertStatusMessageIs('error')+ ->assertMessagesContains('serial');+ }+public function testEncryptedCustomFieldCanBeStored(){$this->markIncompleteIfMySQL('Custom Fields tests do not work on MySQL');