Skip to content

A free open source IT asset/license management system

Apply correct unique custom field validation for audit API

snipe6eb381949234
diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php
index 5f6e1d1a14..8919722bda 100644
--- a/app/Http/Controllers/Api/AssetsController.php
+++ b/app/Http/Controllers/Api/AssetsController.php
@@ -1141,8 +1141,8 @@ class AssetsController extends Controller
}
}
- // Validate custom fields
- Validator::make($asset->toArray(), $asset->customFieldValidationRules())->validate();
+ // Invoke the validation to see if the audit will complete successfully
+ $asset->setRules($asset->getRules() + $asset->customFieldValidationRules());
// Validate the rest of the data before we turn off the event dispatcher
if ($asset->isInvalid()) {