Skip to content

A free open source IT asset/license management system

scratch code for this issue

spencerrlongg4841b891091c
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index ce8b870eb2..ecf1b13321 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -213,6 +213,15 @@ class Asset extends Depreciable
$this->attributes['expected_checkin'] = $value;
}
+ public function withValidator($validator)
+ {
+ foreach ($this->customFields as $field) {
+ if ($field->isEncrypted()) {
+ Crypt::decrypt($this->value);
+ }
+ }
+ }
+
/**
* This handles the custom field validation for assets
*
diff --git a/app/Models/CustomFieldset.php b/app/Models/CustomFieldset.php
index 71be28e8a3..c286005bf4 100644
--- a/app/Models/CustomFieldset.php
+++ b/app/Models/CustomFieldset.php
@@ -92,6 +92,10 @@ class CustomFieldset extends Model
$rule[] = 'unique_undeleted';
}
+ if ($field->hasFormat() && $field->isEncrypted()) {
+ $rule[] = $rule.'-encrypted';
+ }
+
array_push($rule, $field->attributes['format']);
$rules[$field->db_column_name()] = $rule;