mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-26 13:10:55 -08:00
Merge pull request #11048 from Godmartinz/bug/sc-18989/purchase-cost-can-be-negative
Fixed validation for purchase cost allowed to be negative
This commit is contained in:
commit
446e44deb6
|
@ -61,7 +61,7 @@ class Accessory extends SnipeModel
|
||||||
'category_id' => 'required|integer|exists:categories,id',
|
'category_id' => 'required|integer|exists:categories,id',
|
||||||
'company_id' => 'integer|nullable',
|
'company_id' => 'integer|nullable',
|
||||||
'min_amt' => 'integer|min:0|nullable',
|
'min_amt' => 'integer|min:0|nullable',
|
||||||
'purchase_cost' => 'numeric|nullable',
|
'purchase_cost' => 'numeric|nullable|gte:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Asset extends Depreciable
|
||||||
'asset_tag' => 'required|min:1|max:255|unique_undeleted',
|
'asset_tag' => 'required|min:1|max:255|unique_undeleted',
|
||||||
'status' => 'integer',
|
'status' => 'integer',
|
||||||
'serial' => 'unique_serial|nullable',
|
'serial' => 'unique_serial|nullable',
|
||||||
'purchase_cost' => 'numeric|nullable',
|
'purchase_cost' => 'numeric|nullable|gte:0',
|
||||||
'next_audit_date' => 'date|nullable',
|
'next_audit_date' => 'date|nullable',
|
||||||
'last_audit_date' => 'date|nullable',
|
'last_audit_date' => 'date|nullable',
|
||||||
'supplier_id' => 'exists:suppliers,id|nullable',
|
'supplier_id' => 'exists:suppliers,id|nullable',
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Component extends SnipeModel
|
||||||
'company_id' => 'integer|nullable',
|
'company_id' => 'integer|nullable',
|
||||||
'min_amt' => 'integer|min:0|nullable',
|
'min_amt' => 'integer|min:0|nullable',
|
||||||
'purchase_date' => 'date|nullable',
|
'purchase_date' => 'date|nullable',
|
||||||
'purchase_cost' => 'numeric|nullable',
|
'purchase_cost' => 'numeric|nullable|gte:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Consumable extends SnipeModel
|
||||||
'category_id' => 'required|integer',
|
'category_id' => 'required|integer',
|
||||||
'company_id' => 'integer|nullable',
|
'company_id' => 'integer|nullable',
|
||||||
'min_amt' => 'integer|min:0|nullable',
|
'min_amt' => 'integer|min:0|nullable',
|
||||||
'purchase_cost' => 'numeric|nullable',
|
'purchase_cost' => 'numeric|nullable|gte:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,6 +48,7 @@ class License extends Depreciable
|
||||||
'notes' => 'string|nullable',
|
'notes' => 'string|nullable',
|
||||||
'category_id' => 'required|exists:categories,id',
|
'category_id' => 'required|exists:categories,id',
|
||||||
'company_id' => 'integer|nullable',
|
'company_id' => 'integer|nullable',
|
||||||
|
'purchase_cost'=> 'numeric|nullable|gte:0',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -91,6 +91,10 @@ return [
|
||||||
'url' => 'The :attribute format is invalid.',
|
'url' => 'The :attribute format is invalid.',
|
||||||
'unique_undeleted' => 'The :attribute must be unique.',
|
'unique_undeleted' => 'The :attribute must be unique.',
|
||||||
'non_circular' => 'The :attribute must not create a circular reference.',
|
'non_circular' => 'The :attribute must not create a circular reference.',
|
||||||
|
'gte' => [
|
||||||
|
'numeric' => 'Value cannot be negative'
|
||||||
|
],
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue