Skip to content

A free open source IT asset/license management system

Validate comapny exists

sniped032a51a3dff
diff --git a/app/Models/Accessory.php b/app/Models/Accessory.php
index 7e101bf89d..f828ee7fa8 100755
--- a/app/Models/Accessory.php
+++ b/app/Models/Accessory.php
@@ -80,7 +80,7 @@ class Accessory extends SnipeModel
'name' => 'required|max:255',
'qty' => 'nullable|integer|min:0',
'category_id' => 'required|integer|exists:categories,id',
- 'company_id' => 'integer|nullable',
+ 'company_id' => 'integer|nullable|exists:companies,id',
'location_id' => 'exists:locations,id|nullable|fmcs_location',
'min_amt' => 'integer|min:0|nullable',
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php
index 2168951be3..a2f211ff15 100644
--- a/app/Models/Consumable.php
+++ b/app/Models/Consumable.php
@@ -48,7 +48,7 @@ class Consumable extends SnipeModel
'name' => 'required|max:255',
'qty' => 'required|integer|min:0|max:99999',
'category_id' => 'required|integer',
- 'company_id' => 'integer|nullable',
+ 'company_id' => 'integer|nullable|exists:companies,id',
'location_id' => 'exists:locations,id|nullable|fmcs_location',
'min_amt' => 'integer|min:0|max:99999|nullable',
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
diff --git a/app/Models/License.php b/app/Models/License.php
index e2c41089d6..c1fe4fb7a3 100755
--- a/app/Models/License.php
+++ b/app/Models/License.php
@@ -59,7 +59,7 @@ class License extends Depreciable
'license_name' => 'string|nullable|max:100',
'notes' => 'string|nullable',
'category_id' => 'required|exists:categories,id',
- 'company_id' => 'integer|nullable',
+ 'company_id' => 'integer|nullable|exists:companies,id',
'purchase_cost' => 'numeric|nullable|gte:0|max:99999999999999999.99',
'purchase_date' => 'date_format:Y-m-d|nullable|max:10|required_with:depreciation_id',
'expiration_date' => 'date_format:Y-m-d|nullable|max:10',