Merge pull request #9632 from inietov/fixes/api_allow_duplicate_asset_tags

Fixes an issue that allows duplicate asset tags when the Asset is created via API.
This commit is contained in:
snipe 2021-05-26 13:34:59 -07:00 committed by GitHub
commit b8d413a6b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,11 +180,6 @@ class Asset extends Depreciable
*/
public function save(array $params = [])
{
$settings = \App\Models\Setting::getSettings();
// I don't remember why we have this here? Asset tag would always be required, even if auto increment is on...
$this->rules['asset_tag'] = ($settings->auto_increment_assets == '1') ? 'max:255' : 'required';
if($this->model_id != '') {
$model = AssetModel::find($this->model_id);