From 4841b891091c9d1e0b19daf03091e9ea1ac4a749 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Wed, 13 Nov 2024 12:45:39 -0600 Subject: [PATCH] scratch code for this issue --- app/Models/Asset.php | 9 +++++++++ app/Models/CustomFieldset.php | 4 ++++ 2 files changed, 13 insertions(+) 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;