Skip to content

A free open source IT asset/license management system

Updated validation to allow nullable integrers #3064

snipe2f03c5ddb0b1
diff --git a/app/Models/AssetMaintenance.php b/app/Models/AssetMaintenance.php
index 323b235c39..2cc945c41d 100644
--- a/app/Models/AssetMaintenance.php
+++ b/app/Models/AssetMaintenance.php
@@ -31,7 +31,7 @@ class AssetMaintenance extends Model implements ICompanyableChild
'start_date' => 'required|date_format:Y-m-d',
'completion_date' => 'date_format:Y-m-d',
'notes' => 'string',
- 'cost' => 'numeric'
+ 'cost' => 'numeric|nullable'
];
public function getCompanyableParents()
diff --git a/app/Models/Component.php b/app/Models/Component.php
index e278f43002..9d85023115 100644
--- a/app/Models/Component.php
+++ b/app/Models/Component.php
@@ -35,9 +35,9 @@ class Component extends SnipeModel
'name' => 'required|min:3|max:255',
'qty' => 'required|integer|min:1',
'category_id' => 'required|integer',
- 'company_id' => 'integer',
- 'purchase_date' => 'date',
- 'purchase_cost' => 'numeric',
+ 'company_id' => 'integer|nullable',
+ 'purchase_date' => 'date|nullable',
+ 'purchase_cost' => 'numeric|nullable',
);
/**
diff --git a/app/Models/Consumable.php b/app/Models/Consumable.php
index e65e89cb96..9ccf3db32b 100644
--- a/app/Models/Consumable.php
+++ b/app/Models/Consumable.php
@@ -30,9 +30,9 @@ class Consumable extends SnipeModel
'name' => 'required|min:3|max:255',
'qty' => 'required|integer|min:0',
'category_id' => 'required|integer',
- 'company_id' => 'integer',
+ 'company_id' => 'integer|nullable',
'min_amt' => 'integer|min:1',
- 'purchase_cost' => 'numeric',
+ 'purchase_cost' => 'numeric|nullable',
);
/**
diff --git a/app/Models/Location.php b/app/Models/Location.php
index 22f7714de2..27623222c8 100755
--- a/app/Models/Location.php
+++ b/app/Models/Location.php
@@ -15,13 +15,13 @@ class Location extends SnipeModel
protected $dates = ['deleted_at'];
protected $table = 'locations';
protected $rules = array(
- 'name' => 'required|min:3|max:255|unique_undeleted',
- 'city' => 'min:3|max:255',
- 'state' => 'min:0|max:2',
- 'country' => 'min:2|max:2',
- 'address' => 'min:5|max:80',
- 'address2' => 'min:2|max:80',
- 'zip' => 'min:3|max:10',
+ 'name' => 'required|min:2|max:255|unique_undeleted',
+ 'city' => 'min:3|max:255|nullable',
+ 'state' => 'max:2|nullable',
+ 'country' => 'min:2|max:2|nullable',
+ 'address' => 'max:80|nullable',
+ 'address2' => 'max:80|nullable',
+ 'zip' => 'min:3|max:10|nullable',
);
/**