Skip to content

A free open source IT asset/license management system

note and rm dump and comment

spencerrlongg8c6869fd3466
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index e0c0f45ef9..aa6a96d41a 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -215,16 +215,6 @@ class Asset extends Depreciable
$this->attributes['expected_checkin'] = $value;
}
- // i don't think this will work the way we'd need it to
- //public function withValidator(Validator $validator)
- //{
- // foreach ($this->customFields as $field) {
- // if ($field->field_encrypted) {
- // return 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 1059c5d5ff..d6bd7a1bef 100644
--- a/app/Models/CustomFieldset.php
+++ b/app/Models/CustomFieldset.php
@@ -98,6 +98,8 @@ class CustomFieldset extends Model
$rules[$field->db_column_name()] = $rule;
+ // these are to replace the standard 'numeric' and 'alpha' rules if the custom field is also encrypted.
+ // the values need to be decrypted first, because encrypted strings are alphanumeric
if ($field->format === 'NUMERIC' && $field->field_encrypted) {
$numericKey = array_search('numeric', $rules[$field->db_column_name()]);
$rules[$field->db_column_name()][$numericKey] = new NumericEncrypted;
@@ -122,8 +124,6 @@ class CustomFieldset extends Model
}
}
- dump($rules);
-
return $rules;
}
}